summaryrefslogtreecommitdiff
authorandyq <andyq>2003-01-18 12:40:22 (UTC)
committer andyq <andyq>2003-01-18 12:40:22 (UTC)
commit2ad938f8470eb460ea5dae6ca3844c4dcc6cd991 (patch) (side-by-side diff)
tree52235c5f9f4ecc469b1d0ae57f1482e1cf2c475a
parent1c9b38eaee495c13d5d3fcbd818965339cc6d0ce (diff)
downloadopie-2ad938f8470eb460ea5dae6ca3844c4dcc6cd991.zip
opie-2ad938f8470eb460ea5dae6ca3844c4dcc6cd991.tar.gz
opie-2ad938f8470eb460ea5dae6ca3844c4dcc6cd991.tar.bz2
Fixed relinking of files when upgrade selected (now removes old links first and recreates them after), also cut down on spurious failed to link errors on linking
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 29bf40d..51eca8b 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -106,55 +106,55 @@ bool Ipkg :: runIpkg( )
#endif
if ( option == "reinstall" )
commands << "install";
else
commands << option;
if ( package != "" )
commands << package;
if ( package != "" )
emit outputText( QString( "Dealing with package " ) + package );
qApp->processEvents();
- // If we are removing packages and make links option is selected
+ // If we are removing, reinstalling or upgrading packages and make links option is selected
// create the links
- if ( option == "remove" || option == "reinstall" )
+ if ( option == "remove" || option == "reinstall" || option == "upgrade" )
{
createLinks = false;
if ( flags & MAKE_LINKS )
{
emit outputText( QString( "Removing symbolic links...\n" ) );
linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
emit outputText( QString( " " ) );
}
}
// Execute command
dependantPackages = new QList<QString>;
dependantPackages->setAutoDelete( true );
ret = executeIpkgCommand( commands, option );
if ( aborted )
return false;
- if ( option == "install" || option == "reinstall" )
+ if ( option == "install" || option == "reinstall" || option == "upgrade" )
{
// If we are not removing packages and make links option is selected
// create the links
createLinks = true;
if ( flags & MAKE_LINKS )
{
emit outputText( " " );
emit outputText( QString( "Creating symbolic links for " )+ package );
linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
// link dependant packages that were installed with this release
QString *pkg;
for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() )
{
if ( *pkg == package )
@@ -509,54 +509,57 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const
linkFile += file;
}
QString text;
if ( createLinks )
{
// If this file is a directory (ends with a /) and it doesn't exist,
// we need to create it
if ( file.right(1) == "/" )
{
QFileInfo f( linkFile );
if ( !f.exists() )
{
emit outputText( QString( "Creating directory " ) + linkFile );
QDir d;
d.mkdir( linkFile, true );
}
- else
- emit outputText( QString( "Directory " ) + linkFile + " already exists" );
+// else
+// emit outputText( QString( "Directory " ) + linkFile + " already exists" );
}
else
{
int rc = symlink( sourceFile, linkFile );
text = (rc == 0 ? "Linked " : "Failed to link ");
text += sourceFile + " to " + linkFile;
emit outputText( text );
}
}
else
{
QFileInfo f( linkFile );
if ( f.exists() )
{
if ( f.isFile() )
{
QFile f( linkFile );
bool rc = f.remove();
text = (rc ? "Removed " : "Failed to remove ");
text += linkFile;
emit outputText( text );
}
else if ( f.isDir() )
{
QDir d;
bool rc = d.rmdir( linkFile, true );
+ if ( rc )
+ {
text = (rc ? "Removed " : "Failed to remove ");
text += linkFile;
emit outputText( text );
}
}
}
+ }
}