Changeset 9809371


Ignore:
Timestamp:
12/16/13 10:14:52 (13 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1
Children:
df413956
Parents:
835d3d3e
Message:

Finish fixing up the package manager to use / parse EVENT_PIPE from
pkgng 1.2.x

Should be workable now, although we can really improve it going forward

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-pkgmanager/mainWin.cpp

    r8c6e16d r9809371  
    357357  qDebug() << cmd + " " + flags.join(" "); 
    358358 
     359  system("rm /tmp/pkg-fifo 2>/dev/null"); 
     360 
    359361  // Create the EVENT_PIPE 
    360362  if ( wDir.isEmpty() ) 
    361     system("mkfifo /tmp/pkg-fifo"); 
     363    system("mkfifo /tmp/pkg-fifo ; sleep 1"); 
    362364  else 
    363     system("mkfifo " + wDir.toLatin1() + "/tmp/pkg-fifo"); 
     365    system("mkfifo " + wDir.toLatin1() + "/tmp/pkg-fifo ; sleep 1"); 
    364366 
    365367  // Open and connect the EVENT_PIPE 
    366368  eP = new QProcess(); 
    367   connect( eP, SIGNAL(readyReadStandardOutput()), this, SLOT(slotReadEventPipe()) ); 
    368   eP->start(QString("tail"), QStringList() << "-f" << wDir + "/tmp/pkg-fifo"); 
    369   qDebug() << "Starting EVENT_PIPE" << wDir + "/tmp/pkg-fifo"; 
    370    
     369  eP->setProcessChannelMode(QProcess::MergedChannels); 
     370  connect( eP, SIGNAL(readyRead()), this, SLOT(slotReadEventPipe()) ); 
     371  connect( eP, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotReadEventPipe()) ); 
     372  eP->start(QString("cat"), QStringList() << "-u" << wDir + "/tmp/pkg-fifo"); 
     373  qDebug() << "Starting EVENT_PIPE"; 
     374  eP->waitForStarted(); 
     375 
    371376  // Setup the first process 
    372377  uProc = new QProcess(); 
    373378  QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); 
    374379  env.insert("PCFETCHGUI", "YES"); 
    375  
    376   // KPM 12-12-2013 
    377   // EVENT_PIPE causes segfaults in pkgng 1.2.3 :( 
    378   // Re-enable this when its fixed upstream 
    379   //env.insert("EVENT_PIPE", "/tmp/pkg-fifo"); 
    380  
     380  env.insert("EVENT_PIPE", "/tmp/pkg-fifo"); 
    381381  uProc->setProcessEnvironment(env); 
    382382  uProc->setProcessChannelMode(QProcess::MergedChannels); 
     
    950950  pCmds.clear(); 
    951951 
     952  // Adding packages 
    952953  if ( ! pkgAddList.isEmpty() ) { 
     954 
     955    // Look for conflicts first 
     956    if ( wDir.isEmpty() ) 
     957      pCmds << "pc-pkg" << "check-conflict" << pkgAddList.join(" "); 
     958    else 
     959      pCmds << "chroot" << wDir << "pc-pkg" << "check-conflict" << pkgAddList.join(" "); 
     960    pkgCmdList << pCmds; 
     961    pCmds.clear(); 
     962 
     963    // Now spin up the install process 
    953964    if ( wDir.isEmpty() ) 
    954965      pCmds << "pc-pkg" << "install" << "-y" << pkgAddList.join(" "); 
    955966    else 
    956967      pCmds << "chroot" << wDir << "pc-pkg" << "install" << "-y" << pkgAddList.join(" "); 
     968 
    957969    pkgCmdList << pCmds; 
    958970  } 
     
    15051517{ 
    15061518   QString line, tmp, file, dl, tot; 
     1519   bool ok, ok2; 
    15071520 
    15081521   while (eP->canReadLine()) { 
    15091522     line = eP->readLine().simplified(); 
    1510      qDebug() << line; 
     1523     //qDebug() << line; 
    15111524 
    15121525     // KPM!! 
     
    15391552          dl = line.section(":", 2, 2).section(",", 0, 0); 
    15401553          tot = line.section(":", 3, 3).section("}", 0, 0); 
     1554          dl = dl.simplified(); 
     1555          tot = tot.simplified(); 
     1556 
     1557          dl.toLongLong(&ok); 
     1558          tot.toLongLong(&ok2); 
     1559          if ( ok && ok2) { 
     1560            progressUpdate->setRange(0, tot.toLongLong(&ok) / 1024); 
     1561            progressUpdate->setValue(dl.toLongLong(&ok) / 1024 ); 
     1562          } 
    15411563 
    15421564          // Set the status update 
    1543           textStatus->setText(tr("Downloading") + " " + file + " (" + dl + "/" + tot + ")" ); 
     1565          textStatus->setText(tr("Downloading") + " " + file + " (" + dl + " / " + tot + ")" ); 
    15441566     } 
    15451567 
    15461568   } // End of while canReadLine() 
    1547 } 
     1569 
     1570} 
  • src-sh/pc-metapkgmanager/pc-metapkgmanager

    r8506de1f r9809371  
    8181        fi 
    8282 
     83        # Don't need this anymore 
     84        unset EVENT_PIPE 
     85 
    8386        # Time to run pkgng and let it install packages! 
    8487        pkg install -yUf "$pkgName" 
     
    279282} 
    280283 
     284do_pkg_conflicts() 
     285{ 
     286   fullopts="`echo $@ | sed 's|check-conflict||g'`" 
     287 
     288   echo "install -FUy $fullopts" > /tmp/err 
     289   # Lets check for any conflicts doing this install 
     290   check_pkg_conflicts "install -FUy $fullopts" 
     291   exit $? 
     292} 
     293 
    281294intercept_pkg_dl() 
    282295{ 
    283    local count=0; 
    284    fullopts="$@" 
    285    op="$1" 
    286     
    287    # Make sure we insert some flags we need 
    288    while [ $# -gt 0 ]; do 
    289      if [ $count -gt 0 ] ; then 
    290         # If we are already using -n, we can skip downloading anything 
    291         if [ "$1" = "-n" ] ; then 
    292            pkg $fullopts 
    293            exit $? 
    294         fi 
    295         flags="$flags $1" 
    296      else 
    297         flags="-U -n" 
    298      fi 
    299      count=`expr $count + 1` 
    300      shift 
    301    done 
    302  
    303    # Lets check for any conflicts doing this install 
    304    check_pkg_conflicts "${op} -FUy $flags" 
    305    if [ $? -ne 0 ] ; then 
    306         exit 1 
    307    fi 
    308  
    309296   # Time to run pkgng and let it do its thing 
    310    pkg $fullopts  
     297   pkg $@ 
    311298   result=$? 
    312299 
     
    347334{ 
    348335   case $1 in 
    349  install|upgrade) intercept_pkg_dl ${@} ;; 
     336         install) intercept_pkg_dl ${@} ;; 
     337  check-conflict) do_pkg_conflicts ${@} ;; 
    350338         getfile) get_file_dl ${@} ;; 
    351339               *) pkg ${@}  
Note: See TracChangeset for help on using the changeset viewer.