summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/pmipkg.cpp
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp69
1 files changed, 62 insertions, 7 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index b23b9ea..eae73ad 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -34,24 +34,32 @@ PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlag
runwindow = new RunWindow( p, name, true, f );
}
PmIpkg::~PmIpkg()
{
}
//#define PROC
#define SYSTEM
int PmIpkg::runIpkg(const QString& args)
{
pvDebug(2,"PmIpkg::runIpkg "+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
QStringList cmd = "/usr/bin/ipkg ";
#endif
#ifdef SYSTEM
QString cmd = "/usr/bin/ipkg ";
#endif
cmd += " -dest "+settings->getDestinationName();
cmd += " -force-defaults ";
out( "<hr><br>Starting to "+ args+"<br>\n");
cmd += args;
out( "running:<br>\n"+cmd+"<br>\n" );
@@ -144,47 +152,64 @@ void PmIpkg::processLinkDir( QString file, QString dest )
// out( "linking: "+file+" -> "+destFile );
qDebug( "linking: %s -> %s", instFile, linkFile );
symlink( instFile, linkFile );
}
}
void PmIpkg::commit( PackageList pl )
{
show( false );
runwindow->outPut->setText("");
out( "<h1>"+tr("Todo")+"</h1>\n");
+ to_install.clear();
+ to_remove.clear();
+ int sizecount = 0;
QString rem="<b>To remove:</b><br>\n";
QString inst="<b>To install:</b><br>\n";;
for( Package *pack = pl.first();pack ; (pack = pl.next()) )
{
if ( pack && (pack->name() != "") && pack)
{
if ( pack->toInstall() )
{
+ #ifndef NEWLIST
to_install.append( pack->name() );
+ #endif
+ #ifdef NEWLIST
+ to_install.append( pack );
+ sizecount += pack->size().toInt();
+ #endif
inst += pack->name()+"<br>";
}
if ( pack->toRemove() )
{
+ #ifndef NEWLIST
to_remove.append( pack->name() );
+ #endif
+ #ifdef NEWLIST
+ to_remove.append( pack );
+ sizecount += 1;
+ #endif
rem += pack->name()+"<br>";
}
}
}
out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>");
qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count());
+ runwindow->progress->setTotalSteps( sizecount );
+
connect( runwindow->doItButton, SIGNAL( clicked() ),
SLOT( doIt() ) );
connect( runwindow->installButton, SIGNAL( clicked() ),
this, SLOT( install() ) );
connect( runwindow->removeButton, SIGNAL( clicked() ),
this, SLOT( remove() ) );
connect( runwindow->cancelButton, SIGNAL( clicked() ),
runwindow, SLOT( close() ) );
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".
@@ -198,53 +223,83 @@ void PmIpkg::doIt()
{
remove();
install();
}
void PmIpkg::remove()
{
if ( to_remove.count() == 0 ) return;
show( true );
out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>");
+
+ #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() )
+ {
+ if ( runIpkg("remove " + it->name()) == 0)
+ {
+ runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
+ it->processed();
+ runwindow->progress->setProgress( 1 );
+ }else{
+ out("<b>"+tr("Error while removing")+"</b>"+it->name());
+ }
+ }
+#endif
}
void PmIpkg::install()
{
if ( to_install.count() == 0 ) return;
show( true );
- out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"<b><br>");
- if ( to_install.count() )
+ 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() )
+ {
+ if ( runIpkg("install " + it->name()) == 0 )
+ {
+ runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
+ if ( settings->createLinks() )
+ makeLinks( it->name() );
+ it->processed();
+ }else{
+ out("<b>"+tr("Error while installing")+"</b>"+it->name());
+ }
+ }
+#endif
}
void PmIpkg::linkDestination( const QString msg, const QByteArray dest )
// add 3rd package parameter
{
qDebug("msg="+msg+" -- "+QString(dest) );
// QDir d( src );
// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
//// if (! d.exists() ) return;
// const QFileInfoList *list = d.entryInfoList();
// QFileInfoListIterator it( *list );
// QFileInfo *fi;
@@ -281,17 +336,17 @@ void PmIpkg::showButtons(bool b)
runwindow->doItButton->show();
runwindow->removeButton->show();
runwindow->installButton->show();
}
}
void PmIpkg::show(bool b)
{
if (!runwindow->isVisible())
runwindow->showMaximized();
showButtons(b);
- if ( b )
- runwindow->progress->show();
- else
- runwindow->progress->show();
+// if ( b )
+ runwindow->progress->hide();
+// else
+// runwindow->progress->show();
}