[PC-BSD Commits] r7440 - pcbsd/current/SysInstaller

svn at pcbsd.org svn at pcbsd.org
Wed Aug 25 11:38:35 PDT 2010


Author: kris
Date: 2010-08-25 11:38:35 -0700 (Wed, 25 Aug 2010)
New Revision: 7440

Modified:
   pcbsd/current/SysInstaller/backend.cpp
   pcbsd/current/SysInstaller/backend.h
Log:

Updated backend, now we can get list of meta-pkgs available for installation, needs
integration into GUI still for user to select them



Modified: pcbsd/current/SysInstaller/backend.cpp
===================================================================
--- pcbsd/current/SysInstaller/backend.cpp	2010-08-25 17:38:11 UTC (rev 7439)
+++ pcbsd/current/SysInstaller/backend.cpp	2010-08-25 18:38:35 UTC (rev 7440)
@@ -63,7 +63,7 @@
 {
     QString line;
     QStringList list;
-
+   
     Process p(QStringList() << "update-part-list");
     if(p.waitForFinished()) {
       while (p.canReadLine()) {
@@ -429,13 +429,46 @@
 }
 
 // Function which checks for our GUI package schema data, and sets found if its located
-QStringList Backend::getPackageData(bool &found)
+QList<QStringList> Backend::getPackageData(bool &found)
 {
-  QDir pkgDir = QDir("/usr/local/share/pcbsd/base-ports"); 
-  if (! pkgDir.exists() ) {
-    found=false;
-    return QStringList();
+  QList<QStringList> metaPkgs;
+  found=false;
+  QString tmp, mName, mDesc, mIcon, mParent;
+  QStringList package;
+
+  QProcess pcmp;
+  qDebug() << "Searching for meta-pkgs...";
+  pcmp.start(QString("pc-metapkgmanager"), QStringList() << "list");
+  if (pcmp.waitForFinished()) {
+    while (pcmp.canReadLine()) {
+        tmp = pcmp.readLine().simplified();
+	if ( tmp.indexOf("Meta Package: ") == 0) {
+		mName = tmp.replace("Meta Package: ", "");
+		continue;
+	}
+	if ( tmp.indexOf("Description: ") == 0) {
+		mDesc = tmp.replace("Description: ", "");
+		continue;
+	}
+	if ( tmp.indexOf("Icon: ") == 0) {
+		mIcon = tmp.replace("Icon: ", "");
+		continue;
+	}
+	if ( tmp.indexOf("Parent: ") == 0) {
+		mParent = tmp.replace("Parent: ", "");
+		continue;
+	}
+	if ( tmp.indexOf("Required Packages:") == 0) {
+		// Now add this meta-pkg to the string list
+		package.clear();
+		qDebug() << "Found Package" << mName << mDesc << mIcon << mParent;
+		package << mName << mDesc << mIcon << mParent;
+		metaPkgs.append(package);
+		found = true;
+	}
+    }
   }
 
+  return metaPkgs;
 }
 

Modified: pcbsd/current/SysInstaller/backend.h
===================================================================
--- pcbsd/current/SysInstaller/backend.h	2010-08-25 17:38:11 UTC (rev 7439)
+++ pcbsd/current/SysInstaller/backend.h	2010-08-25 18:38:35 UTC (rev 7440)
@@ -58,7 +58,7 @@
     static int systemMemory();
     static int deleteMBRPart(QString Slice, QString &output);
     static int addMBRPart(QString Disk, int size, QString &output);
-    static QStringList getPackageData(bool &found);
+    static QList<QStringList> getPackageData(bool &found);
     //static QList<QStringList> slices();
 
 };



More information about the Commits mailing list