author | andyq <andyq> | 2002-10-29 18:33:34 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-10-29 18:33:34 (UTC) |
commit | 45d9a30ec17b5146ffdac8e776003752fe2deeea (patch) (unidiff) | |
tree | feeefaa97320466bd704c3b8253cfa5970616571 | |
parent | 2c3aa49e64a63f475bd60707c8cc105829691ab1 (diff) | |
download | opie-45d9a30ec17b5146ffdac8e776003752fe2deeea.zip opie-45d9a30ec17b5146ffdac8e776003752fe2deeea.tar.gz opie-45d9a30ec17b5146ffdac8e776003752fe2deeea.tar.bz2 |
Removed crap status message after ipkg finishes
-rw-r--r-- | noncore/settings/aqpkg/ipkg.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp index 731a336..c762633 100644 --- a/noncore/settings/aqpkg/ipkg.cpp +++ b/noncore/settings/aqpkg/ipkg.cpp | |||
@@ -64,193 +64,194 @@ bool Ipkg :: runIpkg( ) | |||
64 | cmd += " ; "; | 64 | cmd += " ; "; |
65 | } | 65 | } |
66 | cmd += "ipkg -force-defaults"; | 66 | cmd += "ipkg -force-defaults"; |
67 | if ( option != "update" && option != "download" ) | 67 | if ( option != "update" && option != "download" ) |
68 | { | 68 | { |
69 | cmd += " -dest "+ destination; | 69 | cmd += " -dest "+ destination; |
70 | 70 | ||
71 | if ( flags & FORCE_DEPENDS ) | 71 | if ( flags & FORCE_DEPENDS ) |
72 | cmd += " -force-depends"; | 72 | cmd += " -force-depends"; |
73 | if ( flags & FORCE_REINSTALL ) | 73 | if ( flags & FORCE_REINSTALL ) |
74 | cmd += " -force-reinstall"; | 74 | cmd += " -force-reinstall"; |
75 | if ( flags & FORCE_REMOVE ) | 75 | if ( flags & FORCE_REMOVE ) |
76 | cmd += " -force-removal-of-essential-packages"; | 76 | cmd += " -force-removal-of-essential-packages"; |
77 | if ( flags & FORCE_OVERWRITE ) | 77 | if ( flags & FORCE_OVERWRITE ) |
78 | cmd += " -force-overwrite"; | 78 | cmd += " -force-overwrite"; |
79 | 79 | ||
80 | // Handle make links | 80 | // Handle make links |
81 | // Rules - If make links is switched on, create links to root | 81 | // Rules - If make links is switched on, create links to root |
82 | // if destDir is NOT / | 82 | // if destDir is NOT / |
83 | if ( flags & MAKE_LINKS ) | 83 | if ( flags & MAKE_LINKS ) |
84 | { | 84 | { |
85 | // If destDir == / turn off make links as package is being insalled | 85 | // If destDir == / turn off make links as package is being insalled |
86 | // to root already. | 86 | // to root already. |
87 | if ( destDir == "/" ) | 87 | if ( destDir == "/" ) |
88 | flags ^= MAKE_LINKS; | 88 | flags ^= MAKE_LINKS; |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | #ifdef X86 | 92 | #ifdef X86 |
93 | cmd += " -f "; | 93 | cmd += " -f "; |
94 | cmd += IPKG_CONF; | 94 | cmd += IPKG_CONF; |
95 | #endif | 95 | #endif |
96 | 96 | ||
97 | 97 | ||
98 | if ( option == "reinstall" ) | 98 | if ( option == "reinstall" ) |
99 | cmd += " install"; | 99 | cmd += " install"; |
100 | else | 100 | else |
101 | cmd += " " + option; | 101 | cmd += " " + option; |
102 | if ( package != "" ) | 102 | if ( package != "" ) |
103 | cmd += " " + package; | 103 | cmd += " " + package; |
104 | cmd += " 2>&1"; | 104 | cmd += " 2>&1"; |
105 | 105 | ||
106 | 106 | ||
107 | if ( package != "" ) | 107 | if ( package != "" ) |
108 | emit outputText( QString( "Dealing with package " ) + package ); | 108 | emit outputText( QString( "Dealing with package " ) + package ); |
109 | 109 | ||
110 | qApp->processEvents(); | 110 | qApp->processEvents(); |
111 | 111 | ||
112 | // If we are removing packages and make links option is selected | 112 | // If we are removing packages and make links option is selected |
113 | // create the links | 113 | // create the links |
114 | if ( option == "remove" || option == "reinstall" ) | 114 | if ( option == "remove" || option == "reinstall" ) |
115 | { | 115 | { |
116 | createLinks = false; | 116 | createLinks = false; |
117 | if ( flags & MAKE_LINKS ) | 117 | if ( flags & MAKE_LINKS ) |
118 | { | 118 | { |
119 | emit outputText( QString( "Removing symbolic links...\n" ) ); | 119 | emit outputText( QString( "Removing symbolic links...\n" ) ); |
120 | linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); | 120 | linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); |
121 | emit outputText( QString( " " ) ); | 121 | emit outputText( QString( " " ) ); |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | emit outputText( cmd ); | 125 | emit outputText( cmd ); |
126 | 126 | ||
127 | // Execute command | 127 | // Execute command |
128 | dependantPackages = new QList<QString>; | 128 | dependantPackages = new QList<QString>; |
129 | dependantPackages->setAutoDelete( true ); | 129 | dependantPackages->setAutoDelete( true ); |
130 | 130 | ||
131 | ret = executeIpkgCommand( cmd, option ); | 131 | ret = executeIpkgCommand( cmd, option ); |
132 | 132 | ||
133 | if ( option == "install" || option == "reinstall" ) | 133 | if ( option == "install" || option == "reinstall" ) |
134 | { | 134 | { |
135 | // If we are not removing packages and make links option is selected | 135 | // If we are not removing packages and make links option is selected |
136 | // create the links | 136 | // create the links |
137 | createLinks = true; | 137 | createLinks = true; |
138 | if ( flags & MAKE_LINKS ) | 138 | if ( flags & MAKE_LINKS ) |
139 | { | 139 | { |
140 | emit outputText( " " ); | 140 | emit outputText( " " ); |
141 | emit outputText( QString( "Creating symbolic links for " )+ package ); | 141 | emit outputText( QString( "Creating symbolic links for " )+ package ); |
142 | 142 | ||
143 | linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); | 143 | linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); |
144 | 144 | ||
145 | // link dependant packages that were installed with this release | 145 | // link dependant packages that were installed with this release |
146 | QString *pkg; | 146 | QString *pkg; |
147 | for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() ) | 147 | for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() ) |
148 | { | 148 | { |
149 | if ( *pkg == package ) | 149 | if ( *pkg == package ) |
150 | continue; | 150 | continue; |
151 | emit outputText( " " ); | 151 | emit outputText( " " ); |
152 | emit outputText( QString( "Creating symbolic links for " )+ (*pkg) ); | 152 | emit outputText( QString( "Creating symbolic links for " )+ (*pkg) ); |
153 | linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir ); | 153 | linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir ); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | delete dependantPackages; | 158 | delete dependantPackages; |
159 | 159 | ||
160 | emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") ); | 160 | // emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") ); |
161 | emit outputText( "Finished" ); | ||
161 | emit outputText( "" ); | 162 | emit outputText( "" ); |
162 | return ret; | 163 | return ret; |
163 | } | 164 | } |
164 | 165 | ||
165 | 166 | ||
166 | int Ipkg :: executeIpkgCommand( QString &cmd, const QString option ) | 167 | int Ipkg :: executeIpkgCommand( QString &cmd, const QString option ) |
167 | { | 168 | { |
168 | FILE *fp = NULL; | 169 | FILE *fp = NULL; |
169 | char line[130]; | 170 | char line[130]; |
170 | QString lineStr, lineStrOld; | 171 | QString lineStr, lineStrOld; |
171 | int ret = false; | 172 | int ret = false; |
172 | 173 | ||
173 | fp = popen( (const char *) cmd, "r"); | 174 | fp = popen( (const char *) cmd, "r"); |
174 | if ( fp == NULL ) | 175 | if ( fp == NULL ) |
175 | { | 176 | { |
176 | cout << "Couldn't execute " << cmd << "! err = " << fp << endl; | 177 | cout << "Couldn't execute " << cmd << "! err = " << fp << endl; |
177 | QString text; | 178 | QString text; |
178 | text.sprintf( "Couldn't execute %s! See stdout for error code", (const char *)cmd ); | 179 | text.sprintf( "Couldn't execute %s! See stdout for error code", (const char *)cmd ); |
179 | emit outputText( text ); | 180 | emit outputText( text ); |
180 | } | 181 | } |
181 | else | 182 | else |
182 | { | 183 | { |
183 | while ( fgets( line, sizeof line, fp) != NULL ) | 184 | while ( fgets( line, sizeof line, fp) != NULL ) |
184 | { | 185 | { |
185 | lineStr = line; | 186 | lineStr = line; |
186 | lineStr=lineStr.left( lineStr.length()-1 ); | 187 | lineStr=lineStr.left( lineStr.length()-1 ); |
187 | 188 | ||
188 | if ( lineStr != lineStrOld ) | 189 | if ( lineStr != lineStrOld ) |
189 | { | 190 | { |
190 | //See if we're finished | 191 | //See if we're finished |
191 | if ( option == "install" || option == "reinstall" ) | 192 | if ( option == "install" || option == "reinstall" ) |
192 | { | 193 | { |
193 | // Need to keep track of any dependant packages that get installed | 194 | // Need to keep track of any dependant packages that get installed |
194 | // so that we can create links to them as necessary | 195 | // so that we can create links to them as necessary |
195 | if ( lineStr.startsWith( "Installing " ) ) | 196 | if ( lineStr.startsWith( "Installing " ) ) |
196 | { | 197 | { |
197 | int start = lineStr.find( " " ) + 1; | 198 | int start = lineStr.find( " " ) + 1; |
198 | int end = lineStr.find( " ", start ); | 199 | int end = lineStr.find( " ", start ); |
199 | QString *package = new QString( lineStr.mid( start, end-start ) ); | 200 | QString *package = new QString( lineStr.mid( start, end-start ) ); |
200 | dependantPackages->append( package ); | 201 | dependantPackages->append( package ); |
201 | } | 202 | } |
202 | } | 203 | } |
203 | 204 | ||
204 | if ( option == "update" ) | 205 | if ( option == "update" ) |
205 | { | 206 | { |
206 | if (lineStr.contains("Updated list")) | 207 | if (lineStr.contains("Updated list")) |
207 | ret = true; | 208 | ret = true; |
208 | } | 209 | } |
209 | else if ( option == "download" ) | 210 | else if ( option == "download" ) |
210 | { | 211 | { |
211 | if (lineStr.contains("Downloaded")) | 212 | if (lineStr.contains("Downloaded")) |
212 | ret = true; | 213 | ret = true; |
213 | } | 214 | } |
214 | else | 215 | else |
215 | { | 216 | { |
216 | if (lineStr.contains("Done")) | 217 | if (lineStr.contains("Done")) |
217 | ret = true; | 218 | ret = true; |
218 | } | 219 | } |
219 | 220 | ||
220 | emit outputText( lineStr ); | 221 | emit outputText( lineStr ); |
221 | } | 222 | } |
222 | lineStrOld = lineStr; | 223 | lineStrOld = lineStr; |
223 | qApp->processEvents(); | 224 | qApp->processEvents(); |
224 | } | 225 | } |
225 | pclose(fp); | 226 | pclose(fp); |
226 | } | 227 | } |
227 | 228 | ||
228 | return ret; | 229 | return ret; |
229 | } | 230 | } |
230 | 231 | ||
231 | 232 | ||
232 | void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, const QString &destDir ) | 233 | void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, const QString &destDir ) |
233 | { | 234 | { |
234 | if ( dest == "root" || dest == "/" ) | 235 | if ( dest == "root" || dest == "/" ) |
235 | return; | 236 | return; |
236 | 237 | ||
237 | qApp->processEvents(); | 238 | qApp->processEvents(); |
238 | QStringList *fileList = getList( packFileName, destDir ); | 239 | QStringList *fileList = getList( packFileName, destDir ); |
239 | qApp->processEvents(); | 240 | qApp->processEvents(); |
240 | processFileList( fileList, destDir ); | 241 | processFileList( fileList, destDir ); |
241 | delete fileList; | 242 | delete fileList; |
242 | } | 243 | } |
243 | 244 | ||
244 | QStringList* Ipkg :: getList( const QString &packageFilename, const QString &destDir ) | 245 | QStringList* Ipkg :: getList( const QString &packageFilename, const QString &destDir ) |
245 | { | 246 | { |
246 | QString packageFileDir = destDir+"/usr/lib/ipkg/info/"+packageFilename+".list"; | 247 | QString packageFileDir = destDir+"/usr/lib/ipkg/info/"+packageFilename+".list"; |
247 | QFile f( packageFileDir ); | 248 | QFile f( packageFileDir ); |
248 | 249 | ||
249 | cout << "Try to open " << packageFileDir << endl; | 250 | cout << "Try to open " << packageFileDir << endl; |
250 | if ( !f.open(IO_ReadOnly) ) | 251 | if ( !f.open(IO_ReadOnly) ) |
251 | { | 252 | { |
252 | // Couldn't open from dest, try from / | 253 | // Couldn't open from dest, try from / |
253 | cout << "Could not open:" << packageFileDir << endl; | 254 | cout << "Could not open:" << packageFileDir << endl; |
254 | f.close(); | 255 | f.close(); |
255 | 256 | ||
256 | packageFileDir = "/usr/lib/ipkg/info/"+packageFilename+".list"; | 257 | packageFileDir = "/usr/lib/ipkg/info/"+packageFilename+".list"; |