Changeset e7d7b23


Ignore:
Timestamp:
07/30/14 10:51:43 (9 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2
Children:
99e151e
Parents:
83ce379 (diff), fb5f8cb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of github.com:pcbsd/pcbsd

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src-webui/appweb/share/html/include/functions.php

    r3da6dccc rfb5f8cb  
    11<? 
    22 
    3 function hideurl($newurl) 
     3function hideurl($newurl = "") 
    44{ 
    55   if (empty($newurl) ) 
  • src-webui/appweb/share/nginx.conf

    rc1b354e rfbd82fb  
    5050 
    5151        location ~ \.php$ { 
     52                fastcgi_read_timeout 360; 
    5253                fastcgi_pass 127.0.0.1:9000; 
    5354                fastcgi_index index.php; 
  • src-sh/syscache/daemon/DB-accesscommands.txt

    r2ca866a r83ce379  
    11  DATABASE INFORMATION QUERY COMMANDS 
    22============================= 
    3 NOTE: All information lists have a ", " delimiter 
    4  
     3NOTES:  
     41) All information lists have a ", " delimiter 
     52) Any boolian variables return [true/false] as a string 
     6============================= 
    57 
    68 
     
    3335        isLocked 
    3436         
     37-- PBI Database information 
     38NOTE: Any identical variables to pkg information should be considered an overlay for the pkg info 
     39        So if the PBI info is empty, you will want to use the pkg info instead 
     40         
     41 "pbi list apps" (list all applications in database by pkg origin) 
     42 "pbi list cats" (list all categories in database by pkg category) 
     43  
     44 "pbi app <pkg origin> <variable>" (get information about an application) 
     45    Available variables: 
     46        origin 
     47        name 
     48        dependencies (any that are additional to the pkg dependencies - not a complete list) 
     49        author 
     50        website 
     51        license 
     52        type 
     53        category 
     54        tags 
     55        maintainer 
     56        summary 
     57        description 
     58        screenshots 
     59        relatedapps 
     60        plugins 
     61        confdir (note: icon file is <confdir>/icon.png) 
     62        options 
     63        rating 
     64         
     65 "pbi cat <pkg category> <variable>" (get information about a category) 
     66    Available variables: 
     67        origin 
     68        name 
     69        icon 
     70        summary 
  • src-sh/syscache/daemon/DB.cpp

    r578b2b9 r83ce379  
    3535  HASH = new QHash<QString, QString>; 
    3636  chkTime = new QTimer(this); 
    37         chkTime->setInterval(1000); 
     37        chkTime->setInterval(1000); // 1 second delay for sync on changes 
    3838        chkTime->setSingleShot(true); 
    3939        connect(chkTime, SIGNAL(timeout()), this, SLOT(initialSync()) ); 
     
    8888      else if(request[2]=="updatemessage"){ hashkey.append("updateLog"); } 
    8989      else{ hashkey.clear(); } 
     90    }else if(request[0]=="pbi"){ 
     91      if(request[1]=="list"){ 
     92        if(request[2]=="apps"){ hashkey="PBI/pbiList"; } 
     93        else if(request[2]=="cats"){ hashkey = "PBI/catList"; } 
     94      }          
     95    } 
     96  }else if(request.length()==4){ 
     97    if(request[0]=="pbi"){ 
     98      if(request[1]=="app"){ 
     99        hashkey = "PBI/"+request[2]+"/"+request[3]; //pkg origin and variable 
     100      }else if(request[1]=="cat"){ 
     101        hashkey = "PBI/cats/"+request[2]+"/"+request[3]; //pkg origin and variable 
     102      } 
    90103    } 
    91104  }else if(request.length()==5){ 
     
    99112  } 
    100113  //Now fetch/return the info 
    101   QString val = HASH->value(hashkey,""); 
    102   val.replace(LISTDELIMITER, ", "); 
     114  QString val; 
     115  if(!hashkey.isEmpty()){ 
     116    val = HASH->value(hashkey,""); 
     117    val.replace(LISTDELIMITER, ", "); 
     118  } 
    103119  return val; 
    104120} 
     
    133149} 
    134150 
     151QStringList DB::readFile(QString filepath){ 
     152  QStringList out; 
     153  QFile file(filepath); 
     154  if(file.exists()){ 
     155    if(file.open(QIODevice::ReadOnly | QIODevice::Text)){ 
     156        QTextStream fout(&file); 
     157        while(!fout.atEnd()){ 
     158          out << fout.readLine(); 
     159        } 
     160        file.close(); 
     161    } 
     162  } 
     163  return out; 
     164} 
     165 
    135166//Internal Hash maintenance functions 
    136167void DB::clearRepo(QString repo){ 
     
    152183    pkeys = pkeys.filter(pkgprefix); 
    153184  for(int i=0; i<pkeys.length(); i++){ HASH->remove(pkeys[i]); } 
     185} 
     186 
     187void DB::clearPbi(){ 
     188  QStringList pkeys = HASH->keys(); 
     189    pkeys = pkeys.filter("PBI/"); 
     190  for(int i=0; i<pkeys.length(); i++){ HASH->remove(pkeys[i]); }         
    154191} 
    155192 
     
    170207  //Checks the pkg repo files for changes since the last sync 
    171208  if(!HASH->contains("Jails/"+jail+"/repoID")){ return true; } //no repoID yet 
    172   else if(HASH->value("Jails/"+jail+"/repoID") != generateRepoID(jail) ){ return true; } 
    173   else if( !HASH->contains("Repos/"+HASH->value("Jails/"+jail+"/repoID")+"/lastSyncTimeStamp") ){ return true; } 
     209  else if(HASH->value("Jails/"+jail+"/repoID") != generateRepoID(jail) ){ return true; } //repoID changed 
     210  else if( !HASH->contains("Repos/"+HASH->value("Jails/"+jail+"/repoID")+"/lastSyncTimeStamp") ){ return true; } //Repo Never synced 
    174211  else{ 
    175212    QDir pkgdb( HASH->value("Jails/"+jail+"/jailPath","")+"/var/db/pkg" ); 
     
    181218    } 
    182219    return false; 
     220  } 
     221} 
     222 
     223bool DB::needsPbiSync(){ 
     224  //Check the PBI index to see if it needs to be resynced 
     225  if(!HASH->contains("PBI/lastSyncTimeStamp")){ return true; } 
     226  else{ 
     227    qint64 mod = QFileInfo("/var/db/pbi/index/PBI_INDEX").lastModified().toMSecsSinceEpoch(); 
     228    qint64 stamp = HASH->value("PBI/lastSyncTimeStamp").toLongLong(); 
     229    return (mod > stamp); 
    183230  } 
    184231} 
     
    240287    watcher->addPath("/var/db/pkg"); //local system pkg database should always be watched 
    241288    watcher->addPath("/tmp/.pcbsdflags"); //local PC-BSD system flags 
     289    watcher->addPath("/var/db/pbi/index/PBI-INDEX"); //local PBI index file 
    242290  QStringList jails = HASH->value("JailList","").split(LISTDELIMITER); 
    243291  //Now get the current list of running jails and insert individual jail info 
     
    476524 
    477525void DB::syncPbi(){ 
    478          
    479 } 
     526  //Check the timestamp to see if it needs a re-sync 
     527  if(needsPbiSync()){ 
     528    clearPbi(); 
     529    QStringList info = readFile("/var/db/pbi/index/PBI-INDEX"); 
     530    QStringList pbilist, catlist; 
     531    for(int i=0; i<info.length(); i++){ 
     532      if(info[i].startsWith("PBI=")){ 
     533        //Application Information 
     534        QStringList pbi = info[i].section("=",1,50).split("::::"); 
     535        //Line Format (7/30/14): 
     536        // [port, name, +ports, author, website, license, app type, category, tags,  
     537        //      maintainer, shortdesc, fulldesc, screenshots, related, plugins, conf dir, options, rating] 
     538        if(pbi.length()<18){ continue; } //incomplete line 
     539        QString prefix = "PBI/"+pbi[0]+"/"; 
     540        pbilist << pbi[0]; //origin 
     541        HASH->insert(prefix+"origin", pbi[0]); 
     542        HASH->insert(prefix+"name", pbi[1]); 
     543        HASH->insert(prefix+"dependencies", pbi[2].replace(",",LISTDELIMITER) ); 
     544        HASH->insert(prefix+"author", pbi[3]); 
     545        HASH->insert(prefix+"website", pbi[4]); 
     546        HASH->insert(prefix+"license", pbi[5].replace(",",LISTDELIMITER)); 
     547        HASH->insert(prefix+"type", pbi[6]); 
     548        HASH->insert(prefix+"category", pbi[7]); 
     549        HASH->insert(prefix+"tags", pbi[8].replace(",",LISTDELIMITER)); 
     550        HASH->insert(prefix+"maintainer", pbi[9]); 
     551        HASH->insert(prefix+"summary", pbi[10].replace("<br>", " ")); 
     552        HASH->insert(prefix+"description", pbi[11].replace("<br>","\n").section("\nWWW: ",0,0) ); 
     553        HASH->insert(prefix+"screenshots", pbi[12].replace(",",LISTDELIMITER)); 
     554        HASH->insert(prefix+"relatedapps", pbi[13].replace(",",LISTDELIMITER)); 
     555        HASH->insert(prefix+"plugins", pbi[14].replace(",",LISTDELIMITER)); 
     556        HASH->insert(prefix+"confdir", "/var/db/pbi/index/"+pbi[15]); 
     557        HASH->insert(prefix+"options", pbi[16].replace(",",LISTDELIMITER)); 
     558        HASH->insert(prefix+"rating", pbi[17]); 
     559      }else if(info[i].startsWith("Cat=")){ 
     560        //Category Information 
     561        QStringList cat = info[i].section("=",1,50).split("::::"); 
     562        //Line Format (7/30/14): <name>, <icon>, <summary>, <freebsd category> 
     563        if(cat.length() < 4){ continue; } //incomplete line 
     564        QString prefix = "PBI/cats/"+cat[3]+"/"; 
     565        catlist << cat[3]; //freebsd category (origin) 
     566        HASH->insert(prefix+"origin", cat[3]); 
     567        HASH->insert(prefix+"name", cat[0]); 
     568        HASH->insert(prefix+"icon", "/var/db/pbi/PBI-cat-icons/"+cat[1]); 
     569        HASH->insert(prefix+"summary", cat[2]); 
     570      } 
     571      //Don't use the PKG= lines, since we already have the full pkg info available 
     572    } 
     573    //Insert the complete lists 
     574    HASH->insert("PBI/pbiList", pbilist.join(LISTDELIMITER)); 
     575    HASH->insert("PBI/catList", catlist.join(LISTDELIMITER)); 
     576  } 
     577  //Update the timestamp 
     578  HASH->insert("PBI/lastSyncTimeStamp", QString::number(QDateTime::currentMSecsSinceEpoch())); 
     579} 
  • src-sh/syscache/daemon/DB.h

    r578b2b9 r83ce379  
    1616#include <QDateTime> 
    1717#include <QDir> 
     18#include <QFile> 
     19#include <QTextStream> 
    1820 
    1921class DB : public QObject{ 
     
    3840        QStringList sysCmd(QString cmd); // ensures only 1 running at a time (for things like pkg) 
    3941        QStringList directSysCmd(QString cmd); //run command immediately 
     42        QStringList readFile(QString filepath); //read the contents of a text file 
    4043 
    4144        //Internal Hash maintenance functions 
     
    4346        void clearJail(QString jail); 
    4447        void clearLocalPkg(QString pkgprefix); 
     48        void clearPbi(); 
    4549 
    4650        //Internal sync checks 
    4751        bool needsLocalSync(QString jail); 
    4852        bool needsRemoteSync(QString jail); 
     53        bool needsPbiSync(); 
    4954 
    5055        //Simplification functions 
Note: See TracChangeset for help on using the changeset viewer.