Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index f2852c3..6ef6d19 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -42,25 +42,25 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
42 | { | 42 | { |
43 | bool ret=false; | 43 | bool ret=false; |
44 | QDir::setCurrent("/tmp"); | 44 | QDir::setCurrent("/tmp"); |
45 | QString cmd = "/usr/bin/ipkg "; | 45 | QString cmd = "/usr/bin/ipkg "; |
46 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 46 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
47 | if ( dest == "" ) | 47 | if ( dest == "" ) |
48 | cmd += " -dest "+settings->getDestinationName(); | 48 | cmd += " -dest "+settings->getDestinationName(); |
49 | else | 49 | else |
50 | cmd += " -dest "+ dest; | 50 | cmd += " -dest "+ dest; |
51 | 51 | ||
52 | cmd += " -force-defaults "; | 52 | cmd += " -force-defaults "; |
53 | 53 | ||
54 | if (installDialog->_force_depends) | 54 | if (installDialog && installDialog->_force_depends) |
55 | { | 55 | { |
56 | if (installDialog->_force_depends->isChecked()) | 56 | if (installDialog->_force_depends->isChecked()) |
57 | cmd += " -force-depends "; | 57 | cmd += " -force-depends "; |
58 | if (installDialog->_force_reinstall->isChecked()) | 58 | if (installDialog->_force_reinstall->isChecked()) |
59 | cmd += " -force-reinstall "; | 59 | cmd += " -force-reinstall "; |
60 | if (installDialog->_force_remove->isChecked()) | 60 | if (installDialog->_force_remove->isChecked()) |
61 | cmd += " -force-removal-of-essential-packages "; | 61 | cmd += " -force-removal-of-essential-packages "; |
62 | } | 62 | } |
63 | 63 | ||
64 | out( "Starting to "+ args+"\n"); | 64 | out( "Starting to "+ args+"\n"); |
65 | cmd += args; | 65 | cmd += args; |
66 | out( "running:\n"+cmd+"\n" ); | 66 | out( "running:\n"+cmd+"\n" ); |
@@ -78,24 +78,25 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
78 | out("\nError while executing "+ cmd+"\n\n"); | 78 | out("\nError while executing "+ cmd+"\n\n"); |
79 | return false; | 79 | return false; |
80 | } else { | 80 | } else { |
81 | while ( fgets( line, sizeof line, fp)) { | 81 | while ( fgets( line, sizeof line, fp)) { |
82 | lineStr = line; | 82 | lineStr = line; |
83 | lineStr=lineStr.left(lineStr.length()-1); | 83 | lineStr=lineStr.left(lineStr.length()-1); |
84 | //Configuring opie-oipkg...Done | 84 | //Configuring opie-oipkg...Done |
85 | if (lineStr.contains("Done")) | 85 | if (lineStr.contains("Done")) |
86 | ret = true; | 86 | ret = true; |
87 | if (lineStr!=lineStrOld) | 87 | if (lineStr!=lineStrOld) |
88 | out(lineStr); | 88 | out(lineStr); |
89 | lineStrOld = lineStr; | 89 | lineStrOld = lineStr; |
90 | qApp->processEvents(); | ||
90 | } | 91 | } |
91 | pclose(fp); | 92 | pclose(fp); |
92 | } | 93 | } |
93 | //out( "Finished!"); | 94 | //out( "Finished!"); |
94 | pvDebug(2,QString(ret?"success\n":"failure\n")); | 95 | pvDebug(2,QString(ret?"success\n":"failure\n")); |
95 | return ret; | 96 | return ret; |
96 | } | 97 | } |
97 | 98 | ||
98 | void PmIpkg::makeLinks(Package *pack) | 99 | void PmIpkg::makeLinks(Package *pack) |
99 | { | 100 | { |
100 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 101 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
101 | linkPackage( pack->name(), pack->dest() ); | 102 | linkPackage( pack->name(), pack->dest() ); |
@@ -147,24 +148,26 @@ void PmIpkg::processFileList( QStringList *fileList, QString d ) | |||
147 | } | 148 | } |
148 | 149 | ||
149 | 150 | ||
150 | void PmIpkg::processLinkDir( QString file, QString dest ) | 151 | void PmIpkg::processLinkDir( QString file, QString dest ) |
151 | { | 152 | { |
152 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); | 153 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); |
153 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); | 154 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); |
154 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); | 155 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); |
155 | if ( dest == "???" || dest == "" ) return; | 156 | if ( dest == "???" || dest == "" ) return; |
156 | QString destFile = file; | 157 | QString destFile = file; |
157 | file = dest+"/"+file; | 158 | file = dest+"/"+file; |
158 | if (file == dest) return; | 159 | if (file == dest) return; |
160 | // if (linkOpp==createLink) out( "\ncreating links\n" ); | ||
161 | // if (linkOpp==removeLink) out( "\nremoving links\n" ); | ||
159 | QFileInfo fileInfo( file ); | 162 | QFileInfo fileInfo( file ); |
160 | if ( fileInfo.isDir() ) | 163 | if ( fileInfo.isDir() ) |
161 | { | 164 | { |
162 | pvDebug(4, "process dir "+file); | 165 | pvDebug(4, "process dir "+file); |
163 | QDir destDir( destFile ); | 166 | QDir destDir( destFile ); |
164 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); | 167 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); |
165 | QDir d( file ); | 168 | QDir d( file ); |
166 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 169 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
167 | const QFileInfoList *list = d.entryInfoList(); | 170 | const QFileInfoList *list = d.entryInfoList(); |
168 | QFileInfoListIterator it( *list ); | 171 | QFileInfoListIterator it( *list ); |
169 | QFileInfo *fi; | 172 | QFileInfo *fi; |
170 | while ( (fi=it.current()) ) | 173 | while ( (fi=it.current()) ) |
@@ -256,64 +259,64 @@ void PmIpkg::remove() | |||
256 | 259 | ||
257 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); | 260 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); |
258 | 261 | ||
259 | QStringList *fileList; | 262 | QStringList *fileList; |
260 | for (uint i=0; i < to_remove.count(); i++) | 263 | for (uint i=0; i < to_remove.count(); i++) |
261 | { | 264 | { |
262 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); | 265 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); |
263 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) | 266 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) |
264 | { | 267 | { |
265 | runwindow->progress->setProgress( 1 ); | 268 | runwindow->progress->setProgress( 1 ); |
266 | linkOpp = removeLink; | 269 | linkOpp = removeLink; |
267 | to_remove.at(i)->processed(); | 270 | to_remove.at(i)->processed(); |
271 | if ( to_remove.at(i)->link() ) | ||
272 | processFileList( fileList, to_remove.at(i)->dest() ); | ||
268 | to_remove.take( i ); | 273 | to_remove.take( i ); |
269 | 274 | ||
270 | out("\n\n"); | 275 | out("\n"); |
271 | }else{ | 276 | }else{ |
272 | out(tr("Error while removing")+to_remove.at(i)->name()+"\n"); | 277 | out(tr("Error while removing")+to_remove.at(i)->name()+"\n"); |
278 | if ( to_remove.at(i)->link() ) | ||
279 | processFileList( fileList, to_remove.at(i)->dest() ); | ||
273 | } | 280 | } |
274 | if ( to_remove.at(i)->link() ) | 281 | if ( to_remove.at(i)->link() ) |
275 | { | ||
276 | out( "\nremoving links\n" ); | ||
277 | out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"\n" ); | ||
278 | processFileList( fileList, to_remove.at(i)->dest() ); | 282 | processFileList( fileList, to_remove.at(i)->dest() ); |
279 | } | ||
280 | if ( to_remove.at(i)->link() )delete fileList; | 283 | if ( to_remove.at(i)->link() )delete fileList; |
281 | } | 284 | } |
282 | to_remove.clear(); | 285 | to_remove.clear(); |
283 | out("\n"); | 286 | out("\n"); |
284 | } | 287 | } |
285 | 288 | ||
286 | 289 | ||
287 | void PmIpkg::install() | 290 | void PmIpkg::install() |
288 | { | 291 | { |
289 | if ( to_install.count() == 0 ) return; | 292 | if ( to_install.count() == 0 ) return; |
290 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); | 293 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); |
291 | for (uint i=0; i < to_install.count(); i++) | 294 | for (uint i=0; i < to_install.count(); i++) |
292 | { | 295 | { |
296 | qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug | ||
293 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) | 297 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) |
294 | { | 298 | { |
295 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); | 299 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); |
296 | to_install.at(i)->processed(); | 300 | to_install.at(i)->processed(); |
301 | linkOpp = createLink; | ||
302 | if ( to_install.at(i)->link() ) | ||
303 | makeLinks( to_install.at(i) ); | ||
297 | to_install.take( i ); | 304 | to_install.take( i ); |
298 | out("\n\n"); | 305 | out("\n"); |
299 | }else{ | 306 | }else{ |
300 | out(tr("Error while installing")+to_install.at(i)->name()+"\n"); | 307 | out(tr("Error while installing")+to_install.at(i)->name()+"\n"); |
301 | } | 308 | linkOpp = createLink; |
302 | linkOpp = createLink; | 309 | if ( to_install.at(i)->link() ) |
303 | if ( to_install.at(i)->link() ) | 310 | makeLinks( to_install.at(i) ); |
304 | { | ||
305 | out( "\ncreating links\n" ); | ||
306 | out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"\n" ); | ||
307 | makeLinks( to_install.at(i) ); | ||
308 | } | 311 | } |
309 | } | 312 | } |
310 | out("\n"); | 313 | out("\n"); |
311 | to_install.clear(); | 314 | to_install.clear(); |
312 | } | 315 | } |
313 | 316 | ||
314 | void PmIpkg::createLinks( const QString &dest ) | 317 | void PmIpkg::createLinks( const QString &dest ) |
315 | { | 318 | { |
316 | pvDebug(2,"PmIpkg::createLinks "+dest); | 319 | pvDebug(2,"PmIpkg::createLinks "+dest); |
317 | linkOpp=createLink; | 320 | linkOpp=createLink; |
318 | QString url = settings->getDestinationUrlByName( dest ); | 321 | QString url = settings->getDestinationUrlByName( dest ); |
319 | url = url==""?dest:url; | 322 | url = url==""?dest:url; |