summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/package.cpp
Unidiff
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
@@ -4,2 +4,6 @@
4#include <qpe/stringutil.h> 4#include <qpe/stringutil.h>
5#include <qfile.h>
6#include <qtextstream.h>
7#include <stdlib.h>
8#include <unistd.h>
5 9
@@ -27,3 +31,4 @@ void Package::init( PackageManagerSettings *s )
27 _status = ""; 31 _status = "";
28 _dest = ""; 32 _dest = settings->getDestinationName();
33 _link = settings->createLinks();
29} 34}
@@ -34,3 +39,2 @@ Package::Package( QStringList pack, PackageManagerSettings *s )
34 parsePackage( pack ); 39 parsePackage( pack );
35 _toProcess = false;
36} 40}
@@ -40,4 +44,10 @@ Package::Package( QString n, PackageManagerSettings *s )
40 init(s); 44 init(s);
41 _name = QString( n ); 45 if ( !QFile::exists( n ) )
42 _toProcess = false; 46 {
47 _name = QString( n );
48 }else{
49 parseIpkgFile( n );
50 _toProcess = true;
51 _packageName = QString( n );
52 }
43} 53}
@@ -48,3 +58,2 @@ Package::Package( Package *pi )
48 copyValues( pi ); 58 copyValues( pi );
49 _toProcess = false;
50} 59}
@@ -213,8 +222,8 @@ void Package::parsePackage( QStringList pack )
213 if ( sep >= 0 ) 222 if ( sep >= 0 )
214 { 223 {
215 QString tag = line.left(sep); 224 QString tag = line.left(sep);
216 QString value = line.mid(sep+2).simplifyWhiteSpace(); 225 QString value = line.mid(sep+2).simplifyWhiteSpace();
217 setValue( tag, value ); 226 setValue( tag, value );
218 }else{ 227 }else{
219 } 228 }
220 } 229 }
@@ -297 +306,26 @@ void Package::setLink(bool b)
297} 306}
307
308void Package::parseIpkgFile( QString file)
309{
310 system("tar xzf "+file+" -C /tmp");
311 system("tar xzf /tmp/control.tar.gz -C /tmp");
312 QFile f("/tmp/control");
313 if ( f.open(IO_ReadOnly) )
314 {
315 QTextStream t( &f );
316 QStringList pack;
317 while ( !t.eof() )
318 {
319 pack << t.readLine();
320 }
321 f.close();
322 parsePackage( pack );
323 }
324
325}
326
327QString Package::getPackageName()
328{
329 if ( _packageName.isEmpty() ) return _name;
330 else return _packageName;
331}