[PC-BSD Commits] r19468 - pcbsd/current/src-qt4/pc-sysmanager

svn at pcbsd.org svn at pcbsd.org
Mon Sep 24 09:21:25 PDT 2012


Author: kris
Date: 2012-09-24 16:21:25 +0000 (Mon, 24 Sep 2012)
New Revision: 19468

Modified:
   pcbsd/current/src-qt4/pc-sysmanager/portsnapprogress.cpp
Log:

Improve sys-manager to only update ports tree if it already is checked out



Modified: pcbsd/current/src-qt4/pc-sysmanager/portsnapprogress.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-sysmanager/portsnapprogress.cpp	2012-09-24 16:13:52 UTC (rev 19467)
+++ pcbsd/current/src-qt4/pc-sysmanager/portsnapprogress.cpp	2012-09-24 16:21:25 UTC (rev 19468)
@@ -28,36 +28,6 @@
 
 void PortsnapProgress::startPorts()
 {
-    //Check our modified portsnap program is installed
-    QFile newsnap("/usr/local/share/pcbsd/scripts/portsnap.sh");
-    if (! newsnap.exists()) {
-	QFile oldsnap("/usr/sbin/portsnap");
-	oldsnap.open(QIODevice::ReadOnly);
-	newsnap.open(QIODevice::WriteOnly);
-	QTextStream oldstream(&oldsnap);
-	oldstream.setCodec("UTF-8");
-	QTextStream newstream(&newsnap);
-	newstream.setCodec("UTF-8");
-	QString line;
-	int i = 0;
-	while (!oldstream.atEnd()) {
-	    line = oldstream.readLine();
-	    //Remove the six lines from the file, we want to run non-interactively!
-	    if (line.indexOf("if [ ! -t 0 ]; then") != -1) {
-		i = 6;
-	    }
-	    if ( i > 0) {
-		i--;
-	    }
-	    else {
-		newstream << line << "\n";
-	    }
-	}
-	oldsnap.close();
-	newsnap.close();
-	chmod("/usr/local/share/pcbsd/scripts/portsnap.sh", 0755);
-    }
-    
     //Init vars
     workdir = "/var/db/portsnap";
     portsdir = "/usr/ports";
@@ -74,7 +44,7 @@
     
     QStringList args;
     QString prog;
-    prog = "/usr/local/share/pcbsd/scripts/portsnap.sh";
+    prog = "/usr/local/share/pcbsd/scripts/portsnap-noterm.sh";
     args << "fetch";
     portsnap = new QProcess(this);
     portsnap->setProcessChannelMode(QProcess::MergedChannels);
@@ -155,8 +125,12 @@
 	
         QStringList args;
         QString prog;
-        prog = "/usr/local/share/pcbsd/scripts/portsnap.sh";
-        args << "extract" << "update" << "-p" << portsdir ;
+        prog = "/usr/local/share/pcbsd/scripts/portsnap-noterm.sh";
+	// Check if we need to do a quick update or full extract
+	if ( QFile::exists( portsdir + "Mk/bsd.port.mk") ) 
+           args << "update" << "-p" << portsdir ;
+	else
+           args << "extract" << "update" << "-p" << portsdir ;
 	portsnap = new QProcess(this);
         portsnap->setProcessChannelMode(QProcess::MergedChannels);
 	connect(portsnap, SIGNAL(readyReadStandardOutput()), this, SLOT(parseUpdate()));



More information about the Commits mailing list