author | tille <tille> | 2002-06-21 12:44:34 (UTC) |
---|---|---|
committer | tille <tille> | 2002-06-21 12:44:34 (UTC) |
commit | e6834009bf23492e009258e3881ce183cf9e27a0 (patch) (side-by-side diff) | |
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 @@ -1,14 +1,12 @@ #include "pmipkg.h" #include "pksettings.h" #include "package.h" #include "packagelistitem.h" -//#infdef OPROCESS #include <opie/oprocess.h> -//#endif #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/stringutil.h> #include <qpe/qpeapplication.h> #include <qdir.h> #include <qfile.h> @@ -26,12 +24,14 @@ #include <stdlib.h> #include <unistd.h> #include "mainwindow.h" +//#define OPROCESS + PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) : QObject ( p ) { settings = s; runwindow = new RunWindow( p, name, true, f ); #ifdef OPROCESS @@ -123,31 +123,30 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) FILE *fp; char line[130]; QString lineStr, lineStrOld; sleep(1); cmd +=" 2>&1"; fp = popen( (const char *) cmd, "r"); - if ( !fp ) { + if ( fp == NULL ) { qDebug("Could not execute '" + cmd + "'! err=%d", fp); - pclose(fp); out("\nError while executing "+ cmd+"\n\n"); - return false; + ret = false; } else { - while ( fgets( line, sizeof line, fp)) { + while ( fgets( line, sizeof line, fp) != NULL) + { lineStr = line; lineStr=lineStr.left(lineStr.length()-1); //Configuring opie-oipkg...Done - if (lineStr.contains("Done")) - ret = true; + if (lineStr.contains("Done")) ret = true; if (lineStr!=lineStrOld) out(lineStr); lineStrOld = lineStr; qApp->processEvents(); } - pclose(fp); } + pclose(fp); #endif //out( "Finished!"); pvDebug(2,QString(ret?"success\n":"failure\n")); return ret; } @@ -231,21 +230,21 @@ void PmIpkg::processLinkDir( QString file, QString dest ) processLinkDir( fi->absFilePath(), dest ); ++it; } } else if ( fileInfo.isFile() ) { - const char *instFile = strdup( (file).ascii() ); - const char *linkFile = strdup( (destFile).ascii()); + const char *instFile = strdup( (file).latin1() ); + const char *linkFile = strdup( (destFile).latin1()); if( linkOpp==createLink ) { pvDebug(4, "linking: "+file+" -> "+destFile ); symlink( instFile, linkFile ); } } else { - const char *linkFile = strdup( (destFile).ascii()); + const char *linkFile = strdup( (destFile).latin1()); if( linkOpp==removeLink ) { QFileInfo toRemoveLink( destFile ); if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) { pvDebug(4,"removing "+destFile+" no "+file); @@ -350,12 +349,26 @@ void PmIpkg::install() { if ( to_install.count() == 0 ) return; out(tr("Installing")+"\n"+tr("please wait")+"\n"); for (uint i=0; i < to_install.count(); i++) { qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug + if (to_install.at(i)->link()) + { + // hack to have package.list + // in "dest"/usr/lib/ipkg/info/ + QString rds = settings->getDestinationUrlByName("root"); + QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest()); + QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list"; + rds += listFile; + lds += listFile; + const char *rd = rds.latin1(); + const char *ld = lds.latin1(); + pvDebug(4, "linking: "+rds+" -> "+lds ); + symlink( rd, ld ); + } if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) { runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); to_install.at(i)->processed(); linkOpp = createLink; if ( to_install.at(i)->link() ) |