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
@@ -58,24 +58,25 @@ PmIpkg::~PmIpkg()
58{ 58{
59#ifdef OPROCESS 59#ifdef OPROCESS
60 delete ipkgProcess; 60 delete ipkgProcess;
61#endif 61#endif
62} 62}
63 63
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 == "" )
76 cmd += " -dest "+settings->getDestinationName(); 77 cmd += " -dest "+settings->getDestinationName();
77 else 78 else
78 cmd += " -dest "+ dest; 79 cmd += " -dest "+ dest;
79 80
80 cmd += " -force-defaults "; 81 cmd += " -force-defaults ";
81 82
@@ -90,24 +91,26 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest )
90 } 91 }
91 92
92 out( "Starting to "+ args+"\n"); 93 out( "Starting to "+ args+"\n");
93 cmd += args; 94 cmd += args;
94 out( "running:\n"+cmd+"\n" ); 95 out( "running:\n"+cmd+"\n" );
95 pvDebug(2,"running:"+cmd); 96 pvDebug(2,"running:"+cmd);
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 )
108 { 111 {
109 out( *it ); 112 out( *it );
110 cmd += *it; 113 cmd += *it;
111 } 114 }
112 115
113 pvDebug(2,"running:"+cmd); 116 pvDebug(2,"running:"+cmd);
@@ -161,49 +164,57 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest )
161 164
162void PmIpkg::makeLinks(Package *pack) 165void PmIpkg::makeLinks(Package *pack)
163{ 166{
164 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 167 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
165 QString pn = pack->name(); 168 QString pn = pack->name();
166 linkPackage( pack->packageName(), pack->dest() ); 169 linkPackage( pack->packageName(), pack->dest() );
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 )
204{ 215{
205 if (!fileList) return; 216 if (!fileList) return;
206 for (uint i=0; i < fileList->count(); i++) 217 for (uint i=0; i < fileList->count(); i++)
207 { 218 {
208 QString dest = settings->getDestinationUrlByName( d ); 219 QString dest = settings->getDestinationUrlByName( d );
209 dest = dest==""?d:dest; 220 dest = dest==""?d:dest;