summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/package.cpp
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/oipkg/package.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/package.cpp56
1 files changed, 45 insertions, 11 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
@@ -3,4 +3,8 @@
#include <qpe/process.h>
#include <qpe/stringutil.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <stdlib.h>
+#include <unistd.h>
#include "debug.h"
@@ -26,5 +30,6 @@ void Package::init( PackageManagerSettings *s )
_toProcess = false;
_status = "";
- _dest = "";
+ _dest = settings->getDestinationName();
+ _link = settings->createLinks();
}
@@ -33,5 +38,4 @@ Package::Package( QStringList pack, PackageManagerSettings *s )
init(s);
parsePackage( pack );
- _toProcess = false;
}
@@ -39,6 +43,12 @@ Package::Package( QString n, PackageManagerSettings *s )
{
init(s);
- _name = QString( n );
- _toProcess = false;
+ if ( !QFile::exists( n ) )
+ {
+ _name = QString( n );
+ }else{
+ parseIpkgFile( n );
+ _toProcess = true;
+ _packageName = QString( n );
+ }
}
@@ -47,5 +57,4 @@ Package::Package( Package *pi )
init(pi->settings);
copyValues( pi );
- _toProcess = false;
}
@@ -212,10 +221,10 @@ void Package::parsePackage( QStringList pack )
int sep = line.find( QRegExp(":[\t ]+") );
if ( sep >= 0 )
- {
- QString tag = line.left(sep);
- QString value = line.mid(sep+2).simplifyWhiteSpace();
- setValue( tag, value );
- }else{
- }
+ {
+ QString tag = line.left(sep);
+ QString value = line.mid(sep+2).simplifyWhiteSpace();
+ setValue( tag, value );
+ }else{
+ }
}
return;
@@ -296,2 +305,27 @@ 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;
+}