-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 | |||
@@ -110,64 +110,72 @@ void Package::setValue( QString n, QString t ) | |||
110 | // | 110 | // |
111 | //}else if ( n == "MD5Sum") | 111 | //}else if ( n == "MD5Sum") |
112 | //{ | 112 | //{ |
113 | 113 | ||
114 | }else if ( n == "Description") | 114 | }else if ( n == "Description") |
115 | { | 115 | { |
116 | setDesc( t ); | 116 | setDesc( t ); |
117 | }else if ( n == "Status") | 117 | }else if ( n == "Status") |
118 | { | 118 | { |
119 | if ( installed() ) return; | 119 | if ( installed() ) return; |
120 | _status = t; | 120 | _status = t; |
121 | // }else if ( n == "Essential") | 121 | // }else if ( n == "Essential") |
122 | // { | 122 | // { |
123 | 123 | ||
124 | }else{ | 124 | }else{ |
125 | _values.insert(n,new QString(t)); | 125 | _values.insert(n,new QString(t)); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | QString Package::name() | 129 | QString Package::name() |
130 | { | 130 | { |
131 | if (_displayName.isEmpty() ) return _name; | 131 | if (_displayName.isEmpty() ) return _name; |
132 | else return _displayName; | 132 | else return _displayName; |
133 | } | 133 | } |
134 | 134 | ||
135 | 135 | ||
136 | QString Package::installName() | 136 | QString Package::installName() |
137 | { | 137 | { |
138 | if (_useFileName) return _fileName; | 138 | if (_useFileName) return _fileName; |
139 | else return _name; | 139 | else return _name; |
140 | } | 140 | } |
141 | 141 | ||
142 | QString Package::packageName() | ||
143 | { | ||
144 | QString pn = installName(); | ||
145 | pn = pn.right(pn.length()-pn.findRev("/")); | ||
146 | pn = pn.left(pn.find("_")); | ||
147 | return pn; | ||
148 | } | ||
149 | |||
142 | bool Package::installed() | 150 | bool Package::installed() |
143 | { | 151 | { |
144 | if (_status.contains("installed")) | 152 | if (_status.contains("installed")) |
145 | { | 153 | { |
146 | if (_status.contains("not-installed")) | 154 | if (_status.contains("not-installed")) |
147 | { | 155 | { |
148 | _toProcess = true; | 156 | _toProcess = true; |
149 | return false; | 157 | return false; |
150 | } | 158 | } |
151 | else return true; | 159 | else return true; |
152 | } | 160 | } |
153 | else | 161 | else |
154 | if (_versions) | 162 | if (_versions) |
155 | { | 163 | { |
156 | QDictIterator<Package> other( *_versions ); | 164 | QDictIterator<Package> other( *_versions ); |
157 | while ( other.current() ) | 165 | while ( other.current() ) |
158 | { | 166 | { |
159 | if (other.current()->status().contains("installed") | 167 | if (other.current()->status().contains("installed") |
160 | && other.current()->version() == version()) | 168 | && other.current()->version() == version()) |
161 | return true; | 169 | return true; |
162 | ++other; | 170 | ++other; |
163 | } | 171 | } |
164 | } | 172 | } |
165 | return false; | 173 | return false; |
166 | } | 174 | } |
167 | 175 | ||
168 | bool Package::otherInstalled() | 176 | bool Package::otherInstalled() |
169 | { | 177 | { |
170 | if (_versions) | 178 | if (_versions) |
171 | { | 179 | { |
172 | QDictIterator<Package> other( *_versions ); | 180 | QDictIterator<Package> other( *_versions ); |
173 | while ( other.current() ) | 181 | while ( other.current() ) |
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,60 +1,61 @@ | |||
1 | #ifndef PK_ITEM_H | 1 | #ifndef PK_ITEM_H |
2 | #define PK_ITEM_H | 2 | #define PK_ITEM_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qlistview.h> | 5 | #include <qlistview.h> |
6 | #include <qpainter.h> | 6 | #include <qpainter.h> |
7 | #include <qpixmap.h> | 7 | #include <qpixmap.h> |
8 | #include <qdict.h> | 8 | #include <qdict.h> |
9 | #include <qobject.h> | 9 | #include <qobject.h> |
10 | 10 | ||
11 | #include "pksettings.h" | 11 | #include "pksettings.h" |
12 | 12 | ||
13 | class Package : public QObject | 13 | class Package : public QObject |
14 | { | 14 | { |
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | public: | 16 | public: |
17 | Package(QObject *parent=0, const char *name=0); | 17 | Package(QObject *parent=0, const char *name=0); |
18 | Package(PackageManagerSettings *s, QObject *parent=0, const char *name=0); | 18 | Package(PackageManagerSettings *s, QObject *parent=0, const char *name=0); |
19 | ~Package(); | 19 | ~Package(); |
20 | Package( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); | 20 | Package( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); |
21 | Package( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); | 21 | Package( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); |
22 | Package( Package*s, QObject *parent=0, const char *name=0 ); | 22 | Package( Package*s, QObject *parent=0, const char *name=0 ); |
23 | 23 | ||
24 | void setValue( QString, QString ); | 24 | void setValue( QString, QString ); |
25 | void copyValues( Package* ); | 25 | void copyValues( Package* ); |
26 | 26 | ||
27 | QString name(); | 27 | QString name(); |
28 | QString installName(); | 28 | QString installName(); |
29 | QString packageName(); | ||
29 | bool installed(); | 30 | bool installed(); |
30 | bool otherInstalled(); | 31 | bool otherInstalled(); |
31 | 32 | ||
32 | void setDesc( QString ); | 33 | void setDesc( QString ); |
33 | QString shortDesc(); | 34 | QString shortDesc(); |
34 | QString desc(); | 35 | QString desc(); |
35 | QString size(); | 36 | QString size(); |
36 | QString sizeUnits(); | 37 | QString sizeUnits(); |
37 | QString version(); | 38 | QString version(); |
38 | void setSection( QString ); | 39 | void setSection( QString ); |
39 | QString section(); | 40 | QString section(); |
40 | QString subSection(); | 41 | QString subSection(); |
41 | QString details(); | 42 | QString details(); |
42 | bool toProcess(); | 43 | bool toProcess(); |
43 | bool toInstall(); | 44 | bool toInstall(); |
44 | bool toRemove(); | 45 | bool toRemove(); |
45 | void processed(); | 46 | void processed(); |
46 | QString dest(); | 47 | QString dest(); |
47 | void setDest( QString d ); | 48 | void setDest( QString d ); |
48 | void setOn(); | 49 | void setOn(); |
49 | bool link(); | 50 | bool link(); |
50 | void setLink(bool); | 51 | void setLink(bool); |
51 | bool isOld(); | 52 | bool isOld(); |
52 | bool hasVersions(); | 53 | bool hasVersions(); |
53 | void parseIpkgFile( QString ); | 54 | void parseIpkgFile( QString ); |
54 | void instalFromFile(bool iff=true); | 55 | void instalFromFile(bool iff=true); |
55 | void setName(QString); | 56 | void setName(QString); |
56 | QDict<QString>* getFields(); | 57 | QDict<QString>* getFields(); |
57 | QString status(); | 58 | QString status(); |
58 | 59 | ||
59 | QDict<Package>* getOtherVersions(); | 60 | QDict<Package>* getOtherVersions(); |
60 | void setOtherVersions(QDict<Package>*); | 61 | void setOtherVersions(QDict<Package>*); |
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 | |||
@@ -31,65 +31,65 @@ | |||
31 | 31 | ||
32 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 32 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
33 | : QObject ( p ) | 33 | : QObject ( p ) |
34 | { | 34 | { |
35 | settings = s; | 35 | settings = s; |
36 | runwindow = new RunWindow( p, name, true, f ); | 36 | runwindow = new RunWindow( p, name, true, f ); |
37 | #ifdef OPROCESS | 37 | #ifdef OPROCESS |
38 | ipkgProcess = new OProcess(); | 38 | ipkgProcess = new OProcess(); |
39 | connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), | 39 | connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), |
40 | this, SLOT(getIpkgOutput(OProcess*,char*,int))); | 40 | this, SLOT(getIpkgOutput(OProcess*,char*,int))); |
41 | 41 | ||
42 | connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), | 42 | connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), |
43 | this, SLOT(getIpkgOutput(OProcess*,char*,int))); | 43 | this, SLOT(getIpkgOutput(OProcess*,char*,int))); |
44 | installDialog = 0; | 44 | installDialog = 0; |
45 | #endif | 45 | #endif |
46 | } | 46 | } |
47 | 47 | ||
48 | PmIpkg::~PmIpkg() | 48 | PmIpkg::~PmIpkg() |
49 | { | 49 | { |
50 | #ifdef OPROCESS | 50 | #ifdef OPROCESS |
51 | delete ipkgProcess; | 51 | delete ipkgProcess; |
52 | #endif | 52 | #endif |
53 | } | 53 | } |
54 | 54 | ||
55 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | 55 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) |
56 | { | 56 | { |
57 | bool ret=false; | 57 | bool ret=false; |
58 | QDir::setCurrent("/tmp"); | 58 | QDir::setCurrent("/tmp"); |
59 | QString cmd = "/usr/bin/ipkg "; | 59 | QString cmd = "/usr/bin/ipkg "; |
60 | #ifdef OPROCESS | 60 | #ifdef OPROCESS |
61 | ipkgProcess->clearArguments(); | 61 | ipkgProcess->clearArguments(); |
62 | *ipkgProcess << "/usr/bin/ipkg "; | 62 | *ipkgProcess << "/usr/bin/ipkg "; |
63 | QString cmd = ""; | 63 | cmd = ""; |
64 | #endif | 64 | #endif |
65 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 65 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
66 | if ( dest == "" ) | 66 | if ( dest == "" ) |
67 | cmd += " -dest "+settings->getDestinationName(); | 67 | cmd += " -dest "+settings->getDestinationName(); |
68 | else | 68 | else |
69 | cmd += " -dest "+ dest; | 69 | cmd += " -dest "+ dest; |
70 | 70 | ||
71 | cmd += " -force-defaults "; | 71 | cmd += " -force-defaults "; |
72 | 72 | ||
73 | if (installDialog && installDialog->_force_depends) | 73 | if (installDialog && installDialog->_force_depends) |
74 | { | 74 | { |
75 | if (installDialog->_force_depends->isChecked()) | 75 | if (installDialog->_force_depends->isChecked()) |
76 | cmd += " -force-depends "; | 76 | cmd += " -force-depends "; |
77 | if (installDialog->_force_reinstall->isChecked()) | 77 | if (installDialog->_force_reinstall->isChecked()) |
78 | cmd += " -force-reinstall "; | 78 | cmd += " -force-reinstall "; |
79 | if (installDialog->_force_remove->isChecked()) | 79 | if (installDialog->_force_remove->isChecked()) |
80 | cmd += " -force-removal-of-essential-packages "; | 80 | cmd += " -force-removal-of-essential-packages "; |
81 | } | 81 | } |
82 | 82 | ||
83 | out( "Starting to "+ args+"\n"); | 83 | out( "Starting to "+ args+"\n"); |
84 | cmd += args; | 84 | cmd += args; |
85 | out( "running:\n"+cmd+"\n" ); | 85 | out( "running:\n"+cmd+"\n" ); |
86 | pvDebug(2,"running:"+cmd); | 86 | pvDebug(2,"running:"+cmd); |
87 | #ifdef OPROCESS | 87 | #ifdef OPROCESS |
88 | *ipkgProcess << args; | 88 | *ipkgProcess << args; |
89 | out( "running:\n" + cmd); | 89 | out( "running:\n" + cmd); |
90 | *ipkgProcess << cmd; | 90 | *ipkgProcess << cmd; |
91 | 91 | ||
92 | //debug | 92 | //debug |
93 | ipkgProcess->clearArguments(); | 93 | ipkgProcess->clearArguments(); |
94 | *ipkgProcess << "/bin/ls "; | 94 | *ipkgProcess << "/bin/ls "; |
95 | //debug | 95 | //debug |
@@ -124,65 +124,66 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
124 | char line[130]; | 124 | char line[130]; |
125 | QString lineStr, lineStrOld; | 125 | QString lineStr, lineStrOld; |
126 | sleep(1); | 126 | sleep(1); |
127 | cmd +=" 2>&1"; | 127 | cmd +=" 2>&1"; |
128 | fp = popen( (const char *) cmd, "r"); | 128 | fp = popen( (const char *) cmd, "r"); |
129 | if ( fp == NULL ) { | 129 | if ( fp == NULL ) { |
130 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); | 130 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); |
131 | out("\nError while executing "+ cmd+"\n\n"); | 131 | out("\nError while executing "+ cmd+"\n\n"); |
132 | ret = false; | 132 | ret = false; |
133 | } else { | 133 | } else { |
134 | while ( fgets( line, sizeof line, fp) != NULL) | 134 | while ( fgets( line, sizeof line, fp) != NULL) |
135 | { | 135 | { |
136 | lineStr = line; | 136 | lineStr = line; |
137 | lineStr=lineStr.left(lineStr.length()-1); | 137 | lineStr=lineStr.left(lineStr.length()-1); |
138 | //Configuring opie-oipkg...Done | 138 | //Configuring opie-oipkg...Done |
139 | if (lineStr.contains("Done")) ret = true; | 139 | if (lineStr.contains("Done")) ret = true; |
140 | if (lineStr!=lineStrOld) | 140 | if (lineStr!=lineStrOld) |
141 | out(lineStr); | 141 | out(lineStr); |
142 | lineStrOld = lineStr; | 142 | lineStrOld = lineStr; |
143 | qApp->processEvents(); | 143 | qApp->processEvents(); |
144 | } | 144 | } |
145 | } | 145 | } |
146 | pclose(fp); | 146 | pclose(fp); |
147 | #endif | 147 | #endif |
148 | //out( "Finished!"); | 148 | //out( "Finished!"); |
149 | pvDebug(2,QString(ret?"success\n":"failure\n")); | 149 | pvDebug(2,QString(ret?"success\n":"failure\n")); |
150 | return ret; | 150 | return ret; |
151 | } | 151 | } |
152 | 152 | ||
153 | void PmIpkg::makeLinks(Package *pack) | 153 | void PmIpkg::makeLinks(Package *pack) |
154 | { | 154 | { |
155 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 155 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
156 | linkPackage( pack->name(), pack->dest() ); | 156 | QString pn = pack->name(); |
157 | linkPackage( pack->packageName(), pack->dest() ); | ||
157 | } | 158 | } |
158 | 159 | ||
159 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | 160 | QStringList* PmIpkg::getList( QString packFileName, QString d ) |
160 | { | 161 | { |
161 | QString dest = settings->getDestinationUrlByName( d ); | 162 | QString dest = settings->getDestinationUrlByName( d ); |
162 | dest = dest==""?d:dest; | 163 | dest = dest==""?d:dest; |
163 | if (dest == "/" ) return 0; | 164 | if (dest == "/" ) return 0; |
164 | { | 165 | { |
165 | Config cfg( "oipkg", Config::User ); | 166 | Config cfg( "oipkg", Config::User ); |
166 | cfg.setGroup( "Common" ); | 167 | cfg.setGroup( "Common" ); |
167 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 168 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
168 | } | 169 | } |
169 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; | 170 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
170 | QFile f( packFileName ); | 171 | QFile f( packFileName ); |
171 | if ( ! f.open(IO_ReadOnly) ) | 172 | if ( ! f.open(IO_ReadOnly) ) |
172 | { | 173 | { |
173 | pvDebug(1," Panik! Could not open"); | 174 | pvDebug(1," Panik! Could not open"); |
174 | out( "Panik!\n Could not open:\n"+packFileName ); | 175 | out( "Panik!\n Could not open:\n"+packFileName ); |
175 | return (QStringList*)0; | 176 | return (QStringList*)0; |
176 | } | 177 | } |
177 | QStringList *fileList = new QStringList(); | 178 | QStringList *fileList = new QStringList(); |
178 | QTextStream t( &f ); | 179 | QTextStream t( &f ); |
179 | while ( !t.eof() ) | 180 | while ( !t.eof() ) |
180 | { | 181 | { |
181 | *fileList += t.readLine(); | 182 | *fileList += t.readLine(); |
182 | } | 183 | } |
183 | return fileList; | 184 | return fileList; |
184 | } | 185 | } |
185 | 186 | ||
186 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | 187 | void PmIpkg::linkPackage( QString packFileName, QString dest ) |
187 | { | 188 | { |
188 | QStringList *fileList = getList( packFileName, dest ); | 189 | QStringList *fileList = getList( packFileName, dest ); |