author | andyq <andyq> | 2002-10-25 14:37:28 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-10-25 14:37:28 (UTC) |
commit | f4007b261a7a4dc9672a1806be50ea16ccfc84f1 (patch) (side-by-side diff) | |
tree | 5a2469d149be879bd221a1d1f07d9cab7cab5a49 | |
parent | 3421736c248c6ca7171bafdf3af9e2edf94eb593 (diff) | |
download | opie-f4007b261a7a4dc9672a1806be50ea16ccfc84f1.zip opie-f4007b261a7a4dc9672a1806be50ea16ccfc84f1.tar.gz opie-f4007b261a7a4dc9672a1806be50ea16ccfc84f1.tar.bz2 |
Hopefully handles upgrading to newer packages correctly
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 7 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.h | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/ipkg.cpp | 8 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 4 |
4 files changed, 13 insertions, 8 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index f5aef94..83f983a 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp @@ -77,33 +77,33 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d QString remove = "Remove\n"; QString install = "\nInstall\n"; QString upgrade = "\nUpgrade\n"; for ( it = packageList.begin() ; it != packageList.end() ; ++it ) { InstallData item = *it; if ( item.option == "I" ) { installList.push_back( item ); install += " " + item.packageName + "\n"; } else if ( item.option == "D" ) { removeList.push_back( item ); remove += " " + item.packageName + "\n"; } - else if ( item.option == "U" ) + else if ( item.option == "U" || item.option == "R" ) { updateList.push_back( item ); upgrade += " " + item.packageName + "\n"; } } output->setText( remove + install + upgrade ); } InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) : InstallDlg( parent, name, modal, fl ) { pIpkg = ipkg; output->setText( initialText ); } @@ -195,35 +195,38 @@ void InstallDlgImpl :: installSelected() pIpkg->setFlags( tmpFlags ); pIpkg->runIpkg(); } pIpkg->setOption( "install" ); pIpkg->setDestination( dest ); pIpkg->setDestinationDir( destDir ); pIpkg->setFlags( instFlags ); for ( it = installList.begin() ; it != installList.end() ; ++it ) { pIpkg->setPackage( it->packageName ); pIpkg->runIpkg(); } flags |= FORCE_REINSTALL; - pIpkg->setOption( "reinstall" ); for ( it = updateList.begin() ; it != updateList.end() ; ++it ) { + if ( it->option == "R" ) + pIpkg->setOption( "reinstall" ); + else + pIpkg->setOption( "upgrade" ); pIpkg->setDestination( it->destination->getDestinationName() ); pIpkg->setDestinationDir( it->destination->getDestinationPath() ); pIpkg->setPackage( it->packageName ); int tmpFlags = flags; if ( it->destination->linkToRoot() && it->recreateLinks ) tmpFlags |= MAKE_LINKS; pIpkg->setFlags( tmpFlags ); pIpkg->runIpkg(); } delete pIpkg; } btnInstall->setEnabled( true ); btnInstall->setText( tr( "Close" ) ); diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h index 6716ced..9819b2e 100644 --- a/noncore/settings/aqpkg/installdlgimpl.h +++ b/noncore/settings/aqpkg/installdlgimpl.h @@ -15,33 +15,33 @@ * * ***************************************************************************/ #ifndef INSTALLDLGIMPL_H #define INSTALLDLGIMPL_H #include <vector> using namespace std; #include <qstring.h> #include "ipkg.h" #include "install.h" class InstallData { public: - QString option; // I - install, D - delete, U - upgrade + QString option; // I - install, D - delete, R- reinstall U - upgrade QString packageName; Destination *destination; bool recreateLinks; }; class InstallDlgImpl : public InstallDlg { public: InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); ~InstallDlgImpl(); bool showDlg(); bool upgradeServer( QString &server ); protected: diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp index 368548b..731a336 100644 --- a/noncore/settings/aqpkg/ipkg.cpp +++ b/noncore/settings/aqpkg/ipkg.cpp @@ -50,71 +50,69 @@ Ipkg :: ~Ipkg() // destDir is the dir that the destination alias points to (used to link to root) // flags is the ipkg options flags // dir is the directory to run ipkg in (defaults to "") bool Ipkg :: runIpkg( ) { bool ret = false; QDir::setCurrent( "/tmp" ); QString cmd = ""; if ( runtimeDir != "" ) { cmd += "cd "; cmd += runtimeDir; cmd += " ; "; } - cmd += "ipkg"; - - if ( option != "update" && option != "download" && option != "upgrade" ) + cmd += "ipkg -force-defaults"; + if ( option != "update" && option != "download" ) { cmd += " -dest "+ destination; - cmd += " -force-defaults"; if ( flags & FORCE_DEPENDS ) cmd += " -force-depends"; if ( flags & FORCE_REINSTALL ) cmd += " -force-reinstall"; if ( flags & FORCE_REMOVE ) cmd += " -force-removal-of-essential-packages"; if ( flags & FORCE_OVERWRITE ) cmd += " -force-overwrite"; // Handle make links // Rules - If make links is switched on, create links to root // if destDir is NOT / if ( flags & MAKE_LINKS ) { // If destDir == / turn off make links as package is being insalled // to root already. if ( destDir == "/" ) flags ^= MAKE_LINKS; } } #ifdef X86 cmd += " -f "; cmd += IPKG_CONF; #endif if ( option == "reinstall" ) cmd += " install"; else cmd += " " + option; - if ( option != "upgrade" ) + if ( package != "" ) cmd += " " + package; cmd += " 2>&1"; if ( package != "" ) emit outputText( QString( "Dealing with package " ) + package ); qApp->processEvents(); // If we are removing packages and make links option is selected // create the links if ( option == "remove" || option == "reinstall" ) { createLinks = false; if ( flags & MAKE_LINKS ) { diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index a374266..3971aea 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp @@ -546,33 +546,37 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) item.option = "D"; break; case 1: // Quit or Escape item.option = "U"; break; } } else { // item.option = stickyOption; } // Check if we are reinstalling the same version if ( p->getVersion() != p->getInstalledVersion() ) item.recreateLinks = true; else + { + if ( item.option == "U" ) + item.option = "R"; item.recreateLinks = false; + } // User hit cancel (on dlg - assume remove) return item; } } void NetworkPackageManager :: displayText( const QString &t ) { cout << t << endl; } void NetworkPackageManager :: letterPushed( QString t ) { QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |