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) (side-by-side diff)
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
@@ -46,80 +46,83 @@ PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlag
#ifdef OPROCESS
ipkgProcess = new OProcess();
connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)),
this, SLOT(getIpkgOutput(OProcess*,char*,int)));
connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)),
this, SLOT(getIpkgOutput(OProcess*,char*,int)));
installDialog = 0;
#endif
}
PmIpkg::~PmIpkg()
{
#ifdef OPROCESS
delete ipkgProcess;
#endif
}
bool PmIpkg::runIpkg(const QString& args, const QString& dest )
{
bool ret=false;
QDir::setCurrent("/tmp");
QString cmd = "/usr/bin/ipkg ";
#ifdef OPROCESS
+ ipkgProcess->kill();
ipkgProcess->clearArguments();
*ipkgProcess << "/usr/bin/ipkg ";
cmd = "";
#endif
pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
if ( dest == "" )
cmd += " -dest "+settings->getDestinationName();
else
cmd += " -dest "+ dest;
cmd += " -force-defaults ";
if (installDialog && installDialog->_force_depends)
{
if (installDialog->_force_depends->isChecked())
cmd += " -force-depends ";
if (installDialog->_force_reinstall->isChecked())
cmd += " -force-reinstall ";
if (installDialog->_force_remove->isChecked())
cmd += " -force-removal-of-essential-packages ";
}
out( "Starting to "+ args+"\n");
cmd += args;
out( "running:\n"+cmd+"\n" );
pvDebug(2,"running:"+cmd);
#ifdef OPROCESS
*ipkgProcess << args;
out( "running:\n" + cmd);
*ipkgProcess << cmd;
//debug
+ delete ipkgProcess;
+ ipkgProcess = new OProcess();
ipkgProcess->clearArguments();
*ipkgProcess << "/bin/ls ";
//debug
QValueList<QCString> a = ipkgProcess->args();
QValueList<QCString>::Iterator it;
for( it = a.begin(); it != a.end(); ++it )
{
out( *it );
cmd += *it;
}
pvDebug(2,"running:"+cmd);
qApp->processEvents();
// sleep(1);
ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput);
if ( !ret ) {
pvDebug(2,"Could not execute '" + cmd);
out("\nError while executing "+ cmd+"\n\n");
out("\nError while executing\n\n");
// return false;
}
while ( ipkgProcess->isRunning() )
{
@@ -149,73 +152,81 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest )
if (lineStr!=lineStrOld)
out(lineStr);
lineStrOld = lineStr;
qApp->processEvents();
}
}
pclose(fp);
#endif
//out( "Finished!");
pvDebug(2,QString(ret?"success\n":"failure\n"));
return ret;
}
void PmIpkg::makeLinks(Package *pack)
{
pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
QString pn = pack->name();
linkPackage( pack->packageName(), pack->dest() );
}
QStringList* PmIpkg::getList( QString packFileName, QString d )
{
QString dest = settings->getDestinationUrlByName( d );
dest = dest==""?d:dest;
- if (dest == "/" ) return 0;
+ // if (dest == "/" ) return 0;
{
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Common" );
QString statusDir = cfg.readEntry( "statusDir", "" );
}
- packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list";
+ QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list";
QFile f( packFileName );
if ( ! f.open(IO_ReadOnly) )
{
- pvDebug(1," Panik! Could not open");
- out( "Panik!\n Could not open:\n"+packFileName );
- return (QStringList*)0;
+ out( "Could not open:\n"+packFileDir );
+ f.close();
+ packFileDir = "/"+statusDir+"/info/"+packFileName+".list";
+ f.setName( packFileDir );
+ if ( ! f.open(IO_ReadOnly) )
+ {
+ qDebug(" Panik! Could not open"+packFileDir);
+ out( "Could not open:\n"+packFileDir+"\n Panik!" );
+ }
}
QStringList *fileList = new QStringList();
QTextStream t( &f );
while ( !t.eof() )
{
*fileList += t.readLine();
}
+ f.close();
return fileList;
}
void PmIpkg::linkPackage( QString packFileName, QString dest )
{
+ if (dest == "root" || dest == "/" ) return;
QStringList *fileList = getList( packFileName, dest );
processFileList( fileList, dest );
delete fileList;
}
void PmIpkg::processFileList( QStringList *fileList, QString d )
{
if (!fileList) return;
for (uint i=0; i < fileList->count(); i++)
{
QString dest = settings->getDestinationUrlByName( d );
dest = dest==""?d:dest;
processLinkDir( (*fileList)[i], dest );
}
}
void PmIpkg::processLinkDir( QString file, QString dest )
{
pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest);
if (linkOpp==createLink) pvDebug( 4,"opp: createLink");
if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink");
if ( dest == "???" || dest == "" ) return;
QString destFile = file;