author | tille <tille> | 2002-07-20 12:09:24 (UTC) |
---|---|---|
committer | tille <tille> | 2002-07-20 12:09:24 (UTC) |
commit | 8c335cfdfffede8b7a864566ec4d9507a2978684 (patch) (unidiff) | |
tree | 6d346457a20b32597bf4fc54c7f3cca8f49ea060 | |
parent | ce7ca2ca68be48bee2661fcfeedb06faccd51408 (diff) | |
download | opie-8c335cfdfffede8b7a864566ec4d9507a2978684.zip opie-8c335cfdfffede8b7a864566ec4d9507a2978684.tar.gz opie-8c335cfdfffede8b7a864566ec4d9507a2978684.tar.bz2 |
missing space
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index a7deb8f..11c0f97 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,176 +1,176 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | 9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> |
10 | #include "pmipkg.h" | 10 | #include "pmipkg.h" |
11 | #include "pksettings.h" | 11 | #include "pksettings.h" |
12 | #include "package.h" | 12 | #include "package.h" |
13 | #include "packagelistitem.h" | 13 | #include "packagelistitem.h" |
14 | 14 | ||
15 | //#include <opie/oprocess.h> | 15 | //#include <opie/oprocess.h> |
16 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
17 | #include <qpe/config.h> | 17 | #include <qpe/config.h> |
18 | #include <qpe/stringutil.h> | 18 | #include <qpe/stringutil.h> |
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | #include <qdir.h> | 20 | #include <qdir.h> |
21 | #include <qfile.h> | 21 | #include <qfile.h> |
22 | #include <qgroupbox.h> | 22 | #include <qgroupbox.h> |
23 | #include <qmultilineedit.h> | 23 | #include <qmultilineedit.h> |
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qcheckbox.h> | 25 | #include <qcheckbox.h> |
26 | #include <qtextstream.h> | 26 | #include <qtextstream.h> |
27 | #include <qtextview.h> | 27 | #include <qtextview.h> |
28 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
29 | #include <qprogressbar.h> | 29 | #include <qprogressbar.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | 32 | ||
33 | #include <stdlib.h> | 33 | #include <stdlib.h> |
34 | #include <unistd.h> | 34 | #include <unistd.h> |
35 | 35 | ||
36 | #include "mainwindow.h" | 36 | #include "mainwindow.h" |
37 | 37 | ||
38 | 38 | ||
39 | 39 | ||
40 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 40 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
41 | : QObject ( p ) | 41 | : QObject ( p ) |
42 | { | 42 | { |
43 | settings = s; | 43 | settings = s; |
44 | runwindow = new RunWindow( p, name, true, f ); | 44 | runwindow = new RunWindow( p, name, true, f ); |
45 | 45 | ||
46 | Config cfg( "oipkg", Config::User ); | 46 | Config cfg( "oipkg", Config::User ); |
47 | cfg.setGroup( "ipkg" ); | 47 | cfg.setGroup( "ipkg" ); |
48 | ipkg_cmd = cfg.readEntry( "cmd", "ipkg" ); | 48 | ipkg_cmd = cfg.readEntry( "cmd", "ipkg" )+" "; |
49 | } | 49 | } |
50 | 50 | ||
51 | PmIpkg::~PmIpkg() | 51 | PmIpkg::~PmIpkg() |
52 | { | 52 | { |
53 | } | 53 | } |
54 | 54 | ||
55 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | 55 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) |
56 | { | 56 | { |
57 | bool ret=false; | 57 | bool ret=false; |
58 | QDir::setCurrent("/tmp"); | 58 | QDir::setCurrent("/tmp"); |
59 | QString cmd = ipkg_cmd; | 59 | QString cmd = ipkg_cmd; |
60 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 60 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
61 | if (!args.contains("update")) | 61 | if (!args.contains("update")) |
62 | { | 62 | { |
63 | if ( dest == "" ) | 63 | if ( dest == "" ) |
64 | cmd += " -dest "+settings->getDestinationName(); | 64 | cmd += " -dest "+settings->getDestinationName(); |
65 | else | 65 | else |
66 | cmd += " -dest "+ dest; | 66 | cmd += " -dest "+ dest; |
67 | 67 | ||
68 | cmd += " -force-defaults "; | 68 | cmd += " -force-defaults "; |
69 | 69 | ||
70 | if ( installDialog && installDialog->_force_depends ) | 70 | if ( installDialog && installDialog->_force_depends ) |
71 | { | 71 | { |
72 | if (installDialog->_force_depends->isChecked()) | 72 | if (installDialog->_force_depends->isChecked()) |
73 | cmd += " -force-depends "; | 73 | cmd += " -force-depends "; |
74 | if (installDialog->_force_reinstall->isChecked()) | 74 | if (installDialog->_force_reinstall->isChecked()) |
75 | cmd += " -force-reinstall "; | 75 | cmd += " -force-reinstall "; |
76 | if (installDialog->_force_remove->isChecked()) | 76 | if (installDialog->_force_remove->isChecked()) |
77 | cmd += " -force-removal-of-essential-packages "; | 77 | cmd += " -force-removal-of-essential-packages "; |
78 | } | 78 | } |
79 | } //!args.contains("update") | 79 | } //!args.contains("update") |
80 | 80 | ||
81 | out( "Starting to "+ args+"\n"); | 81 | out( "Starting to "+ args+"\n"); |
82 | qApp->processEvents(); | 82 | qApp->processEvents(); |
83 | cmd += args; | 83 | cmd += args; |
84 | out( "running:\n"+cmd+"\n" ); | 84 | out( "running:\n"+cmd+"\n" ); |
85 | pvDebug(2,"running:"+cmd); | 85 | pvDebug(2,"running:"+cmd); |
86 | qApp->processEvents(); | 86 | qApp->processEvents(); |
87 | FILE *fp; | 87 | FILE *fp; |
88 | char line[130]; | 88 | char line[130]; |
89 | QString lineStr, lineStrOld; | 89 | QString lineStr, lineStrOld; |
90 | sleep(1); | 90 | sleep(1); |
91 | cmd +=" 2>&1"; | 91 | cmd +=" 2>&1"; |
92 | fp = popen( (const char *) cmd, "r"); | 92 | fp = popen( (const char *) cmd, "r"); |
93 | if ( fp == NULL ) { | 93 | if ( fp == NULL ) { |
94 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); | 94 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); |
95 | out("\nError while executing "+ cmd+"\n\n"); | 95 | out("\nError while executing "+ cmd+"\n\n"); |
96 | ret = false; | 96 | ret = false; |
97 | } else { | 97 | } else { |
98 | while ( fgets( line, sizeof line, fp) != NULL) | 98 | while ( fgets( line, sizeof line, fp) != NULL) |
99 | { | 99 | { |
100 | lineStr = line; | 100 | lineStr = line; |
101 | lineStr=lineStr.left(lineStr.length()-1); | 101 | lineStr=lineStr.left(lineStr.length()-1); |
102 | //Configuring opie-oipkg...Done | 102 | //Configuring opie-oipkg...Done |
103 | if (lineStr.contains("Done")) ret = true; | 103 | if (lineStr.contains("Done")) ret = true; |
104 | if (lineStr!=lineStrOld) | 104 | if (lineStr!=lineStrOld) |
105 | out(lineStr); | 105 | out(lineStr); |
106 | lineStrOld = lineStr; | 106 | lineStrOld = lineStr; |
107 | qApp->processEvents(); | 107 | qApp->processEvents(); |
108 | } | 108 | } |
109 | } | 109 | } |
110 | pclose(fp); | 110 | pclose(fp); |
111 | pvDebug(2,QString(ret?"success\n":"failure\n")); | 111 | pvDebug(2,QString(ret?"success\n":"failure\n")); |
112 | return ret; | 112 | return ret; |
113 | } | 113 | } |
114 | 114 | ||
115 | void PmIpkg::makeLinks(Package *pack) | 115 | void PmIpkg::makeLinks(Package *pack) |
116 | { | 116 | { |
117 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 117 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
118 | QString pn = pack->name(); | 118 | QString pn = pack->name(); |
119 | linkPackage( pack->packageName(), pack->dest() ); | 119 | linkPackage( pack->packageName(), pack->dest() ); |
120 | } | 120 | } |
121 | 121 | ||
122 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | 122 | QStringList* PmIpkg::getList( QString packFileName, QString d ) |
123 | { | 123 | { |
124 | QString dest = settings->getDestinationUrlByName( d ); | 124 | QString dest = settings->getDestinationUrlByName( d ); |
125 | dest = dest==""?d:dest; | 125 | dest = dest==""?d:dest; |
126 | // if (dest == "/" ) return 0; | 126 | // if (dest == "/" ) return 0; |
127 | { | 127 | { |
128 | Config cfg( "oipkg", Config::User ); | 128 | Config cfg( "oipkg", Config::User ); |
129 | cfg.setGroup( "Common" ); | 129 | cfg.setGroup( "Common" ); |
130 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 130 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
131 | } | 131 | } |
132 | QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list"; | 132 | QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
133 | QFile f( packFileDir ); | 133 | QFile f( packFileDir ); |
134 | qDebug("Try to open %s", packFileDir.latin1()); | 134 | qDebug("Try to open %s", packFileDir.latin1()); |
135 | if ( ! f.open(IO_ReadOnly) ) | 135 | if ( ! f.open(IO_ReadOnly) ) |
136 | { | 136 | { |
137 | out( "Could not open:\n"+packFileDir ); | 137 | out( "Could not open:\n"+packFileDir ); |
138 | f.close(); | 138 | f.close(); |
139 | packFileDir = "/"+statusDir+"/info/"+packFileName+".list"; | 139 | packFileDir = "/"+statusDir+"/info/"+packFileName+".list"; |
140 | f.setName( packFileDir ); | 140 | f.setName( packFileDir ); |
141 | qDebug("Try to open %s", packFileDir.latin1()); | 141 | qDebug("Try to open %s", packFileDir.latin1()); |
142 | if ( ! f.open(IO_ReadOnly) ) | 142 | if ( ! f.open(IO_ReadOnly) ) |
143 | { | 143 | { |
144 | qDebug(" Panik! Could not open"+packFileDir); | 144 | qDebug(" Panik! Could not open"+packFileDir); |
145 | out( "Could not open:\n"+packFileDir+"\n Panik!" ); | 145 | out( "Could not open:\n"+packFileDir+"\n Panik!" ); |
146 | return (QStringList*)0; | 146 | return (QStringList*)0; |
147 | } | 147 | } |
148 | } | 148 | } |
149 | QStringList *fileList = new QStringList(); | 149 | QStringList *fileList = new QStringList(); |
150 | QTextStream t( &f ); | 150 | QTextStream t( &f ); |
151 | while ( !t.eof() ) | 151 | while ( !t.eof() ) |
152 | { | 152 | { |
153 | *fileList += t.readLine(); | 153 | *fileList += t.readLine(); |
154 | } | 154 | } |
155 | f.close(); | 155 | f.close(); |
156 | return fileList; | 156 | return fileList; |
157 | } | 157 | } |
158 | 158 | ||
159 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | 159 | void PmIpkg::linkPackage( QString packFileName, QString dest ) |
160 | { | 160 | { |
161 | if (dest == "root" || dest == "/" ) return; | 161 | if (dest == "root" || dest == "/" ) return; |
162 | QStringList *fileList = getList( packFileName, dest ); | 162 | QStringList *fileList = getList( packFileName, dest ); |
163 | processFileList( fileList, dest ); | 163 | processFileList( fileList, dest ); |
164 | delete fileList; | 164 | delete fileList; |
165 | } | 165 | } |
166 | 166 | ||
167 | void PmIpkg::processFileList( QStringList *fileList, QString d ) | 167 | void PmIpkg::processFileList( QStringList *fileList, QString d ) |
168 | { | 168 | { |
169 | if (!fileList) return; | 169 | if (!fileList) return; |
170 | for (uint i=0; i < fileList->count(); i++) | 170 | for (uint i=0; i < fileList->count(); i++) |
171 | { | 171 | { |
172 | QString dest = settings->getDestinationUrlByName( d ); | 172 | QString dest = settings->getDestinationUrlByName( d ); |
173 | dest = dest==""?d:dest; | 173 | dest = dest==""?d:dest; |
174 | processLinkDir( (*fileList)[i], dest ); | 174 | processLinkDir( (*fileList)[i], dest ); |
175 | } | 175 | } |
176 | } | 176 | } |