Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 2ed313c..cfaadbf 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -93,49 +93,49 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
93 | cmd +=" 2>&1"; | 93 | cmd +=" 2>&1"; |
94 | fp = popen( (const char *) cmd, "r"); | 94 | fp = popen( (const char *) cmd, "r"); |
95 | if ( fp == NULL ) { | 95 | if ( fp == NULL ) { |
96 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); | 96 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); |
97 | out("\nError while executing "+ cmd+"\n\n"); | 97 | out("\nError while executing "+ cmd+"\n\n"); |
98 | ret = false; | 98 | ret = false; |
99 | } else { | 99 | } else { |
100 | while ( fgets( line, sizeof line, fp) != NULL) | 100 | while ( fgets( line, sizeof line, fp) != NULL) |
101 | { | 101 | { |
102 | lineStr = line; | 102 | lineStr = line; |
103 | lineStr=lineStr.left(lineStr.length()-1); | 103 | lineStr=lineStr.left(lineStr.length()-1); |
104 | //Configuring opie-oipkg...Done | 104 | //Configuring opie-oipkg...Done |
105 | if (lineStr.contains("Done")) ret = true; | 105 | if (lineStr.contains("Done")) ret = true; |
106 | if (lineStr!=lineStrOld) | 106 | if (lineStr!=lineStrOld) |
107 | out(lineStr); | 107 | out(lineStr); |
108 | lineStrOld = lineStr; | 108 | lineStrOld = lineStr; |
109 | qApp->processEvents(); | 109 | qApp->processEvents(); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | pclose(fp); | 112 | pclose(fp); |
113 | pvDebug(2,QString(ret?"success\n":"failure\n")); | 113 | pvDebug(2,QString(ret?"success\n":"failure\n")); |
114 | return ret; | 114 | return ret; |
115 | } | 115 | } |
116 | 116 | ||
117 | void PmIpkg::makeLinks(Package *pack) | 117 | void PmIpkg::makeLinks(OipkgPackage *pack) |
118 | { | 118 | { |
119 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 119 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
120 | QString pn = pack->name(); | 120 | QString pn = pack->name(); |
121 | linkPackage( pack->packageName(), pack->dest() ); | 121 | linkPackage( pack->packageName(), pack->dest() ); |
122 | } | 122 | } |
123 | 123 | ||
124 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | 124 | QStringList* PmIpkg::getList( QString packFileName, QString d ) |
125 | { | 125 | { |
126 | QString dest = settings->getDestinationUrlByName( d ); | 126 | QString dest = settings->getDestinationUrlByName( d ); |
127 | dest = dest==""?d:dest; | 127 | dest = dest==""?d:dest; |
128 | // if (dest == "/" ) return 0; | 128 | // if (dest == "/" ) return 0; |
129 | { | 129 | { |
130 | Config cfg( "oipkg", Config::User ); | 130 | Config cfg( "oipkg", Config::User ); |
131 | cfg.setGroup( "Common" ); | 131 | cfg.setGroup( "Common" ); |
132 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 132 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
133 | } | 133 | } |
134 | QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list"; | 134 | QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
135 | QFile f( packFileDir ); | 135 | QFile f( packFileDir ); |
136 | qDebug("Try to open %s", packFileDir.latin1()); | 136 | qDebug("Try to open %s", packFileDir.latin1()); |
137 | if ( ! f.open(IO_ReadOnly) ) | 137 | if ( ! f.open(IO_ReadOnly) ) |
138 | { | 138 | { |
139 | out( "Could not open:\n"+packFileDir ); | 139 | out( "Could not open:\n"+packFileDir ); |
140 | f.close(); | 140 | f.close(); |
141 | packFileDir = "/"+statusDir+"/info/"+packFileName+".list"; | 141 | packFileDir = "/"+statusDir+"/info/"+packFileName+".list"; |
@@ -211,49 +211,49 @@ void PmIpkg::processLinkDir( QString file, QString dest ) | |||
211 | { | 211 | { |
212 | const char *instFile = strdup( (file).latin1() ); | 212 | const char *instFile = strdup( (file).latin1() ); |
213 | const char *linkFile = strdup( (destFile).latin1()); | 213 | const char *linkFile = strdup( (destFile).latin1()); |
214 | if( linkOpp==createLink ) | 214 | if( linkOpp==createLink ) |
215 | { | 215 | { |
216 | pvDebug(4, "linking: "+file+" -> "+destFile ); | 216 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
217 | symlink( instFile, linkFile ); | 217 | symlink( instFile, linkFile ); |
218 | } | 218 | } |
219 | } else { | 219 | } else { |
220 | const char *linkFile = strdup( (destFile).latin1()); | 220 | const char *linkFile = strdup( (destFile).latin1()); |
221 | if( linkOpp==removeLink ) | 221 | if( linkOpp==removeLink ) |
222 | { | 222 | { |
223 | QFileInfo toRemoveLink( destFile ); | 223 | QFileInfo toRemoveLink( destFile ); |
224 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | 224 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) |
225 | { | 225 | { |
226 | pvDebug(4,"removing "+destFile+" no "+file); | 226 | pvDebug(4,"removing "+destFile+" no "+file); |
227 | unlink( linkFile ); | 227 | unlink( linkFile ); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | } | 230 | } |
231 | } | 231 | } |
232 | 232 | ||
233 | void PmIpkg::loadList( PackageList *pl ) | 233 | void PmIpkg::loadList( PackageList *pl ) |
234 | { | 234 | { |
235 | for( Package *pack = pl->first();pack ; (pack = pl->next()) ) | 235 | for( OipkgPackage *pack = pl->first();pack ; (pack = pl->next()) ) |
236 | { | 236 | { |
237 | if ( pack && (pack->name() != "") && pack) | 237 | if ( pack && (pack->name() != "") && pack) |
238 | { | 238 | { |
239 | if ( pack->toInstall() ) | 239 | if ( pack->toInstall() ) |
240 | to_install.append( pack ); | 240 | to_install.append( pack ); |
241 | if ( pack->toRemove() ) | 241 | if ( pack->toRemove() ) |
242 | to_remove.append( pack ); | 242 | to_remove.append( pack ); |
243 | } | 243 | } |
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | void PmIpkg::commit() | 247 | void PmIpkg::commit() |
248 | { | 248 | { |
249 | int sizecount = 0; | 249 | int sizecount = 0; |
250 | installDialog = new InstallDialog(settings,0,0,true); | 250 | installDialog = new InstallDialog(settings,0,0,true); |
251 | installDialog->toRemoveItem->setOpen( true ); | 251 | installDialog->toRemoveItem->setOpen( true ); |
252 | installDialog->toInstallItem->setOpen( true ); | 252 | installDialog->toInstallItem->setOpen( true ); |
253 | for (uint i=0; i < to_remove.count(); i++) | 253 | for (uint i=0; i < to_remove.count(); i++) |
254 | { | 254 | { |
255 | sizecount += 1; | 255 | sizecount += 1; |
256 | installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); | 256 | installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); |
257 | } | 257 | } |
258 | for (uint i=0; i < to_install.count(); i++) | 258 | for (uint i=0; i < to_install.count(); i++) |
259 | { | 259 | { |
@@ -270,49 +270,49 @@ void PmIpkg::commit() | |||
270 | runwindow->showMaximized(); | 270 | runwindow->showMaximized(); |
271 | runwindow->show(); | 271 | runwindow->show(); |
272 | } | 272 | } |
273 | installDialog->close(); | 273 | installDialog->close(); |
274 | delete installDialog; | 274 | delete installDialog; |
275 | installDialog = 0; | 275 | installDialog = 0; |
276 | out(tr("\nAll done.")); | 276 | out(tr("\nAll done.")); |
277 | } | 277 | } |
278 | 278 | ||
279 | void PmIpkg::doIt() | 279 | void PmIpkg::doIt() |
280 | { | 280 | { |
281 | runwindow->progress->setProgress(0); | 281 | runwindow->progress->setProgress(0); |
282 | show(); | 282 | show(); |
283 | remove(); | 283 | remove(); |
284 | install(); | 284 | install(); |
285 | } | 285 | } |
286 | 286 | ||
287 | 287 | ||
288 | void PmIpkg::remove() | 288 | void PmIpkg::remove() |
289 | { | 289 | { |
290 | if ( to_remove.count() == 0 ) return; | 290 | if ( to_remove.count() == 0 ) return; |
291 | 291 | ||
292 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); | 292 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); |
293 | 293 | ||
294 | QStringList *fileList; | 294 | QStringList *fileList = new QStringList; |
295 | for (uint i=0; i < to_remove.count(); i++) | 295 | for (uint i=0; i < to_remove.count(); i++) |
296 | { | 296 | { |
297 | if ( to_remove.at(i)->link() ) fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); | 297 | if ( to_remove.at(i)->link() ) fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); |
298 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) | 298 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) |
299 | { | 299 | { |
300 | runwindow->progress->setProgress( 1 ); | 300 | runwindow->progress->setProgress( 1 ); |
301 | linkOpp = removeLink; | 301 | linkOpp = removeLink; |
302 | to_remove.at(i)->processed(); | 302 | to_remove.at(i)->processed(); |
303 | pvDebug(3,"link "+QString::number(i)); | 303 | pvDebug(3,"link "+QString::number(i)); |
304 | if ( to_remove.at(i)->link() ) | 304 | if ( to_remove.at(i)->link() ) |
305 | processFileList( fileList, to_remove.at(i)->dest() ); | 305 | processFileList( fileList, to_remove.at(i)->dest() ); |
306 | //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); | 306 | //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); |
307 | //if ( to_remove.at(i) ) to_remove.take( i ); | 307 | //if ( to_remove.at(i) ) to_remove.take( i ); |
308 | 308 | ||
309 | out("\n"); | 309 | out("\n"); |
310 | }else{ | 310 | }else{ |
311 | out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); | 311 | out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); |
312 | if ( to_remove.at(i)->link() ) | 312 | if ( to_remove.at(i)->link() ) |
313 | processFileList( fileList, to_remove.at(i)->dest() ); | 313 | processFileList( fileList, to_remove.at(i)->dest() ); |
314 | } | 314 | } |
315 | if ( to_remove.at(i)->link() ) | 315 | if ( to_remove.at(i)->link() ) |
316 | processFileList( fileList, to_remove.at(i)->dest() ); | 316 | processFileList( fileList, to_remove.at(i)->dest() ); |
317 | if ( to_remove.at(i)->link() )delete fileList; | 317 | if ( to_remove.at(i)->link() )delete fileList; |
318 | } | 318 | } |
@@ -393,52 +393,52 @@ void PmIpkg::out( QString o ) | |||
393 | //runwindow->outPut->append(o); | 393 | //runwindow->outPut->append(o); |
394 | runwindow->outPut->setText(runwindow->outPut->text()+o); | 394 | runwindow->outPut->setText(runwindow->outPut->text()+o); |
395 | runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); | 395 | runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); |
396 | } | 396 | } |
397 | 397 | ||
398 | 398 | ||
399 | 399 | ||
400 | 400 | ||
401 | void PmIpkg::show() | 401 | void PmIpkg::show() |
402 | { | 402 | { |
403 | if (!runwindow->isVisible()) | 403 | if (!runwindow->isVisible()) |
404 | { | 404 | { |
405 | runwindow->showMaximized(); | 405 | runwindow->showMaximized(); |
406 | runwindow->show(); | 406 | runwindow->show(); |
407 | } | 407 | } |
408 | runwindow->outPut->setText(""); | 408 | runwindow->outPut->setText(""); |
409 | } | 409 | } |
410 | 410 | ||
411 | void PmIpkg::installFile(const QString &fileName, const QString &dest) | 411 | void PmIpkg::installFile(const QString &fileName, const QString &dest) |
412 | { | 412 | { |
413 | 413 | ||
414 | to_install.clear(); | 414 | to_install.clear(); |
415 | to_remove.clear(); | 415 | to_remove.clear(); |
416 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | 416 | pvDebug( 2,"PmIpkg::installFile "+ fileName); |
417 | Package *p = new Package(fileName,settings); | 417 | OipkgPackage *p = new OipkgPackage(fileName,settings); |
418 | if ( dest!="") p->setDest( dest ); | 418 | if ( dest!="") p->setDest( dest ); |
419 | to_install.append( p ); | 419 | to_install.append( p ); |
420 | commit(); | 420 | commit(); |
421 | delete p; | 421 | delete p; |
422 | } | 422 | } |
423 | 423 | ||
424 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) | 424 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) |
425 | { | 425 | { |
426 | 426 | ||
427 | to_install.clear(); | 427 | to_install.clear(); |
428 | to_remove.clear(); | 428 | to_remove.clear(); |
429 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); | 429 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); |
430 | Package *p = new Package(fileName,settings); | 430 | OipkgPackage *p = new OipkgPackage(fileName,settings); |
431 | if ( dest!="") p->setDest( dest ); | 431 | if ( dest!="") p->setDest( dest ); |
432 | to_remove.append( p ); | 432 | to_remove.append( p ); |
433 | commit(); | 433 | commit(); |
434 | delete p; | 434 | delete p; |
435 | } | 435 | } |
436 | 436 | ||
437 | 437 | ||
438 | void PmIpkg::clearLists() | 438 | void PmIpkg::clearLists() |
439 | { | 439 | { |
440 | to_remove.clear(); | 440 | to_remove.clear(); |
441 | to_install.clear(); | 441 | to_install.clear(); |
442 | } | 442 | } |
443 | 443 | ||
444 | 444 | ||