[PC-BSD Commits] r15475 - users/ken/ModuleBuilder

svn at pcbsd.org svn at pcbsd.org
Fri Feb 17 20:04:13 PST 2012


Author: kenmoore
Date: 2012-02-18 04:04:12 +0000 (Sat, 18 Feb 2012)
New Revision: 15475

Modified:
   users/ken/ModuleBuilder/modBuild.cpp
Log:
Add a few more functions to the ModuleBuilder class



Modified: users/ken/ModuleBuilder/modBuild.cpp
===================================================================
--- users/ken/ModuleBuilder/modBuild.cpp	2012-02-18 01:34:56 UTC (rev 15474)
+++ users/ken/ModuleBuilder/modBuild.cpp	2012-02-18 04:04:12 UTC (rev 15475)
@@ -73,7 +73,7 @@
       //Pull apart the variable and the value
       QString var,val;
       var = line.section("=",0,0,QString::SectionSkipEmpty).trimmed();
-      val = line.section("=",1,1).section(";",0,0,QString::SectionSkipEmpty).trimmed();
+      val = line.section("=",1,1).section(";",0,0,QString::SectionSkipEmpty).trimmed().remove("\"");
       //might need to add check for values that cross multiple lines later (mkStructure entries especially)
       if(var=="PBI_PROGNAME"){ progStruct[0] = val; }
       else if(var=="PBI_PROGWEB"){ progStruct[1] = val; }
@@ -256,8 +256,29 @@
 }
 
 bool ModBuild::makeExternalLinks(QString modDir, QStringList binary, QStringList options){
-
-
+  //binary list and options list need to be the same size
+  if(binary.length() != options.length()){ 
+    qDebug() << "Error: External Links lists are not the same size";
+    return FALSE;
+  }
+  //Check module directory and get filename
+  if(!modDir.endsWith("/")){ modDir.append("/"); }
+  QString fileName = modDir+"external-links";
+  //Get the contents to write to the file
+  QStringList contents;
+  //Standard Header for file
+  contents << "# Files to be Sym-Linked into the default LOCALBASE";
+  contents << "# One per-line, relative to %%PBI_APPDIR%% and LOCALBASE";
+  contents << "# Defaults to keeping any existing files in LOCALBASE";
+  contents << "# Use action binary for binaries that need wrapper functionality\n";
+  contents << "# TARGET             LINK IN LOCALBASE         ACTION";
+  //add the desired binaries
+  for(int i=0; i<binary.length(); i++){
+    contents << binary[i]+"     "+binary[i]+"     "+options[i];
+  }
+  //Create the external-links file
+  bool status = createFile(fileName, contents);
+  return status;
 }
 
 bool ModBuild::createFile(QString fileName, QStringList contents){
@@ -296,4 +317,44 @@
   //Return success
   qDebug() << fileName+": Success";
   return TRUE;
+}
+
+QString ModBuild::readValue(QString variable){
+  QString val;
+  if(variable=="PBI_PROGNAME"){ val = progStruct[0]; }
+  else if(variable=="PBI_PROGWEB"){ val = progStruct[1]; }
+  else if(variable=="PBI_PROGAUTHOR"){ val = progStruct[2]; }
+  else if(variable=="PBI_PROGICON"){ val = progStruct[3]; }
+  else if(variable=="PBI_MAKEPORT"){ val = mkStruct[0]; }
+  else if(variable=="PBI_MKPORTBEFORE"){ val = mkStruct[1]; }
+  else if(variable=="PBI_MKPORTAFTER"){ val = mkStruct[2]; }
+  else if(variable=="PBI_MAKEOPTS"){ val = mkStruct[3]; }
+  else if(variable=="PBI_REQUIRESROOT"){ val = serverStruct[0]; }
+  else if(variable=="PBI_BUILDKEY"){ val = serverStruct[1]; }
+  else if(variable=="PBI_AB_PRIORITY"){ val = serverStruct[2]; }
+  else if(variable=="PBI_AB_NOTMPFS"){ val = serverStruct[3]; }
+  else{
+    qDebug() << "Error: Invalid variable name to read";
+  }
+  return val;
+}
+
+bool ModBuild::writeValue(QString variable, QString value){
+  if(variable=="PBI_PROGNAME"){ progStruct[0] = value; }
+  else if(variable=="PBI_PROGWEB"){ progStruct[1] = value; }
+  else if(variable=="PBI_PROGAUTHOR"){ progStruct[2] = value; }
+  else if(variable=="PBI_PROGICON"){ progStruct[3] = value; }
+  else if(variable=="PBI_MAKEPORT"){ mkStruct[0] = value; }
+  else if(variable=="PBI_MKPORTBEFORE"){ mkStruct[1] = value; }
+  else if(variable=="PBI_MKPORTAFTER"){ mkStruct[2] = value; }
+  else if(variable=="PBI_MAKEOPTS"){ mkStruct[3] = value; }
+  else if(variable=="PBI_REQUIRESROOT"){ serverStruct[0] = value; }
+  else if(variable=="PBI_BUILDKEY"){ serverStruct[1] = value; }
+  else if(variable=="PBI_AB_PRIORITY"){ serverStruct[2] = value; }
+  else if(variable=="PBI_AB_NOTMPFS"){ serverStruct[3] = value; }
+  else{
+    qDebug() << "Error: Invalid variable name to read";
+    return FALSE;
+  }
+  return TRUE;
 }
\ No newline at end of file



More information about the Commits mailing list