summaryrefslogtreecommitdiff
path: root/noncore
authortille <tille>2002-07-05 12:05:38 (UTC)
committer tille <tille>2002-07-05 12:05:38 (UTC)
commita332e5e111b0c9ef8eb0836876a4ff386c660514 (patch) (side-by-side diff)
treefe327e0daace261a53d69a28c99355d63ce9012a /noncore
parent1ba879b2be7ad4ae390a351922bd476474d5dce7 (diff)
downloadopie-a332e5e111b0c9ef8eb0836876a4ff386c660514.zip
opie-a332e5e111b0c9ef8eb0836876a4ff386c660514.tar.gz
opie-a332e5e111b0c9ef8eb0836876a4ff386c660514.tar.bz2
fixed linking bug
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 4a8a389..d29036b 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -87,203 +87,206 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest )
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() )
{
out(".");
pvDebug(7,"wait for oprocess to terminate");
qApp->processEvents();
};
#else
qApp->processEvents();
FILE *fp;
char line[130];
QString lineStr, lineStrOld;
sleep(1);
cmd +=" 2>&1";
fp = popen( (const char *) cmd, "r");
if ( fp == NULL ) {
qDebug("Could not execute '" + cmd + "'! err=%d", fp);
out("\nError while executing "+ cmd+"\n\n");
ret = false;
} else {
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!=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;
{
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Common" );
QString statusDir = cfg.readEntry( "statusDir", "" );
}
QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list";
- QFile f( packFileName );
+ QFile f( packFileDir );
+ qDebug("Try to open %s", packFileDir.latin1());
if ( ! f.open(IO_ReadOnly) )
{
out( "Could not open:\n"+packFileDir );
f.close();
packFileDir = "/"+statusDir+"/info/"+packFileName+".list";
f.setName( packFileDir );
+ qDebug("Try to open %s", packFileDir.latin1());
if ( ! f.open(IO_ReadOnly) )
{
qDebug(" Panik! Could not open"+packFileDir);
out( "Could not open:\n"+packFileDir+"\n Panik!" );
+ return (QStringList*)0;
}
}
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;
file = dest+"/"+file;
if (file == dest) return;
// if (linkOpp==createLink) out( "\ncreating links\n" );
// if (linkOpp==removeLink) out( "\nremoving links\n" );
QFileInfo fileInfo( file );
if ( fileInfo.isDir() )
{
pvDebug(4, "process dir "+file);
QDir destDir( destFile );
if (linkOpp==createLink) destDir.mkdir( destFile, true );
QDir d( file );
// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) )
{
pvDebug(4, "processLinkDir "+fi->absFilePath());
processLinkDir( fi->absFilePath(), dest );
++it;
}
} else
if ( fileInfo.isFile() )
{
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).latin1());
if( linkOpp==removeLink )
{
QFileInfo toRemoveLink( destFile );
if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
{
pvDebug(4,"removing "+destFile+" no "+file);
unlink( linkFile );
}
}
}
}
void PmIpkg::loadList( PackageList *pl )
{
for( Package *pack = pl->first();pack ; (pack = pl->next()) )
{
if ( pack && (pack->name() != "") && pack)
{
if ( pack->toInstall() )
to_install.append( pack );
if ( pack->toRemove() )
to_remove.append( pack );
}
}