author | tille <tille> | 2002-06-25 11:24:49 (UTC) |
---|---|---|
committer | tille <tille> | 2002-06-25 11:24:49 (UTC) |
commit | d282b4f9cba20305e237910aca531b0360666f13 (patch) (side-by-side diff) | |
tree | 38845ae936110de2b60fe67191d83ba5a2232726 | |
parent | 8b39fcc7dbc0579c27e42918974a407104dc9fac (diff) | |
download | opie-d282b4f9cba20305e237910aca531b0360666f13.zip opie-d282b4f9cba20305e237910aca531b0360666f13.tar.gz opie-d282b4f9cba20305e237910aca531b0360666f13.tar.bz2 |
getting the list file right now
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 8 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 5 |
3 files changed, 12 insertions, 2 deletions
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 517b37a..8bbdd77 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp @@ -94,96 +94,104 @@ void Package::setValue( QString n, QString t ) // { }else if ( n == "Version") { _version = t; // }else if ( n == "Pre-Depends") // { // // }else if ( n == "Depends") // { }else if ( n == "Filename") { _fileName = t; // }else if ( n == "Size") // { // // }else if ( n == "MD5Sum") // { }else if ( n == "Description") { setDesc( t ); }else if ( n == "Status") { if ( installed() ) return; _status = t; // }else if ( n == "Essential") // { }else{ _values.insert(n,new QString(t)); } } QString Package::name() { if (_displayName.isEmpty() ) return _name; else return _displayName; } QString Package::installName() { if (_useFileName) return _fileName; else return _name; } +QString Package::packageName() +{ + QString pn = installName(); + pn = pn.right(pn.length()-pn.findRev("/")); + pn = pn.left(pn.find("_")); + return pn; +} + bool Package::installed() { if (_status.contains("installed")) { if (_status.contains("not-installed")) { _toProcess = true; return false; } else return true; } else if (_versions) { QDictIterator<Package> other( *_versions ); while ( other.current() ) { if (other.current()->status().contains("installed") && other.current()->version() == version()) return true; ++other; } } return false; } bool Package::otherInstalled() { if (_versions) { QDictIterator<Package> other( *_versions ); while ( other.current() ) { if (other.current()->installed()) return true; ++other; } } return false; } void Package::setDesc( QString s ) { _desc = s; _shortDesc = s.left( s.find("\n") ); } QString Package::desc() { diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index f50b9b5..0f76ece 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h @@ -1,76 +1,77 @@ #ifndef PK_ITEM_H #define PK_ITEM_H #include <qstring.h> #include <qlistview.h> #include <qpainter.h> #include <qpixmap.h> #include <qdict.h> #include <qobject.h> #include "pksettings.h" class Package : public QObject { Q_OBJECT public: Package(QObject *parent=0, const char *name=0); Package(PackageManagerSettings *s, QObject *parent=0, const char *name=0); ~Package(); Package( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); Package( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); Package( Package*s, QObject *parent=0, const char *name=0 ); void setValue( QString, QString ); void copyValues( Package* ); QString name(); QString installName(); + QString packageName(); bool installed(); bool otherInstalled(); void setDesc( QString ); QString shortDesc(); QString desc(); QString size(); QString sizeUnits(); QString version(); void setSection( QString ); QString section(); QString subSection(); QString details(); bool toProcess(); bool toInstall(); bool toRemove(); void processed(); QString dest(); void setDest( QString d ); void setOn(); bool link(); void setLink(bool); bool isOld(); bool hasVersions(); void parseIpkgFile( QString ); void instalFromFile(bool iff=true); void setName(QString); QDict<QString>* getFields(); QString status(); QDict<Package>* getOtherVersions(); void setOtherVersions(QDict<Package>*); public slots: void toggleProcess(); private: PackageManagerSettings *settings; QString _displayName; QString _name; QString _fileName; bool _old; bool _hasVersions; bool _toProcess; bool _link; QString _status; QString _size; QString _section; diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 7d0e246..89309a2 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -15,190 +15,191 @@ #include <qstring.h> #include <qcheckbox.h> #include <qtextstream.h> #include <qtextview.h> #include <qprogressbar.h> #include <qpushbutton.h> #include <qlayout.h> #include <stdlib.h> #include <unistd.h> #include "mainwindow.h" //#define OPROCESS PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) : QObject ( p ) { settings = s; runwindow = new RunWindow( p, name, true, f ); #ifdef OPROCESS ipkgProcess = new OProcess(); connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), this, SLOT(getIpkgOutput(OProcess*,char*,int))); connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), this, SLOT(getIpkgOutput(OProcess*,char*,int))); installDialog = 0; #endif } PmIpkg::~PmIpkg() { #ifdef OPROCESS delete ipkgProcess; #endif } bool PmIpkg::runIpkg(const QString& args, const QString& dest ) { bool ret=false; QDir::setCurrent("/tmp"); QString cmd = "/usr/bin/ipkg "; #ifdef OPROCESS ipkgProcess->clearArguments(); *ipkgProcess << "/usr/bin/ipkg "; - QString cmd = ""; + cmd = ""; #endif pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); if ( dest == "" ) cmd += " -dest "+settings->getDestinationName(); else cmd += " -dest "+ dest; cmd += " -force-defaults "; if (installDialog && installDialog->_force_depends) { if (installDialog->_force_depends->isChecked()) cmd += " -force-depends "; if (installDialog->_force_reinstall->isChecked()) cmd += " -force-reinstall "; if (installDialog->_force_remove->isChecked()) cmd += " -force-removal-of-essential-packages "; } out( "Starting to "+ args+"\n"); cmd += args; out( "running:\n"+cmd+"\n" ); pvDebug(2,"running:"+cmd); #ifdef OPROCESS *ipkgProcess << args; out( "running:\n" + cmd); *ipkgProcess << cmd; //debug ipkgProcess->clearArguments(); *ipkgProcess << "/bin/ls "; //debug QValueList<QCString> a = ipkgProcess->args(); QValueList<QCString>::Iterator it; for( it = a.begin(); it != a.end(); ++it ) { out( *it ); cmd += *it; } pvDebug(2,"running:"+cmd); qApp->processEvents(); // sleep(1); ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); if ( !ret ) { pvDebug(2,"Could not execute '" + cmd); out("\nError while executing "+ cmd+"\n\n"); out("\nError while executing\n\n"); // return false; } while ( ipkgProcess->isRunning() ) { out("."); pvDebug(7,"wait for oprocess to terminate"); qApp->processEvents(); }; #else qApp->processEvents(); FILE *fp; char line[130]; QString lineStr, lineStrOld; sleep(1); cmd +=" 2>&1"; fp = popen( (const char *) cmd, "r"); if ( fp == NULL ) { qDebug("Could not execute '" + cmd + "'! err=%d", fp); out("\nError while executing "+ cmd+"\n\n"); ret = false; } else { while ( fgets( line, sizeof line, fp) != NULL) { lineStr = line; lineStr=lineStr.left(lineStr.length()-1); //Configuring opie-oipkg...Done if (lineStr.contains("Done")) ret = true; if (lineStr!=lineStrOld) out(lineStr); lineStrOld = lineStr; qApp->processEvents(); } } pclose(fp); #endif //out( "Finished!"); pvDebug(2,QString(ret?"success\n":"failure\n")); return ret; } void PmIpkg::makeLinks(Package *pack) { pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); - linkPackage( pack->name(), pack->dest() ); + QString pn = pack->name(); + linkPackage( pack->packageName(), pack->dest() ); } QStringList* PmIpkg::getList( QString packFileName, QString d ) { QString dest = settings->getDestinationUrlByName( d ); dest = dest==""?d:dest; if (dest == "/" ) return 0; { Config cfg( "oipkg", Config::User ); cfg.setGroup( "Common" ); QString statusDir = cfg.readEntry( "statusDir", "" ); } packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; QFile f( packFileName ); if ( ! f.open(IO_ReadOnly) ) { pvDebug(1," Panik! Could not open"); out( "Panik!\n Could not open:\n"+packFileName ); return (QStringList*)0; } QStringList *fileList = new QStringList(); QTextStream t( &f ); while ( !t.eof() ) { *fileList += t.readLine(); } return fileList; } void PmIpkg::linkPackage( QString packFileName, QString dest ) { QStringList *fileList = getList( packFileName, dest ); processFileList( fileList, dest ); delete fileList; } void PmIpkg::processFileList( QStringList *fileList, QString d ) { if (!fileList) return; for (uint i=0; i < fileList->count(); i++) { QString dest = settings->getDestinationUrlByName( d ); dest = dest==""?d:dest; processLinkDir( (*fileList)[i], dest ); } } |