summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/server.cpp13
-rw-r--r--noncore/settings/aqpkg/server.h3
2 files changed, 11 insertions, 5 deletions
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp
index 0069a60..7d103a2 100644
--- a/noncore/settings/aqpkg/server.cpp
+++ b/noncore/settings/aqpkg/server.cpp
@@ -69,25 +69,25 @@ void Server :: readStatusFile( vector<Destination> &destList )
QString path = dit->getDestinationPath();
if ( path.right( 1 ) != "/" )
path += "/";
if ( path == "/" )
{
rootRead = true;
installingToRoot = true;
}
packageFile = path + "usr/lib/ipkg/status";
- readPackageFile( 0, false, installingToRoot );
+ readPackageFile( 0, false, installingToRoot, dit );
}
// Ensure that the root status file is read
if ( !rootRead )
{
cout << "Reading status file " << "/usr/lib/ipkg/status" << endl;
packageFile = "/usr/lib/ipkg/status";
readPackageFile( 0, false, true );
}
}
void Server :: readLocalIpks( Server *local )
@@ -130,25 +130,25 @@ void Server :: readLocalIpks( Server *local )
packageList.push_back( Package( tmp ) );
int p2 = file.find( "_", p+1 );
tmp = file.mid( p+1, p2-(p+1) );
packageList.back().setVersion( tmp );
packageList.back().setPackageStoredLocally( true );
}
#endif
// build local packages
buildLocalPackages( local );
}
-void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot )
+void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest )
{
ifstream in( packageFile );
if ( !in.is_open() )
return;
char line[1001];
char k[21];
char v[1001];
QString key;
QString value;
if ( clearAll )
@@ -159,38 +159,45 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR
do
{
in.getline( line, 1000 );
if ( in.eof() )
continue;
k[0] = '\0';
v[0] = '\0';
sscanf( line, "%[^:]: %[^\n]", k, v );
key = k;
value = v;
- key.stripWhiteSpace();
+ key = key.stripWhiteSpace();
+ value = value.stripWhiteSpace();
if ( key == "Package" && newPackage )
{
newPackage = false;
currPackage = getPackage( value );
if ( !currPackage )
{
packageList.push_back( Package( value ) );
currPackage = &(packageList.back());
+ currPackage->setInstalledTo( dest );
if ( installingToRoot )
currPackage->setInstalledToRoot( true );
}
+ else
+ {
+ if (currPackage->getStatus().find( "deinstall" ) != -1 )
+ currPackage->setInstalledTo( dest );
+ }
}
else if ( key == "Version" )
{
if ( currPackage )
currPackage->setVersion( value );
}
else if ( key == "Status" )
{
if ( currPackage )
currPackage->setStatus( value );
}
else if ( key == "Description" )
diff --git a/noncore/settings/aqpkg/server.h b/noncore/settings/aqpkg/server.h
index 5f83f75..e9f434c 100644
--- a/noncore/settings/aqpkg/server.h
+++ b/noncore/settings/aqpkg/server.h
@@ -28,39 +28,38 @@ using namespace std;
class Server
{
public:
Server() {}
Server( const char *name, const char *url );
Server( const char *name, const char *url, const char *file );
~Server();
void cleanUp();
void readStatusFile( vector<Destination> &v );
void readLocalIpks( Server *local );
- void readPackageFile( Server *local = 0, bool clearAll = true, bool installedToRoot= false );
+ void readPackageFile( Server *local = 0, bool clearAll = true, bool installedToRoot= false, Destination *dest = 0 );
void buildLocalPackages( Server *local );
Package *getPackage( const char *name );
Package *getPackage( QString &name );
QString toString();
vector<Package> &getPackageList();
bool isServerActive() { return active; }
void setServerName( const QString &name ) { serverName = name; }
void setServerUrl( const QString &url ) { serverUrl = url; }
void setActive( bool val ) { active = val; }
QString &getServerName() { return serverName; }
QString &getServerUrl() { return serverUrl; }
protected:
private:
QString serverName;
QString serverUrl;
QString packageFile;
bool active;
-
vector<Package> packageList;
};
#endif