Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 0817247..7d0e246 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,14 +1,12 @@ | |||
1 | #include "pmipkg.h" | 1 | #include "pmipkg.h" |
2 | #include "pksettings.h" | 2 | #include "pksettings.h" |
3 | #include "package.h" | 3 | #include "package.h" |
4 | #include "packagelistitem.h" | 4 | #include "packagelistitem.h" |
5 | 5 | ||
6 | //#infdef OPROCESS | ||
7 | #include <opie/oprocess.h> | 6 | #include <opie/oprocess.h> |
8 | //#endif | ||
9 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
10 | #include <qpe/config.h> | 8 | #include <qpe/config.h> |
11 | #include <qpe/stringutil.h> | 9 | #include <qpe/stringutil.h> |
12 | #include <qpe/qpeapplication.h> | 10 | #include <qpe/qpeapplication.h> |
13 | #include <qdir.h> | 11 | #include <qdir.h> |
14 | #include <qfile.h> | 12 | #include <qfile.h> |
@@ -26,12 +24,14 @@ | |||
26 | #include <stdlib.h> | 24 | #include <stdlib.h> |
27 | #include <unistd.h> | 25 | #include <unistd.h> |
28 | 26 | ||
29 | #include "mainwindow.h" | 27 | #include "mainwindow.h" |
30 | 28 | ||
31 | 29 | ||
30 | //#define OPROCESS | ||
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 |
@@ -123,31 +123,30 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
123 | FILE *fp; | 123 | FILE *fp; |
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 ) { | 129 | if ( fp == NULL ) { |
130 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); | 130 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); |
131 | pclose(fp); | ||
132 | out("\nError while executing "+ cmd+"\n\n"); | 131 | out("\nError while executing "+ cmd+"\n\n"); |
133 | return false; | 132 | ret = false; |
134 | } else { | 133 | } else { |
135 | while ( fgets( line, sizeof line, fp)) { | 134 | while ( fgets( line, sizeof line, fp) != NULL) |
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")) | 139 | if (lineStr.contains("Done")) ret = true; |
140 | ret = true; | ||
141 | if (lineStr!=lineStrOld) | 140 | if (lineStr!=lineStrOld) |
142 | out(lineStr); | 141 | out(lineStr); |
143 | lineStrOld = lineStr; | 142 | lineStrOld = lineStr; |
144 | qApp->processEvents(); | 143 | qApp->processEvents(); |
145 | } | 144 | } |
146 | pclose(fp); | ||
147 | } | 145 | } |
146 | pclose(fp); | ||
148 | #endif | 147 | #endif |
149 | //out( "Finished!"); | 148 | //out( "Finished!"); |
150 | pvDebug(2,QString(ret?"success\n":"failure\n")); | 149 | pvDebug(2,QString(ret?"success\n":"failure\n")); |
151 | return ret; | 150 | return ret; |
152 | } | 151 | } |
153 | 152 | ||
@@ -231,21 +230,21 @@ void PmIpkg::processLinkDir( QString file, QString dest ) | |||
231 | processLinkDir( fi->absFilePath(), dest ); | 230 | processLinkDir( fi->absFilePath(), dest ); |
232 | ++it; | 231 | ++it; |
233 | } | 232 | } |
234 | } else | 233 | } else |
235 | if ( fileInfo.isFile() ) | 234 | if ( fileInfo.isFile() ) |
236 | { | 235 | { |
237 | const char *instFile = strdup( (file).ascii() ); | 236 | const char *instFile = strdup( (file).latin1() ); |
238 | const char *linkFile = strdup( (destFile).ascii()); | 237 | const char *linkFile = strdup( (destFile).latin1()); |
239 | if( linkOpp==createLink ) | 238 | if( linkOpp==createLink ) |
240 | { | 239 | { |
241 | pvDebug(4, "linking: "+file+" -> "+destFile ); | 240 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
242 | symlink( instFile, linkFile ); | 241 | symlink( instFile, linkFile ); |
243 | } | 242 | } |
244 | } else { | 243 | } else { |
245 | const char *linkFile = strdup( (destFile).ascii()); | 244 | const char *linkFile = strdup( (destFile).latin1()); |
246 | if( linkOpp==removeLink ) | 245 | if( linkOpp==removeLink ) |
247 | { | 246 | { |
248 | QFileInfo toRemoveLink( destFile ); | 247 | QFileInfo toRemoveLink( destFile ); |
249 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | 248 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) |
250 | { | 249 | { |
251 | pvDebug(4,"removing "+destFile+" no "+file); | 250 | pvDebug(4,"removing "+destFile+" no "+file); |
@@ -350,12 +349,26 @@ void PmIpkg::install() | |||
350 | { | 349 | { |
351 | if ( to_install.count() == 0 ) return; | 350 | if ( to_install.count() == 0 ) return; |
352 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); | 351 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); |
353 | for (uint i=0; i < to_install.count(); i++) | 352 | for (uint i=0; i < to_install.count(); i++) |
354 | { | 353 | { |
355 | qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug | 354 | qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug |
355 | if (to_install.at(i)->link()) | ||
356 | { | ||
357 | // hack to have package.list | ||
358 | // in "dest"/usr/lib/ipkg/info/ | ||
359 | QString rds = settings->getDestinationUrlByName("root"); | ||
360 | QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest()); | ||
361 | QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list"; | ||
362 | rds += listFile; | ||
363 | lds += listFile; | ||
364 | const char *rd = rds.latin1(); | ||
365 | const char *ld = lds.latin1(); | ||
366 | pvDebug(4, "linking: "+rds+" -> "+lds ); | ||
367 | symlink( rd, ld ); | ||
368 | } | ||
356 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) | 369 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) |
357 | { | 370 | { |
358 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); | 371 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); |
359 | to_install.at(i)->processed(); | 372 | to_install.at(i)->processed(); |
360 | linkOpp = createLink; | 373 | linkOpp = createLink; |
361 | if ( to_install.at(i)->link() ) | 374 | if ( to_install.at(i)->link() ) |