Пример #1
0
 // === 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();
   }
}
Пример #2
0
QString PBIBackend::getMetaPkgSize(QString appID, QString injail){
  QString output;
  NGApp info = singleAppInfo(appID, injail);
  //Now add up the sizes of all the direct dependencies
  double bytes = 0;
  QStringList deps;
  if(info.isInstalled){ 
    bytes = pkgSizeToBytes(info.installedsize); 
    if(bytes == 0){ //only check direct dependencies if a meta-pkg (no size for pkg)
      deps = info.dependency;  //only use direct dependencies (better appx)
    } 
  }else{ deps = listDependencies(appID); bytes = pkgSizeToBytes(info.size); } //check the entire dep tree for missing pkgs
  for(int i=0; i<deps.length(); i++){
    NGApp dep = singleAppInfo(deps[i],injail);
    QString sz;
    if( info.isInstalled ){
      //Add the installed size of the dependencies
      sz = dep.installedsize;
    }else{
      //Add the download size for uninstalled dependencies
      if( !dep.isInstalled ){ sz = dep.size; }
    }
    if(sz.isEmpty()){ continue; }
    bytes+= pkgSizeToBytes(sz);
    QCoreApplication::processEvents(); //keep the UI snappy
  }
  //Now convert the size back into the right format
  output = bytesToPkgSize(bytes);
  return output;
}
Пример #3
0
//General Functions
QStringList PBIBackend::listDependencies(QString appID){
  //This is a recursive function to list all the dependencies of a given application
  QStringList out, dep;
  if(APPHASH.contains(appID)){ dep = APPHASH[appID].dependency; }
  else if(PKGHASH.contains(appID)){ dep = PKGHASH[appID].dependency; }
  for(int i=0; i<dep.length(); i++){
    if(out.contains(dep[i])){ continue; } //duplicate - just skip it since already found earlier
    out << dep[i];
    out << listDependencies(dep[i]);
  }
  return out;
}