summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp67
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.h17
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp23
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp88
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h4
5 files changed, 136 insertions, 63 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index b92a245..bbb0be75 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -32,7 +32,7 @@
#include "installdlgimpl.h"
#include "global.h"
-InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
+InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
: InstallDlg( parent, name, modal, fl )
{
upgradePackages = false;
@@ -46,7 +46,8 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM
defaultDest = cfg.readEntry( "dest", "root" );
// Grab flags - Turn MAKE_LINKS on by default (if no flags found)
- flags = cfg.readNumEntry( "installFlags", MAKE_LINKS );
+// flags = cfg.readNumEntry( "installFlags", MAKE_LINKS );
+ flags = 0;
#else
flags = 0;
#endif
@@ -70,28 +71,28 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM
destination->setCurrentItem( defIndex );
- vector<QString>::iterator it;
+ vector<InstallData>::iterator it;
// setup package data
QString remove = "Remove\n";
QString install = "\nInstall\n";
QString upgrade = "\nUpgrade\n";
for ( it = packageList.begin() ; it != packageList.end() ; ++it )
{
- QString name = *it;
- if ( name.startsWith( "I" ) )
+ InstallData item = *it;
+ if ( item.option == "I" )
{
- installList.push_back( name.mid(1) );
- install += " " + name.mid(1) + "\n";
+ installList.push_back( item );
+ install += " " + item.packageName + "\n";
}
- else if ( name.startsWith( "D" ) )
+ else if ( item.option == "D" )
{
- removeList.push_back( name.mid(1) );
- remove += " " + name.mid(1) + "\n";
+ removeList.push_back( item );
+ remove += " " + item.packageName + "\n";
}
- else if ( name.startsWith( "U" ) )
+ else if ( item.option == "U" )
{
- updateList.push_back( name.mid(1) );
- upgrade += " " + name.mid(1) + "\n";
+ updateList.push_back( item );
+ upgrade += " " + item.packageName + "\n";
}
}
@@ -136,8 +137,6 @@ void InstallDlgImpl :: optionsSelected()
flags |= FORCE_REMOVE;
if ( opt.forceOverwrite->isChecked() )
flags |= FORCE_OVERWRITE;
- if ( opt.makeLinks->isChecked() )
- flags |= MAKE_LINKS;
#ifdef QWS
Config cfg( "aqpkg" );
@@ -171,6 +170,9 @@ void InstallDlgImpl :: installSelected()
Destination *d = dataMgr->getDestination( destination->currentText() );
QString dest = d->getDestinationName();
QString destDir = d->getDestinationPath();
+ int instFlags = 0;
+ if ( d->linkToRoot() )
+ instFlags = MAKE_LINKS;
#ifdef QWS
// Save settings
@@ -180,29 +182,48 @@ void InstallDlgImpl :: installSelected()
#endif
// First run through the remove list, then the install list then the upgrade list
- vector<QString>::iterator it;
+ vector<InstallData>::iterator it;
ipkg.setOption( "remove" );
- ipkg.setDestination( dest );
- ipkg.setDestinationDir( destDir );
- ipkg.setFlags( flags );
for ( it = removeList.begin() ; it != removeList.end() ; ++it )
{
- ipkg.setPackage( *it );
+ ipkg.setDestination( it->destination->getDestinationName() );
+ ipkg.setDestinationDir( it->destination->getDestinationPath() );
+ ipkg.setPackage( it->packageName );
+
+ int tmpFlags = flags;
+ if ( it->destination->linkToRoot() )
+ tmpFlags |= MAKE_LINKS;
+ else
+ tmpFlags ^= MAKE_LINKS;
+
+ ipkg.setFlags( tmpFlags );
ipkg.runIpkg();
}
ipkg.setOption( "install" );
+ ipkg.setDestination( dest );
+ ipkg.setDestinationDir( destDir );
+ ipkg.setFlags( instFlags );
for ( it = installList.begin() ; it != installList.end() ; ++it )
{
- ipkg.setPackage( *it );
+ ipkg.setPackage( it->packageName );
ipkg.runIpkg();
}
flags |= FORCE_REINSTALL;
- ipkg.setFlags( flags );
+ ipkg.setOption( "reinstall" );
for ( it = updateList.begin() ; it != updateList.end() ; ++it )
{
- ipkg.setPackage( *it );
+ ipkg.setDestination( it->destination->getDestinationName() );
+ ipkg.setDestinationDir( it->destination->getDestinationPath() );
+ ipkg.setPackage( it->packageName );
+
+ int tmpFlags = flags;
+ if ( it->destination->linkToRoot() && it->recreateLinks )
+ tmpFlags |= MAKE_LINKS;
+ else
+ tmpFlags ^= MAKE_LINKS;
+ ipkg.setFlags( tmpFlags );
ipkg.runIpkg();
}
}
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h
index 8b05c52..3a5d8b8 100644
--- a/noncore/settings/aqpkg/installdlgimpl.h
+++ b/noncore/settings/aqpkg/installdlgimpl.h
@@ -25,10 +25,19 @@ using namespace std;
#include "ipkg.h"
#include "install.h"
+class InstallData
+{
+public:
+ QString option; // I - install, D - delete, U - upgrade
+ QString packageName;
+ Destination *destination;
+ bool recreateLinks;
+};
+
class InstallDlgImpl : public InstallDlg
{
public:
- InstallDlgImpl( vector<QString> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
+ InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
InstallDlgImpl( QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
~InstallDlgImpl();
@@ -39,9 +48,9 @@ protected:
private:
DataManager *dataMgr;
- vector<QString> installList;
- vector<QString> removeList;
- vector<QString> updateList;
+ vector<InstallData> installList;
+ vector<InstallData> removeList;
+ vector<InstallData> updateList;
int flags;
Ipkg ipkg;
bool upgradePackages;
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 6d0edad..02d4258 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -41,7 +41,7 @@ Ipkg :: ~Ipkg()
{
}
-// Option is what we are going to do - install, upgrade, download
+// Option is what we are going to do - install, upgrade, download, reinstall
// package is the package name to install - either a fully qualified path and ipk
// file (if stored locally) or just the name of the package (for a network package)
// packageName is the package name - (for a network package this will be the same as
@@ -89,7 +89,6 @@ bool Ipkg :: runIpkg( )
if ( destDir == "/" )
flags ^= MAKE_LINKS;
}
-
}
#ifdef X86
@@ -97,16 +96,23 @@ bool Ipkg :: runIpkg( )
cmd += IPKG_CONF;
#endif
- cmd += " " + option;
+
+ if ( option == "reinstall" )
+ cmd += " install";
+ else
+ cmd += " " + option;
if ( option != "upgrade" )
cmd += " " + package;
cmd += " 2>&1";
+
+ 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" )
+ if ( option == "remove" || option == "reinstall" )
{
createLinks = false;
if ( flags & MAKE_LINKS )
@@ -125,7 +131,7 @@ bool Ipkg :: runIpkg( )
ret = executeIpkgCommand( cmd, option );
- if ( option == "install" )
+ if ( option == "install" || option == "reinstall" )
{
// If we are not removing packages and make links option is selected
// create the links
@@ -153,6 +159,7 @@ bool Ipkg :: runIpkg( )
delete dependantPackages;
emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") );
+ emit outputText( "" );
return ret;
}
@@ -182,7 +189,7 @@ int Ipkg :: executeIpkgCommand( QString &cmd, const QString option )
if ( lineStr != lineStrOld )
{
//See if we're finished
- if ( option == "install" )
+ if ( option == "install" || option == "reinstall" )
{
// Need to keep track of any dependant packages that get installed
// so that we can create links to them as necessary
@@ -242,11 +249,11 @@ QStringList* Ipkg :: getList( const QString &packageFilename, const QString &des
QString packageFileDir = destDir+"/usr/lib/ipkg/info/"+packageFilename+".list";
QFile f( packageFileDir );
- cout << "Try to open " << packageFileDir.latin1() << endl;
+ cout << "Try to open " << packageFileDir << endl;
if ( !f.open(IO_ReadOnly) )
{
// Couldn't open from dest, try from /
-// cout << "Could not open:" << packageFileDir << endl;
+ cout << "Could not open:" << packageFileDir << endl;
f.close();
packageFileDir = "/usr/lib/ipkg/info/"+packageFilename+".list";
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 6f528a1..ed5bf75 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -204,6 +204,24 @@ void NetworkPackageManager :: serverSelected( int )
}
QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox );
+
+ if ( it->isInstalled() )
+ {
+ QString destName = "";
+ if ( it->getLocalPackage() )
+ {
+ if ( it->getLocalPackage()->getInstalledTo() )
+ destName = it->getLocalPackage()->getInstalledTo()->getDestinationName();
+ }
+ else
+ {
+ if ( it->getInstalledTo() )
+ destName = it->getInstalledTo()->getDestinationName();
+ }
+ if ( destName != "" )
+ new QCheckListItem( item, QString( "Installed To - " ) + destName );
+ }
+
if ( !it->isPackageStoredLocally() )
new QCheckListItem( item, QString( "Description - " ) + it->getDescription() );
else
@@ -255,20 +273,13 @@ void NetworkPackageManager :: updateServer()
// First, write out ipkg_conf file so that ipkg can use it
dataMgr->writeOutIpkgConf();
-// if ( serverName == LOCAL_SERVER )
-// ;
-// else if ( serverName == LOCAL_IPKGS )
-// ;
-// else
- {
- QString option = "update";
- QString dummy = "";
- Ipkg ipkg;
- connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
- ipkg.setOption( option );
-
- ipkg.runIpkg( );
- }
+ QString option = "update";
+ QString dummy = "";
+ Ipkg ipkg;
+ connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
+ ipkg.setOption( option );
+
+ ipkg.runIpkg( );
// Reload data
dataMgr->reloadServerData( serversList->currentText() );
@@ -394,7 +405,7 @@ void NetworkPackageManager :: downloadPackage()
void NetworkPackageManager :: applyChanges()
{
- // Disable buttons to stop silly people clicking lots on them :)
+ stickyOption = "";
// First, write out ipkg_conf file so that ipkg can use it
dataMgr->writeOutIpkgConf();
@@ -402,15 +413,15 @@ void NetworkPackageManager :: applyChanges()
// Now for each selected item
// deal with it
- vector<QString> workingPackages;
+ vector<InstallData> workingPackages;
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
{
- QString p = dealWithItem( item );
- workingPackages.push_back( p );
+ InstallData data = dealWithItem( item );
+ workingPackages.push_back( data );
}
}
@@ -437,7 +448,7 @@ void NetworkPackageManager :: applyChanges()
// If not installed - install
// If installed and different version available - upgrade
// If installed and version up to date - remove
-QString NetworkPackageManager :: dealWithItem( QCheckListItem *item )
+InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
{
QString name = item->text();
int pos = name.find( "*" );
@@ -458,10 +469,25 @@ QString NetworkPackageManager :: dealWithItem( QCheckListItem *item )
QString option;
QString dest = "root";
if ( !p->isInstalled() )
- return QString( "I" ) + name;
+ {
+ InstallData item;
+ item.option = "I";
+ item.packageName = name;
+ return item;
+ }
else
{
- if ( p->getVersion() == p->getInstalledVersion() )
+ InstallData item;
+ item.option = "D";
+ item.packageName = name;
+ if ( p->getInstalledTo() )
+ item.destination = p->getInstalledTo();
+ else
+ item.destination = p->getLocalPackage()->getInstalledTo();
+
+ // Sticky option not implemented yet, but will eventually allow
+ // the user to say something like 'remove all'
+ if ( stickyOption == "" )
{
QString msgtext;
msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name );
@@ -469,18 +495,26 @@ QString NetworkPackageManager :: dealWithItem( QCheckListItem *item )
msgtext, "Remove", "ReInstall" ) )
{
case 0: // Try again or Enter
- return QString( "D" ) + name;
+ item.option = "D";
break;
case 1: // Quit or Escape
- return QString( "U" ) + name;
+ item.option = "U";
break;
}
-
- // User hit cancel (on dlg - assume remove)
- return QString( "D" ) + name;
}
else
- return QString( "U" ) + name;
+ {
+// item.option = stickyOption;
+ }
+
+ // Check if we are reinstalling the same version
+ if ( p->getVersion() != p->getInstalledVersion() )
+ item.recreateLinks = true;
+ else
+ item.recreateLinks = false;
+
+ // User hit cancel (on dlg - assume remove)
+ return item;
}
}
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h
index 0ae64a6..7efa42c 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.h
+++ b/noncore/settings/aqpkg/networkpkgmgr.h
@@ -26,6 +26,7 @@
#include "datamgr.h"
#include "progressdlg.h"
+class InstallData;
/** NetworkPackageManager is the base class of the project */
class NetworkPackageManager : public QWidget
@@ -59,7 +60,8 @@ private:
void initGui();
void setupConnections();
void showProgressDialog( char *initialText );
- QString dealWithItem( QCheckListItem *item );
+ InstallData dealWithItem( QCheckListItem *item );
+ QString stickyOption;
public slots:
void serverSelected( int index );