Changeset 5361675


Ignore:
Timestamp:
07/30/14 19:03:01 (4 weeks ago)
Author:
Kris Moore <kris@…>
Branches:
master, releng/10.0.3
Children:
119afba
Parents:
4ce0f60 (diff), fb5b0b8 (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

Location:
src-sh/syscache
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src-sh/syscache/client/syscache-client.cpp

    r2ca866a rfb5b0b8  
    1212void SysCacheClient::parseInputs(QStringList inputs){ 
    1313  userRequest = inputs; 
     14  if(inputs.isEmpty()){ showUsage(); } 
    1415  //Convert the user request into server request formatting 
    1516  servRequest << inputs; 
    16          
     17   
    1718  //Now start the connection to the server 
    1819  curSock->connectToServer("/var/run/syscache.pipe", QIODevice::ReadWrite | QIODevice::Text); 
     20} 
     21 
     22void SysCacheClient::showUsage(){ 
     23  qDebug() << "[ERROR] Invalid Inputs: (usage text not written yet)"; 
     24 
     25  exit(1);       
    1926} 
    2027 
     
    2633 
    2734void SysCacheClient::requestFinished(){ 
    28   qDebug() << "Client Request Finished"; 
     35  static bool running = false; 
     36  if(running){ return; } //already reading stream 
     37  //qDebug() << "Client Request Finished"; 
    2938  QTextStream in(curSock); 
    3039  bool finished = false; 
     40  static QString line = ""; 
     41  running = true; 
    3142  while(!in.atEnd()){ 
    32     QString line = in.readLine(); 
     43    QString newline = in.readLine(); 
     44    if(newline.startsWith("[") && !line.isEmpty()){ 
     45      qDebug() << line;  
     46      line.clear(); 
     47      if(newline.startsWith("[INFOSTART]")){ 
     48        newline = newline.remove(0,11); //remove that internal flag  
     49      } 
     50    } 
     51    line.append(newline); 
    3352    if(line=="[FINISHED]"){ finished=true; break;} 
    34     else{ qDebug() << line; } 
    3553  } 
     54  running = false; 
    3655  if(finished){ 
    3756    curSock->disconnectFromServer(); 
  • src-sh/syscache/client/syscache-client.h

    r8c7378d rfb5b0b8  
    2525 
    2626private slots: 
     27        void showUsage(); 
     28 
    2729        //Server/Client connections 
    2830        void startRequest(); 
  • src-sh/syscache/daemon/DB-accesscommands.txt

    r99e151e r0ac3332  
    2020  
    2121 "pkg [#system/<jailname>] local <pkg origin> <variable>" (get a particular piece of info for a pkg) 
    22    Available variables: (all locally installed info) 
     22   Available variables: 
    2323        origin 
    2424        name 
     
    3434        isOrphan 
    3535        isLocked 
     36        dependencies 
     37        rdependencies 
     38        categories 
     39        files 
     40        options 
     41        license 
     42        users 
     43        groups 
    3644         
     45-- Remote Pkg information 
     46 "pkg [#system/<jailname>] remotelist" (list all pkgs currently available) 
     47  
     48 "pkg [#system/<jailname>] remote <pkg origin> <variable>" (get info about a remote pkg) 
     49   Available variables: 
     50        origin 
     51        name 
     52        version 
     53        maintainer 
     54        comment 
     55        description 
     56        website 
     57        size 
     58        arch 
     59        message 
     60        dependencies 
     61        rdependencies 
     62        categories 
     63        options 
     64        license 
     65    
    3766-- PBI Database information 
    3867NOTE: Any identical variables to pkg information should be considered an overlay for the pkg info 
     
    5786        tags 
    5887        maintainer 
    59         summary 
     88        comment 
    6089        description 
    6190        screenshots 
    6291        relatedapps 
    6392        plugins 
    64         confdir (note: icon file is <confdir>/icon.png) 
     93        confdir (note: icon file path is "<confdir>/icon.png" or "/var/db/pbi/index/generic-icon.png") 
    6594        options 
    6695        rating 
     
    71100        name 
    72101        icon 
    73         summary 
     102        comment 
  • src-sh/syscache/daemon/DB.cpp

    r99e151e r0ac3332  
    8787      else if(request[2]=="hasupdates"){ hashkey.append("hasUpdates"); } 
    8888      else if(request[2]=="updatemessage"){ hashkey.append("updateLog"); } 
     89      else if(request[2]=="remotelist"){ hashkey="Repos/"+HASH->value(hashkey+"repoID")+"/pkgList"; } 
    8990      else{ hashkey.clear(); } 
    9091    }else if(request[0]=="pbi"){ 
     
    107108  }else if(request.length()==5){ 
    108109    if(request[0]=="pkg"){ 
     110      if(request[1]=="#system"){ hashkey="Jails/"+LOCALSYSTEM+"/"; } 
     111      else{ hashkey="Jails/"+request[1]+"/"; }       
    109112      if(request[2]=="local"){ 
    110         if(request[1]=="#system"){ hashkey="Jails/"+LOCALSYSTEM+"/"; } 
    111         else{ hashkey="Jails/"+request[1]+"/"; } 
    112113        hashkey.append("pkg/"+request[3]+"/"+request[4]); // "pkg/<origin>/<variable>" 
     114      }else if(request[2]=="remote"){ 
     115        hashkey="Repos/"+HASH->value(hashkey+"repoID")+"/pkg/"+request[3]+"/"+request[4]; 
    113116      } 
    114117    } 
     
    116119  //Now fetch/return the info 
    117120  QString val; 
    118   if(hashkey.isEmpty()){ val = "[ERROR] Invalid Information request"; } 
     121  if(hashkey.isEmpty()){ val = "[ERROR] Invalid Information request: \""+request.join(" ")+"\""; } 
    119122  else if(!HASH->contains(hashkey)){ val = "[ERROR] Information not available"; } 
    120123  else{ 
     
    277280  syncPkgLocal(); 
    278281  if(stopping){ return; } 
     282  //Now Load the PBI database (more useful, will not lock system usage, and is fast) 
     283  syncPbi(); 
    279284  //Now do all the remote pkg info retrieval (won't lock the pkg database in 1.3.x?) 
     285   // Note: This can take a little while 
    280286  syncPkgRemote(); 
    281287  if(stopping){ return; } 
    282   //Now Load the PBI database (more useful, but will not lock system usage) 
    283   syncPbi(); 
    284288  //Now check for overall system updates 
    285289   
     
    332336  } 
    333337  if(stopping){ return; } 
    334   QStringList info = directSysCmd(cmd+opt).join("").split("PKG::"); 
     338  QStringList info = directSysCmd(cmd+opt).join("\n").split("PKG::"); 
    335339  QStringList installed; 
    336340  for(int i=0; i<info.length(); i++){ 
     
    507511    //Now get all the remote pkg info for this repoID/jail 
    508512    clearRepo(repoID); 
    509     //Remote pkg info not retrieved yet 
    510            
    511   } 
     513    //Now fetch remote pkg info for this repoID 
     514    QString prefix = "Repos/"+repoID+"/pkg/"; 
     515    QString cmd = "pkg rquery -a "; 
     516    if(jail!=LOCALSYSTEM){ cmd = "pkg -j "+HASH->value("Jails/"+jail+"/JID")+" rquery -a "; } 
     517    QStringList info = directSysCmd(cmd+"PKG::%o::::%n::::%v::::%m::::%w::::%q::::%sh::::%c::::%e::::%M").join("\n").split("PKG::"); 
     518    //Format: origin, name, version, maintainer, website, arch, size, comment, description, message 
     519    QStringList pkglist; 
     520    for(int i=0; i<info.length(); i++){ 
     521      QStringList pkg = info[i].split("::::"); 
     522      if(pkg.length()<9){ continue; } //invalid line 
     523      pkglist << pkg[0]; 
     524      HASH->insert(prefix+pkg[0]+"/origin", pkg[0]); 
     525      HASH->insert(prefix+pkg[0]+"/name", pkg[1]); 
     526      HASH->insert(prefix+pkg[0]+"/version", pkg[2]); 
     527      HASH->insert(prefix+pkg[0]+"/maintainer", pkg[3]); 
     528      HASH->insert(prefix+pkg[0]+"/website", pkg[4]); 
     529      HASH->insert(prefix+pkg[0]+"/arch", pkg[5]); 
     530      HASH->insert(prefix+pkg[0]+"/size", pkg[6]); 
     531      HASH->insert(prefix+pkg[0]+"/comment", pkg[7]); 
     532      HASH->insert(prefix+pkg[0]+"/description", pkg[8]); 
     533      HASH->insert(prefix+pkg[0]+"/message", pkg[9]); 
     534    } 
     535    //Now save the list of installed pkgs 
     536    HASH->insert("Repos/"+repoID+"/pkgList", pkglist.join(LISTDELIMITER)); 
     537    //Now go through the pkgs and get the more complicated/detailed info 
     538    // -- dependency list 
     539    if(stopping){ return; } 
     540    info = directSysCmd(cmd+" %o::::%do"); 
     541    pkglist.clear(); 
     542    QString orig; 
     543    for(int i=0; i<info.length(); i++){ 
     544      if(orig!=info[i].section("::::",0,0) && !orig.isEmpty()){  
     545        HASH->insert(prefix+orig+"/dependencies", pkglist.join(LISTDELIMITER)); 
     546        pkglist.clear(); 
     547      } 
     548      orig = info[i].section("::::",0,0); 
     549      pkglist << info[i].section("::::",1,1); 
     550    } 
     551    HASH->insert(prefix+orig+"/dependencies", pkglist.join(LISTDELIMITER)); //make sure to save the last one too 
     552    // -- reverse dependency list 
     553    if(stopping){ return; } 
     554    info = directSysCmd(cmd+" %o::::%ro"); 
     555    pkglist.clear(); 
     556    orig.clear(); 
     557    for(int i=0; i<info.length(); i++){ 
     558      if(orig!=info[i].section("::::",0,0) && !orig.isEmpty()){  
     559        HASH->insert(prefix+orig+"/rdependencies", pkglist.join(LISTDELIMITER)); 
     560        pkglist.clear(); 
     561      } 
     562      orig = info[i].section("::::",0,0); 
     563      pkglist << info[i].section("::::",1,1); 
     564    } 
     565    HASH->insert(prefix+orig+"/rdependencies", pkglist.join(LISTDELIMITER)); //make sure to save the last one too 
     566    // -- categories 
     567    if(stopping){ return; } 
     568    info = directSysCmd(cmd+" %o::::%C"); 
     569    pkglist.clear(); 
     570    orig.clear(); 
     571    for(int i=0; i<info.length(); i++){ 
     572      if(orig!=info[i].section("::::",0,0) && !orig.isEmpty()){  
     573        HASH->insert(prefix+orig+"/categories", pkglist.join(LISTDELIMITER)); 
     574        pkglist.clear(); 
     575      } 
     576      orig = info[i].section("::::",0,0); 
     577      pkglist << info[i].section("::::",1,1); 
     578    } 
     579    HASH->insert(prefix+orig+"/categories", pkglist.join(LISTDELIMITER)); //make sure to save the last one too 
     580    // -- options 
     581    if(stopping){ return; } 
     582    info = directSysCmd(cmd+" %o::::%Ok=%Ov"); 
     583    pkglist.clear(); 
     584    orig.clear(); 
     585    for(int i=0; i<info.length(); i++){ 
     586      if(orig!=info[i].section("::::",0,0) && !orig.isEmpty()){  
     587        HASH->insert(prefix+orig+"/options", pkglist.join(LISTDELIMITER)); 
     588        pkglist.clear(); 
     589      } 
     590      orig = info[i].section("::::",0,0); 
     591      pkglist << info[i].section("::::",1,1); 
     592    } 
     593    HASH->insert(prefix+orig+"/options", pkglist.join(LISTDELIMITER)); //make sure to save the last one too   
     594    // -- licenses 
     595    if(stopping){ return; } 
     596    info = directSysCmd(cmd+" %o::::%L"); 
     597    pkglist.clear(); 
     598    orig.clear(); 
     599    for(int i=0; i<info.length(); i++){ 
     600      if(orig!=info[i].section("::::",0,0) && !orig.isEmpty()){  
     601        HASH->insert(prefix+orig+"/license", pkglist.join(LISTDELIMITER)); 
     602        pkglist.clear(); 
     603      } 
     604      orig = info[i].section("::::",0,0); 
     605      pkglist << info[i].section("::::",1,1); 
     606    } 
     607    HASH->insert(prefix+orig+"/license", pkglist.join(LISTDELIMITER)); //make sure to save the last one too  
     608  } //end sync of remote information 
    512609  //Update the timestamp for this repo 
    513610  HASH->insert("Repos/"+HASH->value("Jails/"+jail+"/repoID")+"/lastSyncTimeStamp", QString::number(QDateTime::currentMSecsSinceEpoch())); 
     
    556653        HASH->insert(prefix+"tags", pbi[8].replace(",",LISTDELIMITER)); 
    557654        HASH->insert(prefix+"maintainer", pbi[9]); 
    558         HASH->insert(prefix+"summary", pbi[10].replace("<br>", " ")); 
     655        HASH->insert(prefix+"comment", pbi[10].replace("<br>", " ")); 
    559656        HASH->insert(prefix+"description", pbi[11].replace("<br>","\n").section("\nWWW: ",0,0) ); 
    560657        HASH->insert(prefix+"screenshots", pbi[12].replace(",",LISTDELIMITER)); 
     
    574671        HASH->insert(prefix+"name", cat[0]); 
    575672        HASH->insert(prefix+"icon", "/var/db/pbi/PBI-cat-icons/"+cat[1]); 
    576         HASH->insert(prefix+"summary", cat[2]); 
     673        HASH->insert(prefix+"comment", cat[2]); 
    577674      } 
    578675      //Don't use the PKG= lines, since we already have the full pkg info available 
  • src-sh/syscache/daemon/syscache-daemon.cpp

    r5eaa0db rfb5b0b8  
    5353  while(!stream.atEnd()){ 
    5454    req = QString(stream.readLine()).split(" "); 
    55     qDebug() << "Request Received:" << req; 
     55    //qDebug() << "Request Received:" << req; 
    5656    if(req.join("")=="shutdowndaemon"){ stopdaemon=true; break; } 
    57     else{ out << DATA->fetchInfo(req); } 
     57    else{ out << "[INFOSTART]"+DATA->fetchInfo(req); } 
    5858  } 
    5959  //Now write the output to the socket and disconnect it 
  • src-sh/syscache/rc.d/syscache

    r9255a4d r4ce0f60  
    2727{ 
    2828  echo "Starting syscache..." 
     29  if [ -e "/var/run/syscache.pipe" ] ; then 
     30    rm /var/run/syscache.pipe >/dev/null 2>/dev/null 
     31  fi 
    2932  ($command >/dev/null 2>/dev/null) & 
    30   echo $! > /var/run/syscache.pid 
    3133} 
    3234 
    3335syscache_stop() 
    3436{ 
    35   kill -9 $(cat /var/run/syscache.pid) 
     37  syscache shutdowndaemon >/dev/null 2>/dev/null 
    3638} 
    3739 
Note: See TracChangeset for help on using the changeset viewer.