void PBIBackend::procFinished(int ret, QProcess::ExitStatus stat){ emit devMessage("** Process Finished **"); if(stat != QProcess::NormalExit){ //Process Crashed emit Error(tr("Process Crashed"), QString(tr("The process for %1 has quit unexpectedly. Please restart this operation at a later time.")).arg(PKGRUN), PROCLOG); }else if( ret != 0 ){ //Failure QString title, msg; if(PROCTYPE==0){ title = tr("Installation Failure"); msg = QString(tr("The following application installation experienced an error: %1")+"\n\n"+tr("Please try again later.")).arg(APPHASH[PKGRUN].name); }else if(PROCTYPE==1){ title = tr("Removal Failure"); msg = QString(tr("The following application removal experienced an error: %1")+"\n\n"+tr("Please try again later.")).arg(APPHASH[PKGRUN].name); } if(!msg.isEmpty()){ emit Error(title, msg, PROCLOG); } }else{ //Success - perform any cleanup operations if(PROCTYPE==0 && PKGCMD.contains("pbi_") && !PROCCANCELLED && PKGJAIL.isEmpty()){ //if new installation on main system Extras::getCmdOutput("pbi_icon add-menu add-mime "+PKGRUN); //don't care about result if(autoDE && APPHASH[PKGRUN].hasDE){ runCmdAsUser("pbi_icon add-desktop "+PKGRUN); } }else if(PROCTYPE==0 && PKGCMD.contains("pc-pkg ") && !PROCCANCELLED && PKGJAIL.isEmpty()){ Extras::getCmdOutput("pc-extractoverlay ports"); //make sure to extract the ports overlay after a pkg operation } } //Now clean up the process variables and update the app status if(PKGJAIL.isEmpty()){ //update the local system info slotSyncToDatabase(true); }else if(PKGJAIL=="--newjail"){ //Find the new jail checkForJails(); emit JailListChanged(); }else{ //Just update the pkg list for this particular jail checkForJails(PKGJAIL); } QString origin = PKGRUN; //temporary PKGCMD.clear(); PKGRUN.clear(); PKGJAIL.clear(); //Emit the proper signals emit PBIStatusChange(origin); emit LocalPBIChanges(); //so that it knows to look for a different install list //Now check for the next command to run QTimer::singleShot(1, this, SLOT(checkProcesses()) ); }
// === Database Synchronization === void PBIBackend::slotSyncToDatabase(bool localChanges, bool all){ qDebug() << "Sync Database with local changes:" << localChanges; updateSplashScreen(tr("Loading Database")); sysDB->syncDBInfo("", localChanges, all); PKGHASH.clear(); APPHASH.clear(); CATHASH.clear(); if(RECLIST.isEmpty() || all){ sysDB->getAppCafeHomeInfo( &NEWLIST, &HIGHLIST, &RECLIST); } //qDebug() << "Load APPHASH"; PKGHASH = sysDB->DetailedPkgList(); // load the pkg info APPHASH = sysDB->DetailedAppList(); // load the pbi info CATHASH = sysDB->Categories(); // load all the different categories info if(BASELIST.isEmpty() || all){ //populate the list of base dependencies that cannot be removed BASELIST = listDependencies("misc/pcbsd-base"); BASELIST.removeDuplicates(); //qDebug() << "Base:" << BASELIST; } updavail = checkForPkgUpdates(""); if(RUNNINGJAILS.isEmpty() || all){ checkForJails(); } //qDebug() << "Update Stats"; updateStatistics(); //qDebug() << "Emit result"; if(APPHASH.isEmpty() && PKGHASH.isEmpty()){ emit NoRepoAvailable(); }else{ emit RepositoryInfoReady(); } }
void PBIBackend::syncLocalPackages(){ //force the backend to resync the locally installed package lists/details slotSyncToDatabase(true); checkForJails(); //also recheck any jails }
QStringList PBIBackend::runningJails(){ checkForJails(); QStringList jails = RUNNINGJAILS.keys(); return jails; }