Ignore:
Timestamp:
04/24/13 13:05:17 (15 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.1-release, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2
Children:
98b904e
Parents:
f01aaaf
Message:

Add all the new pkg conflict logic to libsh

Will detect if something is going to fail during pkg process and
warn the user either graphically or via CLI

In GUI add detection of the GUI hooks from conflict detection

When we find conflicts, remove them for now. (More advanced logic
may be incoming as I play with it)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-pkgmanager/mainWin.cpp

    rf9fc934 r4c06449  
    197197 
    198198     // Flags we can parse out and not show the user 
     199 
     200     // Check if we have crashed into a conflict and ask the user what to do 
     201     if ( line.indexOf("PKGCONFLICTS: ") == 0 ) { 
     202        tmp = line;  
     203        tmp.replace("PKGCONFLICTS: ", ""); 
     204        ConflictList = tmp; 
     205        continue; 
     206     } 
     207     if ( line.indexOf("PKGREPLY: ") == 0 ) { 
     208        QString ans; 
     209        tmp = line;  
     210        tmp.replace("PKGREPLY: ", ""); 
     211        if ( QMessageBox::Yes == QMessageBox::warning(this, tr("Package Conflicts"), 
     212          tr("The following packages are causing conflicts with the selected changes and can be automatically removed. Continue?") + "\n" + ConflictList, 
     213          QMessageBox::Yes|QMessageBox::No, 
     214          QMessageBox::Yes) ) { 
     215 
     216          // We will try to fix conflicts 
     217          ans="yes"; 
     218            
     219        } else { 
     220          // We will fail :( 
     221          QMessageBox::warning(this, tr("Package Conflicts"), 
     222          tr("You may need to manually fix the conflicts before trying again."), 
     223          QMessageBox::Ok, 
     224          QMessageBox::Ok); 
     225          ans="no"; 
     226        } 
     227 
     228        QFile pkgTrig( tmp ); 
     229        if ( pkgTrig.open( QIODevice::WriteOnly ) ) { 
     230           QTextStream streamTrig( &pkgTrig ); 
     231           streamTrig << ans; 
     232           pkgTrig.close(); 
     233        } 
     234     } 
     235 
    199236     if ( line.indexOf("FETCH: ") == 0 ) {  
    200237        progressUpdate->setValue(progressUpdate->value() + 1);  
     
    296333 
    297334  if ( pkgHasFailed ) { 
    298     if ( QMessageBox::Save == QMessageBox::warning(this, tr("Failed pkgng command!"), tr("The package commands failed. Do you wish to save the output to a log file?"), QMessageBox::Save | QMessageBox::Discard, QMessageBox::Save) ) { 
    299        QFile file( "/tmp/pkg-output.log" ); 
    300        if ( file.open( QIODevice::WriteOnly ) ) { 
    301          QTextStream stream( &file ); 
    302          stream << textDisplayOut->toPlainText(); 
    303          file.close(); 
    304        } 
     335    QFile file( "/tmp/pkg-output.log" ); 
     336    if ( file.open( QIODevice::WriteOnly ) ) { 
     337       QTextStream stream( &file ); 
     338       stream << textDisplayOut->toPlainText(); 
     339       file.close(); 
    305340    } 
     341    QMessageBox::warning(this, tr("Failed!"), tr("The package commands failed. A copy of the output was saved to /tmp/pkg-output.log")); 
    306342  } else 
    307343    QMessageBox::warning(this, tr("Finished!"), tr("Package changes complete!" )); 
Note: See TracChangeset for help on using the changeset viewer.