author | tille <tille> | 2002-06-21 12:44:34 (UTC) |
---|---|---|
committer | tille <tille> | 2002-06-21 12:44:34 (UTC) |
commit | e6834009bf23492e009258e3881ce183cf9e27a0 (patch) (unidiff) | |
tree | ba5fb74b2ee5e70b5157cd5eb935f8760c5b208d /noncore/unsupported/oipkg/pmipkg.cpp | |
parent | 3be39e6c8af27a43d4b09bf08b4c739c342b5de3 (diff) | |
download | opie-e6834009bf23492e009258e3881ce183cf9e27a0.zip opie-e6834009bf23492e009258e3881ce183cf9e27a0.tar.gz opie-e6834009bf23492e009258e3881ce183cf9e27a0.tar.bz2 |
fixes
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 | |||
@@ -3,9 +3,7 @@ | |||
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> |
@@ -29,6 +27,8 @@ | |||
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 | { |
@@ -126,25 +126,24 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
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")); |
@@ -234,15 +233,15 @@ void PmIpkg::processLinkDir( QString file, QString dest ) | |||
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 ); |
@@ -353,6 +352,20 @@ void PmIpkg::install() | |||
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()); |