summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/pmipkg.cpp
authortille <tille>2002-07-01 13:31:20 (UTC)
committer tille <tille>2002-07-01 13:31:20 (UTC)
commit1f42fc6dd4ef09b5a9526e81784ab3d05b9300b1 (patch) (unidiff)
treeeaf5284b3841c247c9f048e6c529053ca9ded412 /noncore/unsupported/oipkg/pmipkg.cpp
parent346ea8fa0d904e940659bc35fad0fc0da8cc7f80 (diff)
downloadopie-1f42fc6dd4ef09b5a9526e81784ab3d05b9300b1.zip
opie-1f42fc6dd4ef09b5a9526e81784ab3d05b9300b1.tar.gz
opie-1f42fc6dd4ef09b5a9526e81784ab3d05b9300b1.tar.bz2
cosmetics
Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index de1f162..4a8a389 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -64,12 +64,13 @@ PmIpkg::~PmIpkg()
64bool PmIpkg::runIpkg(const QString& args, const QString& dest ) 64bool PmIpkg::runIpkg(const QString& args, const QString& dest )
65{ 65{
66 bool ret=false; 66 bool ret=false;
67 QDir::setCurrent("/tmp"); 67 QDir::setCurrent("/tmp");
68 QString cmd = "/usr/bin/ipkg "; 68 QString cmd = "/usr/bin/ipkg ";
69#ifdef OPROCESS 69#ifdef OPROCESS
70 ipkgProcess->kill();
70 ipkgProcess->clearArguments(); 71 ipkgProcess->clearArguments();
71 *ipkgProcess << "/usr/bin/ipkg "; 72 *ipkgProcess << "/usr/bin/ipkg ";
72 cmd = ""; 73 cmd = "";
73#endif 74#endif
74 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); 75 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
75 if ( dest == "" ) 76 if ( dest == "" )
@@ -96,12 +97,14 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest )
96#ifdef OPROCESS 97#ifdef OPROCESS
97 *ipkgProcess << args; 98 *ipkgProcess << args;
98 out( "running:\n" + cmd); 99 out( "running:\n" + cmd);
99 *ipkgProcess << cmd; 100 *ipkgProcess << cmd;
100 101
101//debug 102//debug
103 delete ipkgProcess;
104 ipkgProcess = new OProcess();
102 ipkgProcess->clearArguments(); 105 ipkgProcess->clearArguments();
103 *ipkgProcess << "/bin/ls "; 106 *ipkgProcess << "/bin/ls ";
104//debug 107//debug
105 QValueList<QCString> a = ipkgProcess->args(); 108 QValueList<QCString> a = ipkgProcess->args();
106 QValueList<QCString>::Iterator it; 109 QValueList<QCString>::Iterator it;
107 for( it = a.begin(); it != a.end(); ++it ) 110 for( it = a.begin(); it != a.end(); ++it )
@@ -167,37 +170,45 @@ void PmIpkg::makeLinks(Package *pack)
167} 170}
168 171
169QStringList* PmIpkg::getList( QString packFileName, QString d ) 172QStringList* PmIpkg::getList( QString packFileName, QString d )
170{ 173{
171 QString dest = settings->getDestinationUrlByName( d ); 174 QString dest = settings->getDestinationUrlByName( d );
172 dest = dest==""?d:dest; 175 dest = dest==""?d:dest;
173 if (dest == "/" ) return 0; 176 // if (dest == "/" ) return 0;
174 { 177 {
175 Config cfg( "oipkg", Config::User ); 178 Config cfg( "oipkg", Config::User );
176 cfg.setGroup( "Common" ); 179 cfg.setGroup( "Common" );
177 QString statusDir = cfg.readEntry( "statusDir", "" ); 180 QString statusDir = cfg.readEntry( "statusDir", "" );
178 } 181 }
179 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; 182 QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list";
180 QFile f( packFileName ); 183 QFile f( packFileName );
181 if ( ! f.open(IO_ReadOnly) ) 184 if ( ! f.open(IO_ReadOnly) )
182 { 185 {
183 pvDebug(1," Panik! Could not open"); 186 out( "Could not open:\n"+packFileDir );
184 out( "Panik!\n Could not open:\n"+packFileName ); 187 f.close();
185 return (QStringList*)0; 188 packFileDir = "/"+statusDir+"/info/"+packFileName+".list";
189 f.setName( packFileDir );
190 if ( ! f.open(IO_ReadOnly) )
191 {
192 qDebug(" Panik! Could not open"+packFileDir);
193 out( "Could not open:\n"+packFileDir+"\n Panik!" );
194 }
186 } 195 }
187 QStringList *fileList = new QStringList(); 196 QStringList *fileList = new QStringList();
188 QTextStream t( &f ); 197 QTextStream t( &f );
189 while ( !t.eof() ) 198 while ( !t.eof() )
190 { 199 {
191 *fileList += t.readLine(); 200 *fileList += t.readLine();
192 } 201 }
202 f.close();
193 return fileList; 203 return fileList;
194} 204}
195 205
196void PmIpkg::linkPackage( QString packFileName, QString dest ) 206void PmIpkg::linkPackage( QString packFileName, QString dest )
197{ 207{
208 if (dest == "root" || dest == "/" ) return;
198 QStringList *fileList = getList( packFileName, dest ); 209 QStringList *fileList = getList( packFileName, dest );
199 processFileList( fileList, dest ); 210 processFileList( fileList, dest );
200 delete fileList; 211 delete fileList;
201} 212}
202 213
203void PmIpkg::processFileList( QStringList *fileList, QString d ) 214void PmIpkg::processFileList( QStringList *fileList, QString d )