summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/pmipkg.cpp
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp112
1 files changed, 38 insertions, 74 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index eae73ad..3b31b4d 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -10,3 +10,2 @@
#include <qpe/stringutil.h>
-#include <qpe/qcopenvelope_qws.h>
#include <qdir.h>
@@ -42,3 +41,3 @@ PmIpkg::~PmIpkg()
#define SYSTEM
-int PmIpkg::runIpkg(const QString& args)
+int PmIpkg::runIpkg(const QString& args, const QString& dest )
{
@@ -46,9 +45,2 @@ int PmIpkg::runIpkg(const QString& args)
- //to make script ipkg happy
- pvDebug(2, "cd "+settings->getDestinationUrl()+"/tmp/ipkg");
- if (!QDir::setCurrent(settings->getDestinationUrl()+"/tmp/ipkg"))
- {
- QDir instDir = QDir(settings->getDestinationUrl()+"/tmp/ipkg");
- instDir.mkdir(settings->getDestinationUrl()+"/tmp/ipkg");
- }
#ifdef PROC
@@ -59,3 +51,8 @@ int PmIpkg::runIpkg(const QString& args)
#endif
- cmd += " -dest "+settings->getDestinationName();
+ pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
+ if ( dest == "" )
+ cmd += " -dest "+settings->getDestinationName();
+ else
+ cmd += " -dest "+ dest;
+
cmd += " -force-defaults ";
@@ -64,3 +61,2 @@ int PmIpkg::runIpkg(const QString& args)
cmd += args;
- out( "running:<br>\n"+cmd+"<br>\n" );
int r = 0;
@@ -68,8 +64,10 @@ int PmIpkg::runIpkg(const QString& args)
QString o = "start";
- Process ipkg( cmd );
+ Process *ipkg = new Process( "ls");//cmd );
+ out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" );
QString description;
- ipkg.exec("",o);
- out( o );
+ ipkg->exec("",o);
+// out( o );
#endif
#ifdef SYSTEM
+ out( "running:<br>\n"+cmd+"<br>\n" );
QString redirect = "/tmp/oipkg.pipe";
@@ -82,3 +80,3 @@ int PmIpkg::runIpkg(const QString& args)
while ( ! f.open(IO_ReadOnly) ) {};
- {
+ // {
QTextStream t( &f );
@@ -88,6 +86,9 @@ int PmIpkg::runIpkg(const QString& args)
line = t.readLine();
- if ( line != oldLine ) out( line +"<br>" );
- oldLine = line;
+ if ( line != oldLine )
+ {
+ out( line +"<br>" );
+ oldLine = line;
+ }
}
- }
+// }
f.close();
@@ -99,8 +100,9 @@ int PmIpkg::runIpkg(const QString& args)
-void PmIpkg::makeLinks(QString pack)
+void PmIpkg::makeLinks(Package *pack)
{
- pvDebug( 2, "PmIpkg::makeLinks "+ pack);
+ pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
+ QString dest = settings->getDestinationUrlByName( pack->dest() );
+ if (dest == "/" ) return;
out( "<br>creating links<br>" );
- QString dest = settings->getDestinationUrl();
- out("for package "+pack+" in "+dest+"<br>");
+ out("for package "+pack->name()+" in "+dest+"<br>");
{
@@ -110,3 +112,3 @@ void PmIpkg::makeLinks(QString pack)
}
- QString fn = dest+"/"+statusDir+"/info/"+pack+".list";
+ QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list";
QFile f( fn );
@@ -115,2 +117,3 @@ void PmIpkg::makeLinks(QString pack)
out( "<b>Panik!</b> Could not open:<br>"+fn );
+ return;
};
@@ -128,4 +131,6 @@ void PmIpkg::processLinkDir( QString file, QString dest )
{
+ if ( dest == "???" ) return;
QString destFile = file;
file = dest+"/"+file;
+ if (file == dest) return;
QFileInfo fileInfo( file );
@@ -168,2 +173,3 @@ void PmIpkg::commit( PackageList pl )
QString inst="<b>To install:</b><br>\n";;
+ pl.allPackages();
for( Package *pack = pl.first();pack ; (pack = pl.next()) )
@@ -174,10 +180,5 @@ void PmIpkg::commit( PackageList pl )
{
- #ifndef NEWLIST
- to_install.append( pack->name() );
- #endif
- #ifdef NEWLIST
to_install.append( pack );
sizecount += pack->size().toInt();
- #endif
- inst += pack->name()+"<br>";
+ inst += pack->name()+"\t(on "+pack->dest()+")<br>";
}
@@ -185,9 +186,4 @@ void PmIpkg::commit( PackageList pl )
{
- #ifndef NEWLIST
- to_remove.append( pack->name() );
- #endif
- #ifdef NEWLIST
to_remove.append( pack );
sizecount += 1;
- #endif
rem += pack->name()+"<br>";
@@ -213,7 +209,2 @@ void PmIpkg::commit( PackageList pl )
runwindow->exec();
- // ##### If we looked in the list of files, we could send out accurate
- // ##### messages. But we don't bother yet, and just do an "all".
- QCopEnvelope e("QPE/System", "linkChanged(QString)");
- QString lf = QString::null;
- e << lf;
return;
@@ -235,14 +226,2 @@ void PmIpkg::remove()
- #ifndef NEWLIST
- for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it)
- {
- if ( runIpkg("remove " + *it) == 0)
- {
-
- }else{
- out("<b>"+tr("Error while removing")+"</b>"+*it);
- }
- }
-#endif
- #ifdef NEWLIST
for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
@@ -258,3 +237,2 @@ void PmIpkg::remove()
}
-#endif
}
@@ -267,22 +245,10 @@ void PmIpkg::install()
out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
- #ifndef NEWLIST
- for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it)
- {
- if ( runIpkg("install " + *it) == 0 )
- {
- if ( settings->createLinks() )
- makeLinks( *it );
- }else{
- out("<b>"+tr("Error while installing")+"</b>"+*it);
- }
- }
-#endif
- #ifdef NEWLIST
- for (Package *it=to_install.first(); it != 0; it=to_install.next() )
+ for (Package *it=to_install.first(); it != 0; it=to_install.next() )
{
- if ( runIpkg("install " + it->name()) == 0 )
+
+ if ( runIpkg("install " + it->name(), it->dest() ) == 0 )
{
runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
- if ( settings->createLinks() )
- makeLinks( it->name() );
+ if ( it->link() )
+ makeLinks( it );
it->processed();
@@ -292,3 +258,2 @@ void PmIpkg::install()
}
-#endif
}
@@ -296,3 +261,2 @@ void PmIpkg::install()
void PmIpkg::linkDestination( const QString msg, const QByteArray dest )
-// add 3rd package parameter
{
@@ -347,6 +311,6 @@ void PmIpkg::show(bool b)
showButtons(b);
-// if ( b )
+ if ( b )
runwindow->progress->hide();
-// else
-// runwindow->progress->show();
+ else
+ runwindow->progress->show();
}