[PC-BSD Commits] r19424 - pcbsd/current/src-qt4/EasyPBI

svn at pcbsd.org svn at pcbsd.org
Thu Sep 20 06:30:46 PDT 2012


Author: kenmoore
Date: 2012-09-20 13:30:46 +0000 (Thu, 20 Sep 2012)
New Revision: 19424

Modified:
   pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp
   pcbsd/current/src-qt4/EasyPBI/mainwindow.h
Log:
Fix a couple bugs in EasyPBI: perform a more accurate verification that the PBI build was successful, also fix loading the saved PBI build configurations



Modified: pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp	2012-09-20 12:11:48 UTC (rev 19423)
+++ pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp	2012-09-20 13:30:46 UTC (rev 19424)
@@ -127,6 +127,9 @@
   
   //Scan for the external utilities needed to build PBI's
   findExternalCommands();
+  //Set a couple more internal flags
+  PBI_BUILDING_NOW.clear();
+  PBI_BUILD_TERMINATED=FALSE;
 }
 
 void MainWindow::Reset_Form()
@@ -418,6 +421,7 @@
   out << ui->linePBIDigSigFile->text() + "\n";
   if(ui->checkTMPFS->isChecked()){out << 1;}
   else{out << 0;}
+  out << "\n";
   if(ui->checkUseCache->isChecked()){out << 1;}
   else{out << 0;}
   
@@ -515,6 +519,9 @@
   connect(p,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(PBIbuildFinished(int,QProcess::ExitStatus)) );
   connect(p,SIGNAL(error(QProcess::ProcessError)),this,SLOT(buildError(QProcess::ProcessError)) );
   
+  //Setup the flag for the finishing checks
+  ModBuild::loadPBIconf(modDir);
+  PBI_BUILDING_NOW=outdir+":::"+ModBuild::readValue("PBI_PROGNAME");
   //Start the Process
   qDebug() << "Starting the PBI build process...";
   p->start(cmd);  
@@ -532,12 +539,20 @@
 void MainWindow::PBIbuildFinished(int exitCode,QProcess::ExitStatus exitStatus){
   //Check to see if the PBI process finished successfully
   qDebug() << "PBI build process Finished" << exitStatus << exitCode;
-  if(exitCode == 0){
-    if(exitStatus==QProcess::NormalExit){
+  //Check that the new PBI exists
+  QDir outdir( PBI_BUILDING_NOW.section(":::",0,0) );
+  QString pbiname= PBI_BUILDING_NOW.section(":::",1,1).toLower().remove(" ");
+  QFileInfoList fL = outdir.entryInfoList( QStringList() << pbiname+"*.pbi" ,QDir::Files | QDir::NoSymLinks);
+  bool success = FALSE;
+  for(int i=0; i<fL.length(); i++){
+  	  qint64 msdiff = QDateTime::currentMSecsSinceEpoch() - fL[i].created().toMSecsSinceEpoch();
+  	  if(msdiff < 60000){ success = true; break; } //if less than a minute since creation of file - success
+  }
+  
+  if(exitCode == 0 && success){
       QMessageBox::information(this,tr("PBI Build Success"),tr("The PBI finished building successfully"));
-    }else{
+  }else if(exitCode == 0 && PBI_BUILD_TERMINATED){
       //The user killed the process - No Message
-    }
   }else{
     QMessageBox::warning(this,tr("PBI Build Failure"),tr("The PBI failed to build.")+"\n"+tr("Please check the build log to find the cause of the failure and adjust the module accordingly"));
   }
@@ -545,6 +560,8 @@
   ui->pushSaveLog->setEnabled(TRUE);
   ui->pushKillBuild->setEnabled(FALSE);
   p->close();
+  PBI_BUILDING_NOW.clear();
+  PBI_BUILD_TERMINATED=FALSE;
 }
 
 void MainWindow::killPBIBuild(){
@@ -552,6 +569,7 @@
     //qDebug() << "Process PID:" << p->pid(); 
     p->terminate();
     ui -> buildOutputArea->append("---PBI Build Terminated---");
+    PBI_BUILD_TERMINATED=TRUE;
   }
 }
 

Modified: pcbsd/current/src-qt4/EasyPBI/mainwindow.h
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/mainwindow.h	2012-09-20 12:11:48 UTC (rev 19423)
+++ pcbsd/current/src-qt4/EasyPBI/mainwindow.h	2012-09-20 13:30:46 UTC (rev 19424)
@@ -14,6 +14,7 @@
 #include <QDir>
 #include <QProcess>
 #include <QTimer>
+#include <QDateTime>
 //#include "pbi.h"
 
 #ifndef TRUE
@@ -99,7 +100,8 @@
     void findExternalCommands();
     QStringList getPortBinaries(QString);
     QString PROG_DIR, PORTS_DIR, PORT_SELECTED, PBIOUT_DIR, MODOUT_DIR, CACHE_DIR, PROGVERSION, PBISETTINGS_FILE, DEFAULTICON_FILE;
-    QString SU_CMD, PBIBUILD_CMD;
+    QString SU_CMD, PBIBUILD_CMD, PBI_BUILDING_NOW;
+    bool PBI_BUILD_TERMINATED;
     QProcess *p;
 };
 



More information about the Commits mailing list