Diffstat (limited to 'noncore/unsupported/oipkg/package.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 9f602b5..5f0e5fa 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp @@ -2,6 +2,10 @@ #include <qpe/process.h> #include <qpe/stringutil.h> +#include <qfile.h> +#include <qtextstream.h> +#include <stdlib.h> +#include <unistd.h> #include "debug.h" @@ -25,28 +29,33 @@ void Package::init( PackageManagerSettings *s ) _name = ""; _toProcess = false; _status = ""; - _dest = ""; + _dest = settings->getDestinationName(); + _link = settings->createLinks(); } Package::Package( QStringList pack, PackageManagerSettings *s ) { init(s); parsePackage( pack ); - _toProcess = false; } Package::Package( QString n, PackageManagerSettings *s ) { init(s); + if ( !QFile::exists( n ) ) + { _name = QString( n ); - _toProcess = false; + }else{ + parseIpkgFile( n ); + _toProcess = true; + _packageName = QString( n ); + } } Package::Package( Package *pi ) { init(pi->settings); copyValues( pi ); - _toProcess = false; } @@ -295,3 +304,28 @@ void Package::setLink(bool b) { _link = b; } + +void Package::parseIpkgFile( QString file) +{ + system("tar xzf "+file+" -C /tmp"); + system("tar xzf /tmp/control.tar.gz -C /tmp"); + QFile f("/tmp/control"); + if ( f.open(IO_ReadOnly) ) + { + QTextStream t( &f ); + QStringList pack; + while ( !t.eof() ) + { + pack << t.readLine(); + } + f.close(); + parsePackage( pack ); + } + +} + +QString Package::getPackageName() +{ + if ( _packageName.isEmpty() ) return _name; + else return _packageName; +} |