author | tille <tille> | 2002-07-25 12:29:45 (UTC) |
---|---|---|
committer | tille <tille> | 2002-07-25 12:29:45 (UTC) |
commit | 8895e9bd55244f32f12ff619e020a23afac44808 (patch) (unidiff) | |
tree | c2d1be286eeb7146af5a6caf69fec3e4f56b5438 | |
parent | 6773dde79921b0a85040b2f74e89428c5f355fc0 (diff) | |
download | opie-8895e9bd55244f32f12ff619e020a23afac44808.zip opie-8895e9bd55244f32f12ff619e020a23afac44808.tar.gz opie-8895e9bd55244f32f12ff619e020a23afac44808.tar.bz2 |
eliminated output mess
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 7682d49..84de67b 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -199,243 +199,244 @@ void PmIpkg::processLinkDir( QString file, QString dest ) | |||
199 | QFileInfoListIterator it( *list ); | 199 | QFileInfoListIterator it( *list ); |
200 | QFileInfo *fi; | 200 | QFileInfo *fi; |
201 | while ( (fi=it.current()) ) | 201 | while ( (fi=it.current()) ) |
202 | { | 202 | { |
203 | pvDebug(4, "processLinkDir "+fi->absFilePath()); | 203 | pvDebug(4, "processLinkDir "+fi->absFilePath()); |
204 | processLinkDir( fi->absFilePath(), dest ); | 204 | processLinkDir( fi->absFilePath(), dest ); |
205 | ++it; | 205 | ++it; |
206 | } | 206 | } |
207 | } else | 207 | } else |
208 | if ( fileInfo.isFile() ) | 208 | if ( fileInfo.isFile() ) |
209 | { | 209 | { |
210 | const char *instFile = strdup( (file).latin1() ); | 210 | const char *instFile = strdup( (file).latin1() ); |
211 | const char *linkFile = strdup( (destFile).latin1()); | 211 | const char *linkFile = strdup( (destFile).latin1()); |
212 | if( linkOpp==createLink ) | 212 | if( linkOpp==createLink ) |
213 | { | 213 | { |
214 | pvDebug(4, "linking: "+file+" -> "+destFile ); | 214 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
215 | symlink( instFile, linkFile ); | 215 | symlink( instFile, linkFile ); |
216 | } | 216 | } |
217 | } else { | 217 | } else { |
218 | const char *linkFile = strdup( (destFile).latin1()); | 218 | const char *linkFile = strdup( (destFile).latin1()); |
219 | if( linkOpp==removeLink ) | 219 | if( linkOpp==removeLink ) |
220 | { | 220 | { |
221 | QFileInfo toRemoveLink( destFile ); | 221 | QFileInfo toRemoveLink( destFile ); |
222 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | 222 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) |
223 | { | 223 | { |
224 | pvDebug(4,"removing "+destFile+" no "+file); | 224 | pvDebug(4,"removing "+destFile+" no "+file); |
225 | unlink( linkFile ); | 225 | unlink( linkFile ); |
226 | } | 226 | } |
227 | } | 227 | } |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | void PmIpkg::loadList( PackageList *pl ) | 231 | void PmIpkg::loadList( PackageList *pl ) |
232 | { | 232 | { |
233 | for( Package *pack = pl->first();pack ; (pack = pl->next()) ) | 233 | for( Package *pack = pl->first();pack ; (pack = pl->next()) ) |
234 | { | 234 | { |
235 | if ( pack && (pack->name() != "") && pack) | 235 | if ( pack && (pack->name() != "") && pack) |
236 | { | 236 | { |
237 | if ( pack->toInstall() ) | 237 | if ( pack->toInstall() ) |
238 | to_install.append( pack ); | 238 | to_install.append( pack ); |
239 | if ( pack->toRemove() ) | 239 | if ( pack->toRemove() ) |
240 | to_remove.append( pack ); | 240 | to_remove.append( pack ); |
241 | } | 241 | } |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | void PmIpkg::commit() | 245 | void PmIpkg::commit() |
246 | { | 246 | { |
247 | int sizecount = 0; | 247 | int sizecount = 0; |
248 | installDialog = new InstallDialog(settings,0,0,true); | 248 | installDialog = new InstallDialog(settings,0,0,true); |
249 | installDialog->toRemoveItem->setOpen( true ); | 249 | installDialog->toRemoveItem->setOpen( true ); |
250 | installDialog->toInstallItem->setOpen( true ); | 250 | installDialog->toInstallItem->setOpen( true ); |
251 | for (uint i=0; i < to_remove.count(); i++) | 251 | for (uint i=0; i < to_remove.count(); i++) |
252 | { | 252 | { |
253 | sizecount += 1; | 253 | sizecount += 1; |
254 | installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); | 254 | installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); |
255 | } | 255 | } |
256 | for (uint i=0; i < to_install.count(); i++) | 256 | for (uint i=0; i < to_install.count(); i++) |
257 | { | 257 | { |
258 | sizecount += to_install.at(i)->size().toInt(); | 258 | sizecount += to_install.at(i)->size().toInt(); |
259 | installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); | 259 | installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); |
260 | } | 260 | } |
261 | runwindow->progress->setTotalSteps(sizecount); | 261 | runwindow->progress->setTotalSteps(sizecount); |
262 | qDebug("Install size %i",sizecount); | 262 | qDebug("Install size %i",sizecount); |
263 | installDialog->showMaximized(); | 263 | installDialog->showMaximized(); |
264 | installDialog->show(); | 264 | installDialog->show(); |
265 | if ( installDialog->exec() ) | 265 | if ( installDialog->exec() ) |
266 | { | 266 | { |
267 | doIt(); | 267 | doIt(); |
268 | runwindow->showMaximized(); | 268 | runwindow->showMaximized(); |
269 | runwindow->show(); | 269 | runwindow->show(); |
270 | } | 270 | } |
271 | installDialog->close(); | 271 | installDialog->close(); |
272 | delete installDialog; | 272 | delete installDialog; |
273 | installDialog = 0; | 273 | installDialog = 0; |
274 | out(tr("\nAll done.")); | 274 | out(tr("\nAll done.")); |
275 | } | 275 | } |
276 | 276 | ||
277 | void PmIpkg::doIt() | 277 | void PmIpkg::doIt() |
278 | { | 278 | { |
279 | runwindow->progress->setProgress(0); | 279 | runwindow->progress->setProgress(0); |
280 | show(); | 280 | show(); |
281 | remove(); | 281 | remove(); |
282 | install(); | 282 | install(); |
283 | } | 283 | } |
284 | 284 | ||
285 | 285 | ||
286 | void PmIpkg::remove() | 286 | void PmIpkg::remove() |
287 | { | 287 | { |
288 | if ( to_remove.count() == 0 ) return; | 288 | if ( to_remove.count() == 0 ) return; |
289 | 289 | ||
290 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); | 290 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); |
291 | 291 | ||
292 | QStringList *fileList; | 292 | QStringList *fileList; |
293 | for (uint i=0; i < to_remove.count(); i++) | 293 | for (uint i=0; i < to_remove.count(); i++) |
294 | { | 294 | { |
295 | if ( to_remove.at(i)->link() ) fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); | 295 | if ( to_remove.at(i)->link() ) fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); |
296 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) | 296 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) |
297 | { | 297 | { |
298 | runwindow->progress->setProgress( 1 ); | 298 | runwindow->progress->setProgress( 1 ); |
299 | linkOpp = removeLink; | 299 | linkOpp = removeLink; |
300 | to_remove.at(i)->processed(); | 300 | to_remove.at(i)->processed(); |
301 | pvDebug(3,"link "+QString::number(i)); | 301 | pvDebug(3,"link "+QString::number(i)); |
302 | if ( to_remove.at(i)->link() ) | 302 | if ( to_remove.at(i)->link() ) |
303 | processFileList( fileList, to_remove.at(i)->dest() ); | 303 | processFileList( fileList, to_remove.at(i)->dest() ); |
304 | //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); | 304 | //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); |
305 | //if ( to_remove.at(i) ) to_remove.take( i ); | 305 | //if ( to_remove.at(i) ) to_remove.take( i ); |
306 | 306 | ||
307 | out("\n"); | 307 | out("\n"); |
308 | }else{ | 308 | }else{ |
309 | out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); | 309 | out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); |
310 | if ( to_remove.at(i)->link() ) | 310 | if ( to_remove.at(i)->link() ) |
311 | processFileList( fileList, to_remove.at(i)->dest() ); | 311 | processFileList( fileList, to_remove.at(i)->dest() ); |
312 | } | 312 | } |
313 | if ( to_remove.at(i)->link() ) | 313 | if ( to_remove.at(i)->link() ) |
314 | processFileList( fileList, to_remove.at(i)->dest() ); | 314 | processFileList( fileList, to_remove.at(i)->dest() ); |
315 | if ( to_remove.at(i)->link() )delete fileList; | 315 | if ( to_remove.at(i)->link() )delete fileList; |
316 | } | 316 | } |
317 | to_remove.clear(); | 317 | to_remove.clear(); |
318 | out("\n"); | 318 | out("\n"); |
319 | } | 319 | } |
320 | 320 | ||
321 | 321 | ||
322 | void PmIpkg::install() | 322 | void PmIpkg::install() |
323 | { | 323 | { |
324 | if ( to_install.count() == 0 ) return; | 324 | if ( to_install.count() == 0 ) return; |
325 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); | 325 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); |
326 | for (uint i=0; i < to_install.count(); i++) | 326 | for (uint i=0; i < to_install.count(); i++) |
327 | { | 327 | { |
328 | qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug | 328 | qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug |
329 | if (to_install.at(i)->link()) | 329 | if (to_install.at(i)->link()) |
330 | { | 330 | { |
331 | // hack to have package.list | 331 | // hack to have package.list |
332 | // in "dest"/usr/lib/ipkg/info/ | 332 | // in "dest"/usr/lib/ipkg/info/ |
333 | QString rds = settings->getDestinationUrlByName("root"); | 333 | QString rds = settings->getDestinationUrlByName("root"); |
334 | QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest()); | 334 | QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest()); |
335 | QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list"; | 335 | QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list"; |
336 | rds += listFile; | 336 | rds += listFile; |
337 | lds += listFile; | 337 | lds += listFile; |
338 | const char *rd = rds.latin1(); | 338 | const char *rd = rds.latin1(); |
339 | const char *ld = lds.latin1(); | 339 | const char *ld = lds.latin1(); |
340 | pvDebug(4, "linking: "+rds+" -> "+lds ); | 340 | pvDebug(4, "linking: "+rds+" -> "+lds ); |
341 | symlink( rd, ld ); | 341 | symlink( rd, ld ); |
342 | } | 342 | } |
343 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) | 343 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) |
344 | { | 344 | { |
345 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); | 345 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); |
346 | to_install.at(i)->processed(); | 346 | to_install.at(i)->processed(); |
347 | linkOpp = createLink; | 347 | linkOpp = createLink; |
348 | if ( to_install.at(i)->link() ) | 348 | if ( to_install.at(i)->link() ) |
349 | makeLinks( to_install.at(i) ); | 349 | makeLinks( to_install.at(i) ); |
350 | // to_install.take( i ); | 350 | // to_install.take( i ); |
351 | out("\n"); | 351 | out("\n"); |
352 | }else{ | 352 | }else{ |
353 | out(tr("Error while installing")+to_install.at(i)->name()+"\n"); | 353 | out(tr("Error while installing")+to_install.at(i)->name()+"\n"); |
354 | linkOpp = createLink; | 354 | linkOpp = createLink; |
355 | if ( to_install.at(i)->link() ) | 355 | if ( to_install.at(i)->link() ) |
356 | makeLinks( to_install.at(i) ); | 356 | makeLinks( to_install.at(i) ); |
357 | } | 357 | } |
358 | } | 358 | } |
359 | out("\n"); | 359 | out("\n"); |
360 | to_install.clear(); | 360 | to_install.clear(); |
361 | } | 361 | } |
362 | 362 | ||
363 | void PmIpkg::createLinks( const QString &dest ) | 363 | void PmIpkg::createLinks( const QString &dest ) |
364 | { | 364 | { |
365 | pvDebug(2,"PmIpkg::createLinks "+dest); | 365 | pvDebug(2,"PmIpkg::createLinks "+dest); |
366 | linkOpp=createLink; | 366 | linkOpp=createLink; |
367 | QString url = settings->getDestinationUrlByName( dest ); | 367 | QString url = settings->getDestinationUrlByName( dest ); |
368 | url = url==""?dest:url; | 368 | url = url==""?dest:url; |
369 | processLinkDir( "/opt", url ); | 369 | processLinkDir( "/opt", url ); |
370 | processLinkDir( "/usr", url ); | 370 | processLinkDir( "/usr", url ); |
371 | } | 371 | } |
372 | 372 | ||
373 | void PmIpkg::removeLinks( const QString &dest ) | 373 | void PmIpkg::removeLinks( const QString &dest ) |
374 | { | 374 | { |
375 | pvDebug(2,"PmIpkg::removeLinks "+dest); | 375 | pvDebug(2,"PmIpkg::removeLinks "+dest); |
376 | linkOpp=removeLink; | 376 | linkOpp=removeLink; |
377 | QString url = settings->getDestinationUrlByName( dest ); | 377 | QString url = settings->getDestinationUrlByName( dest ); |
378 | url = url==""?dest:url; | 378 | url = url==""?dest:url; |
379 | processLinkDir( "/opt", url ); | 379 | processLinkDir( "/opt", url ); |
380 | processLinkDir( "/usr", url ); | 380 | processLinkDir( "/usr", url ); |
381 | } | 381 | } |
382 | 382 | ||
383 | void PmIpkg::update() | 383 | void PmIpkg::update() |
384 | { | 384 | { |
385 | show(); | 385 | show(); |
386 | runIpkg( "update" ); | 386 | runIpkg( "update" ); |
387 | } | 387 | } |
388 | 388 | ||
389 | void PmIpkg::out( QString o ) | 389 | void PmIpkg::out( QString o ) |
390 | { | 390 | { |
391 | runwindow->outPut->append(o); | 391 | //runwindow->outPut->append(o); |
392 | runwindow->outPut->setText(runwindow->outPut->text()+o); | ||
392 | runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); | 393 | runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); |
393 | } | 394 | } |
394 | 395 | ||
395 | 396 | ||
396 | 397 | ||
397 | 398 | ||
398 | void PmIpkg::show() | 399 | void PmIpkg::show() |
399 | { | 400 | { |
400 | if (!runwindow->isVisible()) | 401 | if (!runwindow->isVisible()) |
401 | { | 402 | { |
402 | runwindow->showMaximized(); | 403 | runwindow->showMaximized(); |
403 | runwindow->show(); | 404 | runwindow->show(); |
404 | } | 405 | } |
405 | runwindow->outPut->setText(""); | 406 | runwindow->outPut->setText(""); |
406 | } | 407 | } |
407 | 408 | ||
408 | void PmIpkg::installFile(const QString &fileName, const QString &dest) | 409 | void PmIpkg::installFile(const QString &fileName, const QString &dest) |
409 | { | 410 | { |
410 | 411 | ||
411 | to_install.clear(); | 412 | to_install.clear(); |
412 | to_remove.clear(); | 413 | to_remove.clear(); |
413 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | 414 | pvDebug( 2,"PmIpkg::installFile "+ fileName); |
414 | Package *p = new Package(fileName,settings); | 415 | Package *p = new Package(fileName,settings); |
415 | if ( dest!="") p->setDest( dest ); | 416 | if ( dest!="") p->setDest( dest ); |
416 | to_install.append( p ); | 417 | to_install.append( p ); |
417 | commit(); | 418 | commit(); |
418 | delete p; | 419 | delete p; |
419 | } | 420 | } |
420 | 421 | ||
421 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) | 422 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) |
422 | { | 423 | { |
423 | 424 | ||
424 | to_install.clear(); | 425 | to_install.clear(); |
425 | to_remove.clear(); | 426 | to_remove.clear(); |
426 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); | 427 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); |
427 | Package *p = new Package(fileName,settings); | 428 | Package *p = new Package(fileName,settings); |
428 | if ( dest!="") p->setDest( dest ); | 429 | if ( dest!="") p->setDest( dest ); |
429 | to_remove.append( p ); | 430 | to_remove.append( p ); |
430 | commit(); | 431 | commit(); |
431 | delete p; | 432 | delete p; |
432 | } | 433 | } |
433 | 434 | ||
434 | 435 | ||
435 | void PmIpkg::clearLists() | 436 | void PmIpkg::clearLists() |
436 | { | 437 | { |
437 | to_remove.clear(); | 438 | to_remove.clear(); |
438 | to_install.clear(); | 439 | to_install.clear(); |
439 | } | 440 | } |
440 | 441 | ||
441 | 442 | ||