author | harlekin <harlekin> | 2002-08-30 10:31:09 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-30 10:31:09 (UTC) |
commit | 40bac3f8b24cd8b02c685dae3efa57c6de09452b (patch) (unidiff) | |
tree | b294e82541b26cacb10389b53b228e32bb12dee1 | |
parent | 57e4c1b05208650eaac76268eb9bb25a1caa2184 (diff) | |
download | opie-40bac3f8b24cd8b02c685dae3efa57c6de09452b.zip opie-40bac3f8b24cd8b02c685dae3efa57c6de09452b.tar.gz opie-40bac3f8b24cd8b02c685dae3efa57c6de09452b.tar.bz2 |
blind fix by robert to make it work with new ipkg format too
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 7aaa240..1054a1d 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -47,32 +47,32 @@ void Package::init( PackageManagerSettings *s ) | |||
47 | _toProcess = false; | 47 | _toProcess = false; |
48 | _useFileName = false; | 48 | _useFileName = false; |
49 | _old = false; | 49 | _old = false; |
50 | _status = ""; | 50 | _status = ""; |
51 | _dest = settings->getDestinationName(); | 51 | _dest = settings->getDestinationName(); |
52 | _link = settings->createLinks(); | 52 | _link = settings->createLinks(); |
53 | _versions=0; | 53 | _versions=0; |
54 | _version=""; | 54 | _version=""; |
55 | } | 55 | } |
56 | 56 | ||
57 | Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) | 57 | Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) |
58 | : QObject(parent,name) | 58 | : QObject(parent,name) |
59 | { | 59 | { |
60 | init(s); | 60 | init(s); |
61 | parsePackage( pack ); | 61 | parsePackage( pack ); |
62 | } | 62 | } |
63 | 63 | ||
64 | Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) | 64 | Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) |
65 | : QObject(parent,name) | 65 | : QObject(parent,name) |
66 | { | 66 | { |
67 | init(s); | 67 | init(s); |
68 | if ( !QFile::exists( n ) ) | 68 | if ( !QFile::exists( n ) ) |
69 | { | 69 | { |
70 | _name = QString( n ); | 70 | _name = QString( n ); |
71 | }else{ | 71 | }else{ |
72 | pvDebug(4,"remote file: "+n); | 72 | pvDebug(4,"remote file: "+n); |
73 | parseIpkgFile( n ); | 73 | parseIpkgFile( n ); |
74 | _useFileName = true; | 74 | _useFileName = true; |
75 | _fileName = QString( n ); | 75 | _fileName = QString( n ); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
@@ -109,25 +109,25 @@ void Package::setValue( QString n, QString t ) | |||
109 | _version = t; | 109 | _version = t; |
110 | // }else if ( n == "Pre-Depends") | 110 | // }else if ( n == "Pre-Depends") |
111 | // { | 111 | // { |
112 | // | 112 | // |
113 | // }else if ( n == "Depends") | 113 | // }else if ( n == "Depends") |
114 | // { | 114 | // { |
115 | 115 | ||
116 | }else if ( n == "Filename") | 116 | }else if ( n == "Filename") |
117 | { | 117 | { |
118 | _fileName = t; | 118 | _fileName = t; |
119 | // }else if ( n == "Size") | 119 | // }else if ( n == "Size") |
120 | // { | 120 | // { |
121 | // | 121 | // |
122 | //}else if ( n == "MD5Sum") | 122 | //}else if ( n == "MD5Sum") |
123 | //{ | 123 | //{ |
124 | 124 | ||
125 | }else if ( n == "Description") | 125 | }else if ( n == "Description") |
126 | { | 126 | { |
127 | setDesc( t ); | 127 | setDesc( t ); |
128 | }else if ( n == "Status") | 128 | }else if ( n == "Status") |
129 | { | 129 | { |
130 | if ( installed() ) return; | 130 | if ( installed() ) return; |
131 | _status = t; | 131 | _status = t; |
132 | // }else if ( n == "Essential") | 132 | // }else if ( n == "Essential") |
133 | // { | 133 | // { |
@@ -376,76 +376,83 @@ QString Package::dest() | |||
376 | return _dest!=""?_dest:settings->getDestinationName(); | 376 | return _dest!=""?_dest:settings->getDestinationName(); |
377 | else return ""; | 377 | else return ""; |
378 | } | 378 | } |
379 | 379 | ||
380 | void Package::setDest( QString d ) | 380 | void Package::setDest( QString d ) |
381 | { | 381 | { |
382 | if ( d == "remote") _useFileName = true; | 382 | if ( d == "remote") _useFileName = true; |
383 | else _dest = d; | 383 | else _dest = d; |
384 | } | 384 | } |
385 | 385 | ||
386 | void Package::setOn() | 386 | void Package::setOn() |
387 | { | 387 | { |
388 | _toProcess = true; | 388 | _toProcess = true; |
389 | } | 389 | } |
390 | 390 | ||
391 | bool Package::link() | 391 | bool Package::link() |
392 | { | 392 | { |
393 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; | 393 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; |
394 | return _link; | 394 | return _link; |
395 | } | 395 | } |
396 | 396 | ||
397 | void Package::setLink(bool b) | 397 | void Package::setLink(bool b) |
398 | { | 398 | { |
399 | _link = b; | 399 | _link = b; |
400 | } | 400 | } |
401 | 401 | ||
402 | void Package::parseIpkgFile( QString file) | 402 | void Package::parseIpkgFile( QString file) |
403 | { | 403 | { |
404 | system("tar xzf "+file+" -C /tmp"); | 404 | // 20020830 |
405 | system("tar xzf /tmp/control.tar.gz -C /tmp"); | 405 | // a quick hack to make oipkg understand the new ipk format |
406 | // neu: ar pf PACKAGE control.tar.gz | tar xfOz - ./control > /tmp/control | ||
407 | if (! system("ar pf "+file+" control.tar.gz | tar xfOz - ./control > /tmp/control") ) | ||
408 | { | ||
409 | //#old tar ipk format | ||
410 | system("tar xzf "+file+" -C /tmp"); | ||
411 | system("tar xzf /tmp/control.tar.gz -C /tmp"); | ||
412 | } | ||
406 | QFile f("/tmp/control"); | 413 | QFile f("/tmp/control"); |
407 | if ( f.open(IO_ReadOnly) ) | 414 | if ( f.open(IO_ReadOnly) ) |
408 | { | 415 | { |
409 | QTextStream t( &f ); | 416 | QTextStream t( &f ); |
410 | QStringList pack; | 417 | QStringList pack; |
411 | while ( !t.eof() ) | 418 | while ( !t.eof() ) |
412 | { | 419 | { |
413 | pack << t.readLine(); | 420 | pack << t.readLine(); |
414 | } | 421 | } |
415 | f.close(); | 422 | f.close(); |
416 | parsePackage( pack ); | 423 | parsePackage( pack ); |
417 | } | 424 | } |
418 | 425 | ||
419 | } | 426 | } |
420 | 427 | ||
421 | //QString Package::getPackageName() | 428 | //QString Package::getPackageName() |
422 | //{ | 429 | //{ |
423 | //if ( _packageName.isEmpty() ) return _name; | 430 | //if ( _packageName.isEmpty() ) return _name; |
424 | //else return _packageName; | 431 | //else return _packageName; |
425 | //} | 432 | //} |
426 | 433 | ||
427 | void Package::instalFromFile(bool iff) | 434 | void Package::instalFromFile(bool iff) |
428 | { | 435 | { |
429 | _useFileName = iff; | 436 | _useFileName = iff; |
430 | } | 437 | } |
431 | 438 | ||
432 | void Package::setName(QString n) | 439 | void Package::setName(QString n) |
433 | { | 440 | { |
434 | _displayName = n; | 441 | _displayName = n; |
435 | } | 442 | } |
436 | 443 | ||
437 | QDict<QString>* Package::getFields() | 444 | QDict<QString>* Package::getFields() |
438 | { | 445 | { |
439 | return &_values; | 446 | return &_values; |
440 | } | 447 | } |
441 | 448 | ||
442 | QString Package::status() | 449 | QString Package::status() |
443 | { | 450 | { |
444 | return _status; | 451 | return _status; |
445 | } | 452 | } |
446 | 453 | ||
447 | bool Package::isOld() | 454 | bool Package::isOld() |
448 | { | 455 | { |
449 | if (!_versions) return false; | 456 | if (!_versions) return false; |
450 | QDictIterator<Package> other( *_versions ); | 457 | QDictIterator<Package> other( *_versions ); |
451 | while ( other.current() ) { | 458 | while ( other.current() ) { |