author | drw <drw> | 2003-02-25 00:39:29 (UTC) |
---|---|---|
committer | drw <drw> | 2003-02-25 00:39:29 (UTC) |
commit | 8d80ed4f9cf8051b5566aaf3f639c76fe7d6de7c (patch) (side-by-side diff) | |
tree | 95ac0e3df097d1d2af81dbb543502b0682043fc0 | |
parent | 45fc2c7089de9bbb7887ba9bdb56c974b19c1caf (diff) | |
download | opie-8d80ed4f9cf8051b5566aaf3f639c76fe7d6de7c.zip opie-8d80ed4f9cf8051b5566aaf3f639c76fe7d6de7c.tar.gz opie-8d80ed4f9cf8051b5566aaf3f639c76fe7d6de7c.tar.bz2 |
Fix for bug #707 - remove package from status file only if package removal was successful.
-rw-r--r-- | noncore/settings/aqpkg/ipkg.cpp | 13 | ||||
-rw-r--r-- | noncore/settings/aqpkg/ipkg.h | 1 |
2 files changed, 8 insertions, 6 deletions
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp index 51eca8b..e66c02d 100644 --- a/noncore/settings/aqpkg/ipkg.cpp +++ b/noncore/settings/aqpkg/ipkg.cpp @@ -44,32 +44,33 @@ Ipkg :: Ipkg() Ipkg :: ~Ipkg() { } // 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 // package parameter) // dest is the destination alias (from ipk.conf) // 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( ) { + error = false; bool ret = false; QStringList commands; QDir::setCurrent( "/tmp" ); if ( runtimeDir != "" ) { commands << "cd "; commands << runtimeDir; commands << ";"; } commands << "ipkg" << "-force-defaults"; // only set the destination for an install operation if ( option == "install" ) commands << "-dest" << destination; @@ -155,38 +156,32 @@ bool Ipkg :: runIpkg( ) // link dependant packages that were installed with this release QString *pkg; for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() ) { if ( *pkg == package ) continue; emit outputText( " " ); emit outputText( QString( "Creating symbolic links for " )+ (*pkg) ); linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir ); } } } delete dependantPackages; - // Finally, if we are removing a package, remove its entry from the <destdir>/usr/lib/ipkg/status file - // to workaround an ipkg bug which stops reinstall to a different location - if ( option == "remove" ) - removeStatusEntry(); - - emit outputText( "Finished" ); emit outputText( "" ); return ret; } void Ipkg :: removeStatusEntry() { QString statusFile = destDir; if ( statusFile.right( 1 ) != "/" ) statusFile += "/"; statusFile += "usr/lib/ipkg/status"; QString outStatusFile = statusFile + ".tmp"; emit outputText( "" ); emit outputText( "Removing status entry..." ); @@ -327,36 +322,42 @@ void Ipkg::commandStdout(OProcess*, char *buffer, int buflen) } qDebug(lineStr); buffer[0] = '\0'; } void Ipkg::commandStderr(OProcess*, char *buffer, int buflen) { qDebug("received stderrt %d bytes", buflen); QString lineStr = buffer; if ( lineStr[buflen-1] == '\n' ) buflen --; lineStr=lineStr.left( buflen ); emit outputText( lineStr ); buffer[0] = '\0'; + error = true; } void Ipkg::processFinished() { + // Finally, if we are removing a package, remove its entry from the <destdir>/usr/lib/ipkg/status file + // to workaround an ipkg bug which stops reinstall to a different location + if ( !error && option == "remove" ) + removeStatusEntry(); + delete proc; proc = 0; finished = true; } void Ipkg :: abort() { if ( proc ) { proc->kill(); aborted = true; } } /* diff --git a/noncore/settings/aqpkg/ipkg.h b/noncore/settings/aqpkg/ipkg.h index f08667b..d49bb04 100644 --- a/noncore/settings/aqpkg/ipkg.h +++ b/noncore/settings/aqpkg/ipkg.h @@ -52,32 +52,33 @@ public: void setFlags( int fl ) { flags = fl; } void setRuntimeDirectory( const char *dir ) { runtimeDir = dir; } signals: void outputText( const QString &text ); public slots: void commandStdout(OProcess*, char *buffer, int buflen); void commandStderr(OProcess*, char *buffer, int buflen); void processFinished(); void abort(); private: bool createLinks; bool aborted; + bool error; QString option; QString package; QString destination; QString destDir; QString runtimeDir; OProcess *proc; int flags; bool finished; QList<QString> *dependantPackages; int executeIpkgCommand( QStringList &cmd, const QString option ); void removeStatusEntry(); void linkPackage( const QString &packFileName, const QString &dest, const QString &destDir ); QStringList* getList( const QString &packageFilename, const QString &destDir ); void processFileList( const QStringList *fileList, const QString &destDir ); |