[PC-BSD Commits] r2932 - in pcbsd: branches/7.0/PBIdelete trunk/PBIdelete

svn at pcbsd.org svn at pcbsd.org
Wed Oct 22 10:40:57 PDT 2008


Author: kris
Date: 2008-10-22 10:40:56 -0700 (Wed, 22 Oct 2008)
New Revision: 2932

Removed:
   pcbsd/branches/7.0/PBIdelete/PBIdelete.ui
   pcbsd/trunk/PBIdelete/PBIdelete.ui
Modified:
   pcbsd/branches/7.0/PBIdelete/PBIdelete.pro
   pcbsd/branches/7.0/PBIdelete/main.cpp
   pcbsd/trunk/PBIdelete/PBIdelete.pro
   pcbsd/trunk/PBIdelete/main.cpp
Log:

Fixed a bug in the pbidelete tool, which would cause the program to finish, before the actual /Programs/<PBI> directory
was completely removed. This causes other programs to fail, such as the SystemUpdater, which depended upon an old PBI
being removed completely before starting the install of the new PBI. 



Modified: pcbsd/branches/7.0/PBIdelete/PBIdelete.pro
===================================================================
--- pcbsd/branches/7.0/PBIdelete/PBIdelete.pro	2008-10-22 15:55:34 UTC (rev 2931)
+++ pcbsd/branches/7.0/PBIdelete/PBIdelete.pro	2008-10-22 17:40:56 UTC (rev 2932)
@@ -7,7 +7,7 @@
 
 SOURCES	+= main.cpp
 
-FORMS	= PBIdelete.ui
+//FORMS	= PBIdelete.ui
 
 
 QT +=qt3support

Modified: pcbsd/branches/7.0/PBIdelete/main.cpp
===================================================================
--- pcbsd/branches/7.0/PBIdelete/main.cpp	2008-10-22 15:55:34 UTC (rev 2931)
+++ pcbsd/branches/7.0/PBIdelete/main.cpp	2008-10-22 17:40:56 UTC (rev 2932)
@@ -1,4 +1,4 @@
-#include <iostream.h>
+#include <iostream>
 #include <qvariant.h>
 #include <qapplication.h>
 #include <qstring.h>
@@ -6,6 +6,7 @@
 #include <Q3Process>
 #include <qobject.h>
 #include <qtextstream.h>
+using namespace std;
 
 QString ProgName[5000];
 QString ProgVer[5000];
@@ -260,34 +261,25 @@
 void RemoveFiles( void )
 {
     QString ProgDirName = RemovePBI;
+    QString command;
     
     QString Binary;
         
     int i = 0;
  
-    cout << "Removing Directory\n";
+    cout << "Removing Directory: /Programs/" << ProgDirName.toStdString() << "\n";
 
    
     // Remove the Mime Fles
     while ( ! MimeFile[RemNum][i].isEmpty() )
     {
 	// Remove the hidden file
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "rm" );
-	RemoveFile->addArgument( "/usr/local/share/applnk/.hidden/" + MimeFile[RemNum][i] + ".desktop" ); 
+        command = "rm '/usr/local/share/applnk/.hidden/" + MimeFile[RemNum][i] + ".desktop' >/dev/null 2>/dev/null";
+        getLineFromCommandOutput(command);
 	 
-	if ( !RemoveFile->start() ) {
-	      
-	}
-	
 	// Remove the application file
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "rm" );
-	RemoveFile->addArgument( "/usr/local/share/mimelnk/application/" + MimeFile[RemNum][i] + ".desktop" ); 
-	 
-	if ( !RemoveFile->start() ) {
-	      
-	}
+        command = "rm '/usr/local/share/mimelnk/application/" + MimeFile[RemNum][i] + ".desktop' >/dev/null 2>/dev/null";
+        getLineFromCommandOutput(command);
 	
 	i++;
     }
@@ -312,68 +304,32 @@
 	}
 	
 	// Remove the script
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "rm" );
-	RemoveFile->addArgument( "/Programs/.sbin/" + Binary ); 
+        command = "rm '/Programs/.sbin/" + Binary + "' >/dev/null 2>/dev/null";
+        getLineFromCommandOutput(command);
 		   
-	if ( !RemoveFile->start() ) {
-	      
-	}
-	
 
 	// Remove the Desktop item
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "/Programs/.bin/RemoveDesktopLink.sh" );
-	RemoveFile->addArgument( Binary + ".desktop" ); 
-	RemoveFile->addArgument( ProgName[RemNum] ); 	   
-	if ( !RemoveFile->start() ) {
-	      
-	}
+        command = "/Programs/.bin/RemoveDesktopLink.sh '" + Binary + ".desktop' '" + ProgName[RemNum] + "' >/dev/null 2>/dev/null" ;
+        getLineFromCommandOutput(command);
 
 
 	
          i++;
      }
     
-    
-    
-    
-    	// Remove the start menu item
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "rm" );
-	RemoveFile->addArgument( "-r" );
-	RemoveFile->addArgument( "/usr/local/share/applnk/My Programs/" + ProgName[RemNum] ); 
-	
-
+    	// Remove the old start menu items
+        command = "rm -rf '/usr/local/share/applnk/My Programs/" + ProgName[RemNum] + "' >/dev/null 2>/dev/null";
+        getLineFromCommandOutput(command);
 		   
-	if ( !RemoveFile->start() ) {
-	      
-	}
-	
-
     	// Remove the start menu item
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "rm" );
-	RemoveFile->addArgument( "-r" );
-	RemoveFile->addArgument( "/usr/local/share/applnk/" + ProgName[RemNum] ); 
-	
+        command = "rm -rf '/usr/local/share/applnk/" + ProgName[RemNum] + "' >/dev/null 2>/dev/null";
+        getLineFromCommandOutput(command);
 
 		   
-	if ( !RemoveFile->start() ) {
-	      
-	}
-
-
 	// Remove the program folder
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "rm" );
-	RemoveFile->addArgument( "-r" );
-	RemoveFile->addArgument( "/Programs/" + ProgDirName ); 
-	
-		   
-	if ( !RemoveFile->start() ) {
-	      
-	}
+        command = "rm -r '/Programs/" + ProgDirName + "' >/dev/null 2>/dev/null";
+        getLineFromCommandOutput(command);
+
 }
 
 
@@ -381,7 +337,7 @@
 void show_opts(void)
 {
 
-  cout << "PBIdelete Version 1.0\n--------\n" << " PBIdelete -remove <pbi> \t- Removes a PBI file\n PBIdelete -list \t\t- Lists all PBI's installed\n\n"; 
+  cout << "PBIdelete Version 1.1\n--------\n" << " PBIdelete -remove <pbi> \t- Removes a PBI file\n PBIdelete -list \t\t- Lists all PBI's installed\n\n"; 
 
 }
 

Modified: pcbsd/trunk/PBIdelete/PBIdelete.pro
===================================================================
--- pcbsd/trunk/PBIdelete/PBIdelete.pro	2008-10-22 15:55:34 UTC (rev 2931)
+++ pcbsd/trunk/PBIdelete/PBIdelete.pro	2008-10-22 17:40:56 UTC (rev 2932)
@@ -7,7 +7,7 @@
 
 SOURCES	+= main.cpp
 
-FORMS	= PBIdelete.ui
+//FORMS	= PBIdelete.ui
 
 
 QT +=qt3support

Modified: pcbsd/trunk/PBIdelete/main.cpp
===================================================================
--- pcbsd/trunk/PBIdelete/main.cpp	2008-10-22 15:55:34 UTC (rev 2931)
+++ pcbsd/trunk/PBIdelete/main.cpp	2008-10-22 17:40:56 UTC (rev 2932)
@@ -1,4 +1,4 @@
-#include <iostream.h>
+#include <iostream>
 #include <qvariant.h>
 #include <qapplication.h>
 #include <qstring.h>
@@ -6,6 +6,7 @@
 #include <Q3Process>
 #include <qobject.h>
 #include <qtextstream.h>
+using namespace std;
 
 QString ProgName[5000];
 QString ProgVer[5000];
@@ -260,34 +261,25 @@
 void RemoveFiles( void )
 {
     QString ProgDirName = RemovePBI;
+    QString command;
     
     QString Binary;
         
     int i = 0;
  
-    cout << "Removing Directory\n";
+    cout << "Removing Directory: /Programs/" << ProgDirName.toStdString() << "\n";
 
    
     // Remove the Mime Fles
     while ( ! MimeFile[RemNum][i].isEmpty() )
     {
 	// Remove the hidden file
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "rm" );
-	RemoveFile->addArgument( "/usr/local/share/applnk/.hidden/" + MimeFile[RemNum][i] + ".desktop" ); 
+        command = "rm '/usr/local/share/applnk/.hidden/" + MimeFile[RemNum][i] + ".desktop' >/dev/null 2>/dev/null";
+        getLineFromCommandOutput(command);
 	 
-	if ( !RemoveFile->start() ) {
-	      
-	}
-	
 	// Remove the application file
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "rm" );
-	RemoveFile->addArgument( "/usr/local/share/mimelnk/application/" + MimeFile[RemNum][i] + ".desktop" ); 
-	 
-	if ( !RemoveFile->start() ) {
-	      
-	}
+        command = "rm '/usr/local/share/mimelnk/application/" + MimeFile[RemNum][i] + ".desktop' >/dev/null 2>/dev/null";
+        getLineFromCommandOutput(command);
 	
 	i++;
     }
@@ -312,68 +304,32 @@
 	}
 	
 	// Remove the script
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "rm" );
-	RemoveFile->addArgument( "/Programs/.sbin/" + Binary ); 
+        command = "rm '/Programs/.sbin/" + Binary + "' >/dev/null 2>/dev/null";
+        getLineFromCommandOutput(command);
 		   
-	if ( !RemoveFile->start() ) {
-	      
-	}
-	
 
 	// Remove the Desktop item
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "/Programs/.bin/RemoveDesktopLink.sh" );
-	RemoveFile->addArgument( Binary + ".desktop" ); 
-	RemoveFile->addArgument( ProgName[RemNum] ); 	   
-	if ( !RemoveFile->start() ) {
-	      
-	}
+        command = "/Programs/.bin/RemoveDesktopLink.sh '" + Binary + ".desktop' '" + ProgName[RemNum] + "' >/dev/null 2>/dev/null" ;
+        getLineFromCommandOutput(command);
 
 
 	
          i++;
      }
     
-    
-    
-    
-    	// Remove the start menu item
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "rm" );
-	RemoveFile->addArgument( "-r" );
-	RemoveFile->addArgument( "/usr/local/share/applnk/My Programs/" + ProgName[RemNum] ); 
-	
-
+    	// Remove the old start menu items
+        command = "rm -rf '/usr/local/share/applnk/My Programs/" + ProgName[RemNum] + "' >/dev/null 2>/dev/null";
+        getLineFromCommandOutput(command);
 		   
-	if ( !RemoveFile->start() ) {
-	      
-	}
-	
-
     	// Remove the start menu item
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "rm" );
-	RemoveFile->addArgument( "-r" );
-	RemoveFile->addArgument( "/usr/local/share/applnk/" + ProgName[RemNum] ); 
-	
+        command = "rm -rf '/usr/local/share/applnk/" + ProgName[RemNum] + "' >/dev/null 2>/dev/null";
+        getLineFromCommandOutput(command);
 
 		   
-	if ( !RemoveFile->start() ) {
-	      
-	}
-
-
 	// Remove the program folder
-	RemoveFile = new Q3Process();
-	RemoveFile->addArgument( "rm" );
-	RemoveFile->addArgument( "-r" );
-	RemoveFile->addArgument( "/Programs/" + ProgDirName ); 
-	
-		   
-	if ( !RemoveFile->start() ) {
-	      
-	}
+        command = "rm -r '/Programs/" + ProgDirName + "' >/dev/null 2>/dev/null";
+        getLineFromCommandOutput(command);
+
 }
 
 
@@ -381,7 +337,7 @@
 void show_opts(void)
 {
 
-  cout << "PBIdelete Version 1.0\n--------\n" << " PBIdelete -remove <pbi> \t- Removes a PBI file\n PBIdelete -list \t\t- Lists all PBI's installed\n\n"; 
+  cout << "PBIdelete Version 1.1\n--------\n" << " PBIdelete -remove <pbi> \t- Removes a PBI file\n PBIdelete -list \t\t- Lists all PBI's installed\n\n"; 
 
 }
 



More information about the Commits mailing list