summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/pmipkg.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp112
1 files changed, 38 insertions, 74 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index eae73ad..3b31b4d 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -10,3 +10,2 @@
10#include <qpe/stringutil.h> 10#include <qpe/stringutil.h>
11#include <qpe/qcopenvelope_qws.h>
12#include <qdir.h> 11#include <qdir.h>
@@ -42,3 +41,3 @@ PmIpkg::~PmIpkg()
42#define SYSTEM 41#define SYSTEM
43int PmIpkg::runIpkg(const QString& args) 42int PmIpkg::runIpkg(const QString& args, const QString& dest )
44{ 43{
@@ -46,9 +45,2 @@ int PmIpkg::runIpkg(const QString& args)
46 45
47 //to make script ipkg happy
48 pvDebug(2, "cd "+settings->getDestinationUrl()+"/tmp/ipkg");
49 if (!QDir::setCurrent(settings->getDestinationUrl()+"/tmp/ipkg"))
50 {
51 QDir instDir = QDir(settings->getDestinationUrl()+"/tmp/ipkg");
52 instDir.mkdir(settings->getDestinationUrl()+"/tmp/ipkg");
53 }
54#ifdef PROC 46#ifdef PROC
@@ -59,3 +51,8 @@ int PmIpkg::runIpkg(const QString& args)
59#endif 51#endif
60 cmd += " -dest "+settings->getDestinationName(); 52 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
53 if ( dest == "" )
54 cmd += " -dest "+settings->getDestinationName();
55 else
56 cmd += " -dest "+ dest;
57
61 cmd += " -force-defaults "; 58 cmd += " -force-defaults ";
@@ -64,3 +61,2 @@ int PmIpkg::runIpkg(const QString& args)
64 cmd += args; 61 cmd += args;
65 out( "running:<br>\n"+cmd+"<br>\n" );
66 int r = 0; 62 int r = 0;
@@ -68,8 +64,10 @@ int PmIpkg::runIpkg(const QString& args)
68 QString o = "start"; 64 QString o = "start";
69 Process ipkg( cmd ); 65 Process *ipkg = new Process( "ls");//cmd );
66 out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" );
70 QString description; 67 QString description;
71 ipkg.exec("",o); 68 ipkg->exec("",o);
72 out( o ); 69// out( o );
73#endif 70#endif
74#ifdef SYSTEM 71#ifdef SYSTEM
72 out( "running:<br>\n"+cmd+"<br>\n" );
75 QString redirect = "/tmp/oipkg.pipe"; 73 QString redirect = "/tmp/oipkg.pipe";
@@ -82,3 +80,3 @@ int PmIpkg::runIpkg(const QString& args)
82 while ( ! f.open(IO_ReadOnly) ) {}; 80 while ( ! f.open(IO_ReadOnly) ) {};
83 { 81 // {
84 QTextStream t( &f ); 82 QTextStream t( &f );
@@ -88,6 +86,9 @@ int PmIpkg::runIpkg(const QString& args)
88 line = t.readLine(); 86 line = t.readLine();
89 if ( line != oldLine ) out( line +"<br>" ); 87 if ( line != oldLine )
90 oldLine = line; 88 {
89 out( line +"<br>" );
90 oldLine = line;
91 }
91 } 92 }
92 } 93// }
93 f.close(); 94 f.close();
@@ -99,8 +100,9 @@ int PmIpkg::runIpkg(const QString& args)
99 100
100void PmIpkg::makeLinks(QString pack) 101void PmIpkg::makeLinks(Package *pack)
101{ 102{
102 pvDebug( 2, "PmIpkg::makeLinks "+ pack); 103 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
104 QString dest = settings->getDestinationUrlByName( pack->dest() );
105 if (dest == "/" ) return;
103 out( "<br>creating links<br>" ); 106 out( "<br>creating links<br>" );
104 QString dest = settings->getDestinationUrl(); 107 out("for package "+pack->name()+" in "+dest+"<br>");
105 out("for package "+pack+" in "+dest+"<br>");
106 { 108 {
@@ -110,3 +112,3 @@ void PmIpkg::makeLinks(QString pack)
110 } 112 }
111 QString fn = dest+"/"+statusDir+"/info/"+pack+".list"; 113 QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list";
112 QFile f( fn ); 114 QFile f( fn );
@@ -115,2 +117,3 @@ void PmIpkg::makeLinks(QString pack)
115 out( "<b>Panik!</b> Could not open:<br>"+fn ); 117 out( "<b>Panik!</b> Could not open:<br>"+fn );
118 return;
116 }; 119 };
@@ -128,4 +131,6 @@ void PmIpkg::processLinkDir( QString file, QString dest )
128{ 131{
132 if ( dest == "???" ) return;
129 QString destFile = file; 133 QString destFile = file;
130 file = dest+"/"+file; 134 file = dest+"/"+file;
135 if (file == dest) return;
131 QFileInfo fileInfo( file ); 136 QFileInfo fileInfo( file );
@@ -168,2 +173,3 @@ void PmIpkg::commit( PackageList pl )
168 QString inst="<b>To install:</b><br>\n";; 173 QString inst="<b>To install:</b><br>\n";;
174 pl.allPackages();
169 for( Package *pack = pl.first();pack ; (pack = pl.next()) ) 175 for( Package *pack = pl.first();pack ; (pack = pl.next()) )
@@ -174,10 +180,5 @@ void PmIpkg::commit( PackageList pl )
174 { 180 {
175 #ifndef NEWLIST
176 to_install.append( pack->name() );
177 #endif
178 #ifdef NEWLIST
179 to_install.append( pack ); 181 to_install.append( pack );
180 sizecount += pack->size().toInt(); 182 sizecount += pack->size().toInt();
181 #endif 183 inst += pack->name()+"\t(on "+pack->dest()+")<br>";
182 inst += pack->name()+"<br>";
183 } 184 }
@@ -185,9 +186,4 @@ void PmIpkg::commit( PackageList pl )
185 { 186 {
186 #ifndef NEWLIST
187 to_remove.append( pack->name() );
188 #endif
189 #ifdef NEWLIST
190 to_remove.append( pack ); 187 to_remove.append( pack );
191 sizecount += 1; 188 sizecount += 1;
192 #endif
193 rem += pack->name()+"<br>"; 189 rem += pack->name()+"<br>";
@@ -213,7 +209,2 @@ void PmIpkg::commit( PackageList pl )
213 runwindow->exec(); 209 runwindow->exec();
214 // ##### If we looked in the list of files, we could send out accurate
215 // ##### messages. But we don't bother yet, and just do an "all".
216 QCopEnvelope e("QPE/System", "linkChanged(QString)");
217 QString lf = QString::null;
218 e << lf;
219 return; 210 return;
@@ -235,14 +226,2 @@ void PmIpkg::remove()
235 226
236 #ifndef NEWLIST
237 for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it)
238 {
239 if ( runIpkg("remove " + *it) == 0)
240 {
241
242 }else{
243 out("<b>"+tr("Error while removing")+"</b>"+*it);
244 }
245 }
246#endif
247 #ifdef NEWLIST
248 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 227 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
@@ -258,3 +237,2 @@ void PmIpkg::remove()
258 } 237 }
259#endif
260} 238}
@@ -267,22 +245,10 @@ void PmIpkg::install()
267 out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); 245 out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
268 #ifndef NEWLIST 246 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
269 for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it)
270 {
271 if ( runIpkg("install " + *it) == 0 )
272 {
273 if ( settings->createLinks() )
274 makeLinks( *it );
275 }else{
276 out("<b>"+tr("Error while installing")+"</b>"+*it);
277 }
278 }
279#endif
280 #ifdef NEWLIST
281 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
282 { 247 {
283 if ( runIpkg("install " + it->name()) == 0 ) 248
249 if ( runIpkg("install " + it->name(), it->dest() ) == 0 )
284 { 250 {
285 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); 251 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
286 if ( settings->createLinks() ) 252 if ( it->link() )
287 makeLinks( it->name() ); 253 makeLinks( it );
288 it->processed(); 254 it->processed();
@@ -292,3 +258,2 @@ void PmIpkg::install()
292 } 258 }
293#endif
294} 259}
@@ -296,3 +261,2 @@ void PmIpkg::install()
296void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) 261void PmIpkg::linkDestination( const QString msg, const QByteArray dest )
297// add 3rd package parameter
298{ 262{
@@ -347,6 +311,6 @@ void PmIpkg::show(bool b)
347 showButtons(b); 311 showButtons(b);
348 //if ( b ) 312 if ( b )
349 runwindow->progress->hide(); 313 runwindow->progress->hide();
350// else 314 else
351 // runwindow->progress->show(); 315 runwindow->progress->show();
352} 316}