author | harlekin <harlekin> | 2002-08-30 10:31:09 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-30 10:31:09 (UTC) |
commit | 40bac3f8b24cd8b02c685dae3efa57c6de09452b (patch) (side-by-side diff) | |
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 | 7 |
1 files changed, 7 insertions, 0 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 @@ -276,197 +276,204 @@ void Package::copyValues( Package* pack ) if (_dest.isEmpty() && !pack->_dest.isEmpty()) _dest= QString( pack->_dest ); if (_displayName.isEmpty()&& !pack->_displayName.isEmpty()) _displayName = QString( pack->_displayName ); if (_fileName.isEmpty() && !pack->_fileName.isEmpty()) _fileName = QString( pack->_fileName ); if (_version.isEmpty() && !pack->_version.isEmpty()) _version = QString( pack->_version ); if (_values.isEmpty() && !pack->_values.isEmpty())_values = QDict<QString>( pack->_values ); if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); } QString Package::section() { return _section; } void Package::setSection( QString s) { int i = s.find("/"); if ( i > 0 ) { _section = s.left(i); _subsection = s.mid(i+1); }else{ _section = s; _subsection = ""; } } QString Package::subSection() { return _subsection; } void Package::parsePackage( QStringList pack ) { if ( pack.isEmpty() ) return; int count = pack.count(); for( int i = 0; i < count; i++ ) { QString line = pack[i]; 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{ } } return; } QString Package::details() { QString status; Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); QString description; if ( ipkg_status.exec("",status) ) { QStringList lines = QStringList::split('\n',status,TRUE); for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) { QString line = *it; if ( line == " ." ) { description.append("<p>"); } else if ( line[0] == ' ' || line[0] == '\t' ) { // continuation description.append(" "); description.append(Qtopia::escapeString(line)); } else { int sep = line.find(QRegExp(":[\t ]+")); if ( sep >= 0 ) { QString tag = line.left(sep); description.append("<br>"); description.append("<b>"); description.append(Qtopia::escapeString(tag)); description.append(":</b> "); description.append(Qtopia::escapeString(line.mid(sep+2))); } else { description.append(" "); description.append(Qtopia::escapeString(line)); } } } } return description; } void Package::processed() { _toProcess = false; //hack, but we're not writing status anyway... if ( installed() ) _status = "install"; else _status = "installed"; } QString Package::dest() { if ( installed()||(!installed() && _toProcess) ) return _dest!=""?_dest:settings->getDestinationName(); else return ""; } void Package::setDest( QString d ) { if ( d == "remote") _useFileName = true; else _dest = d; } void Package::setOn() { _toProcess = true; } bool Package::link() { if ( _dest == "root" || (!installed() && !_toProcess) ) return false; return _link; } void Package::setLink(bool b) { _link = b; } void Package::parseIpkgFile( QString file) { +// 20020830 +// a quick hack to make oipkg understand the new ipk format +// neu: ar pf PACKAGE control.tar.gz | tar xfOz - ./control > /tmp/control + if (! system("ar pf "+file+" control.tar.gz | tar xfOz - ./control > /tmp/control") ) + { +//#old tar ipk format 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; //} void Package::instalFromFile(bool iff) { _useFileName = iff; } void Package::setName(QString n) { _displayName = n; } QDict<QString>* Package::getFields() { return &_values; } QString Package::status() { return _status; } bool Package::isOld() { if (!_versions) return false; QDictIterator<Package> other( *_versions ); while ( other.current() ) { if (other.current()->version() > version() ) return true; ++other; } return false; } bool Package::hasVersions() { if (!_versions) return false; else return true; } QDict<Package>* Package::getOtherVersions() { return _versions; } void Package::setOtherVersions(QDict<Package> *v) { _versions=v; } |