aboutsummaryrefslogtreecommitdiff
path: root/ports-mgmt
diff options
context:
space:
mode:
Diffstat (limited to 'ports-mgmt')
-rw-r--r--ports-mgmt/portmanager/Makefile4
-rw-r--r--ports-mgmt/portmanager/files/patch-0.2.4_1976
-rw-r--r--ports-mgmt/portmanager/pkg-plist1
3 files changed, 979 insertions, 2 deletions
diff --git a/ports-mgmt/portmanager/Makefile b/ports-mgmt/portmanager/Makefile
index 85c6d6edfc01..85613701960a 100644
--- a/ports-mgmt/portmanager/Makefile
+++ b/ports-mgmt/portmanager/Makefile
@@ -7,7 +7,7 @@
PORTNAME= portmanager
PORTVERSION= 0.2.4
-PORTREVISION= 0
+PORTREVISION= 1
#-----------------------------------------
#for local use, remove before submitting PR
CATEGORIES= sysutils
@@ -44,7 +44,7 @@ INSTALL_TARGET= install info
post-patch:
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g ; \
- s|0.2.4|${PORTVERSION}_${PORTREVISION}|g ; \
+ s|0.2.5|${PORTVERSION}_${PORTREVISION}|g ; \
s|%%PORTSDIR%%|${PORTSDIR}|g ; \
s|%%PKG_DBDIR%%|${PKG_DBDIR}|g' ${WRKSRC}/libPMGR/src/libPMGR.h
diff --git a/ports-mgmt/portmanager/files/patch-0.2.4_1 b/ports-mgmt/portmanager/files/patch-0.2.4_1
new file mode 100644
index 000000000000..29224c19f958
--- /dev/null
+++ b/ports-mgmt/portmanager/files/patch-0.2.4_1
@@ -0,0 +1,976 @@
+diff -ruN ./THANKS ../portmanager-0.2.5/THANKS
+--- ./THANKS Tue Jan 18 22:24:04 2005
++++ ../portmanager-0.2.5/THANKS Wed Jan 26 11:28:42 2005
+@@ -1,11 +1,14 @@
+ I know I am missing a few people who helped early on with
+-portmanager in this file, please accept my appologies.
++portmanager in this file, please accept my apologies.
+
+
+ Thanks to:
+
+ Date of entry
+
++Jan 26, 2005 Bart Silverstrim <bsilverstrim@athensasd.org> for identifying a looping problem
++ with XFree86-dri and his patience in helping me solve it.
++
+ Jan 18 update portmanager to ver 0.2.3
+
+ NOTE: portmanager's normal hosting site is broken, thanks to Chuck Swiger for
+@@ -29,11 +32,11 @@
+ in PMGRrDbCreate.c
+
+ 2004.12.27 "Noah" <admin2@enabled.com> thanks for reporting segfault when portmanager
+- self updates.(note emailed)
++ self updates.(note mailed)
+
+ 2004.12.27 Jason/Carolyn <chenson@ec.rr.com> thanks for suggesting port ignore option,
+- I will try to have it implemented by version 0.2.3(note emailed)
++ I will try to have it implemented by version 0.2.3(note mailed)
+
+ 2004.12.27 John E Hein <jhein@timing.com> for teaching me how to set portmanager up
+- to run from a PREFIX directory. Implemented in ver 0.2.2(note emailed)
++ to run from a PREFIX directory. Implemented in ver 0.2.2(note mailed)
+
+diff -ruN ./libMG/src/MGdbAdd.c ../portmanager-0.2.5/libMG/src/MGdbAdd.c
+--- ./libMG/src/MGdbAdd.c Wed Jan 19 22:12:30 2005
++++ ../portmanager-0.2.5/libMG/src/MGdbAdd.c Mon Jan 24 15:59:26 2005
+@@ -70,7 +70,7 @@
+
+ /*zzzzzzzzzzzzzz*/
+ db->parent.mallocIdx--;
+- va_end(paramPtr); /* Clean up. */
++ va_end(paramList); /* Clean up. */
+ /*zzzzzzzzzzzzzz*/
+
+ fprintf( dbFileStream, "\n" );
+diff -ruN ./libMG/src/MGdbCreate.c ../portmanager-0.2.5/libMG/src/MGdbCreate.c
+--- ./libMG/src/MGdbCreate.c Tue Jan 18 19:30:53 2005
++++ ../portmanager-0.2.5/libMG/src/MGdbCreate.c Mon Jan 24 16:05:24 2005
+@@ -61,7 +61,7 @@
+
+ if(DEBUG)
+ {
+- fprintf(stdout, "%s\n", DOUBLELINES);
++ fprintf(stdout, "%s\n", DOUBLE_LINES);
+ fprintf( stdout, "%s DEBUG: %s = %s\n", id, "db->parent.path", db->parent.path );
+ }
+
+@@ -100,7 +100,7 @@
+
+ /*zzzzzzzzzzzzzz*/
+ db->parent.mallocIdx--;
+- va_end(paramPtr); /* Clean up. */
++ va_end(paramList); /* Clean up. */
+ /*zzzzzzzzzzzzzz*/
+
+ db->parent.recordQty++;
+diff -ruN ./libMG/src/MGdbSeek.3 ../portmanager-0.2.5/libMG/src/MGdbSeek.3
+--- ./libMG/src/MGdbSeek.3 Tue Jan 18 19:30:53 2005
++++ ../portmanager-0.2.5/libMG/src/MGdbSeek.3 Fri Jan 21 08:34:42 2005
+@@ -18,7 +18,7 @@
+ .Fa "classDb* db"
+ .Fa "char* fieldName"
+ .Fa "char* search fieldName for this value"
+-.Fa "char* return value in this field"
++.Fa "char* return value of this field"
+ .Fc
+ .Sh DESCRIPTION
+ Searches key field for a given value and returns contents of value field.
+diff -ruN ./libMG/src/MGdirSkip.c ../portmanager-0.2.5/libMG/src/MGdirSkip.c
+--- ./libMG/src/MGdirSkip.c Tue Jan 18 19:30:53 2005
++++ ../portmanager-0.2.5/libMG/src/MGdirSkip.c Fri Jan 21 20:44:59 2005
+@@ -36,12 +36,6 @@
+
+ if(dir->parent.eof)
+ {
+- if( DEBUG_MGdir || DEBUG )
+- {
+- fprintf(stdout, "%s\n", LINES);
+- fprintf( stdout, "%s DEBUG level 1: dir->parent.fopenIdx = %d dir->parent.mallocIdx = %d\n",
+- id, dir->parent.fopenIdx, dir->parent.mallocIdx );
+- }
+ return(0);
+ }
+ dir->parent.recordIdx++;
+@@ -53,11 +47,5 @@
+ dir->parent.eof = 1;
+ }
+
+- if( DEBUG_MGdir || DEBUG )
+- {
+- fprintf(stdout, "%s\n", LINES);
+- fprintf( stdout, "%s DEBUG level 1: dir->parent.fopenIdx = %d dir->parent.mallocIdx = %d\n",
+- id, dir->parent.fopenIdx, dir->parent.mallocIdx );
+- }
+ return(0);
+ }
+diff -ruN ./libMG/src/MGdirTest.c ../portmanager-0.2.5/libMG/src/MGdirTest.c
+--- ./libMG/src/MGdirTest.c Tue Jan 18 19:30:53 2005
++++ ../portmanager-0.2.5/libMG/src/MGdirTest.c Fri Jan 21 20:45:30 2005
+@@ -44,7 +44,7 @@
+
+ if( DEBUG_MGdir || DEBUG )
+ {
+- fprintf(stdout, "%s\n", LINES);
++ fprintf(stdout, "%s\n", SINGLE_LINES);
+ fprintf( stdout, "%s DEBUG level 1: dir->parent.fopenIdx = %d dir->parent.mallocIdx = %d\n",
+ id, dir->parent.fopenIdx, dir->parent.mallocIdx );
+ }
+diff -ruN ./libMG/src/libMG.3 ../portmanager-0.2.5/libMG/src/libMG.3
+--- ./libMG/src/libMG.3 Thu Jan 20 10:22:06 2005
++++ ../portmanager-0.2.5/libMG/src/libMG.3 Sun Jan 23 15:08:26 2005
+@@ -4,7 +4,7 @@
+ .\" The following commands are required for all man pages.
+ .Dd JANUARY 8, 2004
+ .Os FreeBSD
+-.Dt MGDBCREATE 3 PRM
++.Dt LIBMG 3 PRM
+ .\=======================================================================
+ .Sh NAME
+ .Nm libMG
+@@ -78,7 +78,7 @@
+ .Fa "classDb* db"
+ .Fa "char* fieldName"
+ .Fa "char* search fieldName for this value"
+-.Fa "char* return value in this field"
++.Fa "char* return value of this field"
+ .Fc
+ .\.11....................................................................
+ .Ft classDir*
+@@ -121,7 +121,7 @@
+ such as MGrIntToString. (MGrIntToString is derived from a similar routine
+ found in groff)
+
+-Purpose of this man page is to serve as a quick reference to use of each
++Purpose of this man page is to serve as a quick reference to use for each
+ routine and cross reference of each routine's man page.
+
+ Naming conventions are as follows: Convenience routines begin with
+diff -ruN ./libMG/src/libMG.h ../portmanager-0.2.5/libMG/src/libMG.h
+--- ./libMG/src/libMG.h Tue Jan 18 19:30:53 2005
++++ ../portmanager-0.2.5/libMG/src/libMG.h Fri Jan 21 23:53:12 2005
+@@ -57,8 +57,8 @@
+ #define SPACE 32
+ #define TAB 9
+
+-#define LINES "-------------------------------------------------------------------------------"
+-#define DOUBLELINES "==============================================================================="
++#define SINGLE_LINES "-------------------------------------------------------------------------------"
++#define DOUBLE_LINES "==============================================================================="
+
+ typedef struct classDb classDb;
+ typedef struct classDir classDir;
+diff -ruN ./libPMGR/src/PMGRrDbCreate.c ../portmanager-0.2.5/libPMGR/src/PMGRrDbCreate.c
+--- ./libPMGR/src/PMGRrDbCreate.c Thu Jan 20 10:44:19 2005
++++ ../portmanager-0.2.5/libPMGR/src/PMGRrDbCreate.c Wed Jan 26 10:57:36 2005
+@@ -107,7 +107,7 @@
+ property->fieldNewPortName,
+ NULL );
+ /*zzzzzzzzzzzzzz*/
+-
++
+ if( !MGrIfFileExist( property->cacheDbFileName ) )
+ {
+ /*zzzzzzzzzzzzzz*/
+diff -ruN ./libPMGR/src/PMGRrDbDestroy.c ../portmanager-0.2.5/libPMGR/src/PMGRrDbDestroy.c
+--- ./libPMGR/src/PMGRrDbDestroy.c Tue Jan 18 19:30:53 2005
++++ ../portmanager-0.2.5/libPMGR/src/PMGRrDbDestroy.c Wed Jan 26 10:58:40 2005
+@@ -41,7 +41,6 @@
+ property->objIdx--;
+ MGdbDestroy( property->cacheDb );
+
+-
+ if(property->objIdx)
+ {
+ fprintf( stderr, "%s %s error: property->objIdx = %d \n", id, ver, property->objIdx );
+diff -ruN ./libPMGR/src/PMGRrDoUpgrade.c ../portmanager-0.2.5/libPMGR/src/PMGRrDoUpgrade.c
+--- ./libPMGR/src/PMGRrDoUpgrade.c Thu Jan 20 16:19:04 2005
++++ ../portmanager-0.2.5/libPMGR/src/PMGRrDoUpgrade.c Wed Jan 26 10:31:51 2005
+@@ -41,7 +41,7 @@
+ {
+ property->portManagerUpdated = 1;
+ }
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+
+ MGdbGoTop( property->outOfDatePortsDb );
+ oldPortDir = MGdbSeek( property->outOfDatePortsDb, property->fieldOldPortName, oldPortName,
+@@ -65,7 +65,7 @@
+ property->fieldNewPortName );
+
+ fprintf( stdout, "UPGRADING %s reason %s %s\n", oldPortName, reason, reasonPortName );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ /************************************************************************/
+ /* Command "1" " make clean " */
+ /************************************************************************/
+@@ -112,10 +112,10 @@
+ strcat( command, "; make clean " );
+ }
+
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "intitial clean of work directories \n" );
+ fprintf( stdout, "%s %s command: #1 of 8 %s\n", id, ver, command );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+
+ errorCode = system(command);
+
+@@ -174,10 +174,10 @@
+ strcat( command, "; make " );
+ }
+
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "update %s \n", oldPortName );
+ fprintf( stdout, "%s %s command: #2 of 8 %s\n", id, ver, command );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+
+ errorCode = system(command);
+ mallocIdx--;
+@@ -214,10 +214,10 @@
+ strcat( command, "; pkg_create -b " );
+ strcat( command, oldPortName );
+
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "backing up installed %s before removing it \n", oldPortName );
+ fprintf( stdout, "%s %s command: #3 of 8 %s\n", id, ver, command );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ system(command);
+ /*
+ An error here is no big deal, if for example the port is not installed it will not be able
+@@ -239,20 +239,49 @@
+ command[0] = 0;
+ strcpy(command, "pkg_delete -f ");
+ strcat(command, oldPortName);
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "removing old %s \n", oldPortName );
+ fprintf( stdout, "%s %s command: #4 of 8 %s\n", id, ver, command );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+
+- system(command);
+- /*
+- If deinstall has started, even with an error it is better to continue and try to install
+- the new port
+- */
++ errorCode = system(command);
+ /*zzzzzzzzzzzzz*/
+ mallocIdx--;
+ free( command );
+ /*zzzzzzzzzzzzz*/
++
++ if( errorCode )
++ {
++ stringSize = strlen( "cd " )
++ + strlen(PORTSDIR)
++ + strlen(oldPortDir)
++ + strlen( "; make deinstall " )
++ + 1;
++
++ /*zzzzzzzzzzzzz*/
++ mallocIdx++;
++ command = (char*)malloc( stringSize );
++ /*zzzzzzzzzzzzz*/
++ command[0] = 0;
++
++ strcpy( command, "cd " );
++ strcat( command, PORTSDIR );
++ strcat( command, oldPortDir );
++ strcat( command, "; make deinstall " );
++
++ fprintf( stdout, "%s\n", SINGLE_LINES );
++ fprintf( stdout, "trying one more way to remove %s...\n", oldPortName );
++ fprintf( stdout, "%s %s command: #4 of 8 %s\n", id, ver, command );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
++
++ system(command);
++
++ /*zzzzzzzzzzzzz*/
++ mallocIdx--;
++ free( command );
++ /*zzzzzzzzzzzzz*/
++ }
++
+ /************************************************************************/
+ /* Command "5" " make reinstall " */
+ /************************************************************************/
+@@ -297,10 +326,10 @@
+ strcat( command, "; make reinstall " );
+ }
+
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "installing updated %s \n", oldPortDir );
+ fprintf( stdout, "%s %s command: #5 of 8 %s\n", id, ver, command );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+
+ errorCode = system(command);
+ /*zzzzzzzzzzzzz*/
+@@ -323,10 +352,10 @@
+ strcat(command, "/");
+ strcat(command, oldPortName);
+ strcat(command, ".tgz");
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stderr, "restoring original port from backup \n" );
+ fprintf( stderr, "%s %s command: #5!! ***Emergancy restore*** %s\n", id, ver, command );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ errorCode = system(command);
+ /*zzzzzzzzzzzzz*/
+ mallocIdx--;
+@@ -346,11 +375,16 @@
+ return(0);
+ }
+
+- fprintf( stdout, "%s\n", LINES );
+- fprintf( stderr, "aborting upgrade due to port install failure, \n" );
+- fprintf( stderr, "try again after port error is corrected \n" );
+- fprintf( stdout, "%s\n", LINES );
+- return(4);
++ fprintf( stdout, "%s\n", SINGLE_LINES );
++ fprintf( stderr, "%s %s error: RESTORED BACKUP COPY\n", id, ver );
++ fprintf( stderr, "%s %s info: adding %s to ignore.db\n", id, ver, oldPortDir );
++ MGdbAdd( property->ignoreDb, oldPortDir, "performed (5) emergancy restore", NULL );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
++ if( mallocIdx || fopenCount )
++ {
++ assert(0);
++ }
++ return(0);
+ }
+ else
+ {
+@@ -370,10 +404,10 @@
+ strcat( command, "; rm -f ");
+ strcat( command, oldPortName);
+ strcat( command, ".tgz" );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stderr, "deleting backup copy, installation of updated %s successful\n", oldPortDir );
+ fprintf( stdout, "%s %s command: #6 of 8 %s\n", id, ver, command );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ system(command);
+ /*
+ error is no big deal here, if the backup package wasn't made it can't be deleted...
+@@ -428,10 +462,10 @@
+ strcat( command, "; make package " );
+ }
+
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stderr, "making package of updated %s \n", oldPortDir );
+ fprintf( stdout, "%s %s command: #7 of 8 %s\n", id, ver, command );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+
+ system(command);
+ /*zzzzzzzzzzzzz*/
+@@ -482,10 +516,10 @@
+ strcat( command, "; make clean " );
+ }
+
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stderr, "terminal clean of work directories\n" );
+ fprintf( stdout, "%s %s command: #8 of 8 %s\n", id, ver, command );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+
+ errorCode = system(command);
+
+diff -ruN ./libPMGR/src/PMGRrInitialize.c ../portmanager-0.2.5/libPMGR/src/PMGRrInitialize.c
+--- ./libPMGR/src/PMGRrInitialize.c Thu Jan 20 20:12:55 2005
++++ ../portmanager-0.2.5/libPMGR/src/PMGRrInitialize.c Wed Jan 26 10:22:34 2005
+@@ -34,6 +34,14 @@
+ property->verbose = 0;
+
+ stringSize = strlen(DATADIR)
++ + strlen(STRIKES_DB)
++ + 1;
++ property->strikesDbFileName = (char*)malloc(stringSize);
++ property->strikesDbFileName[0] = 0;
++ strcpy(property->strikesDbFileName, DATADIR);
++ strcat(property->strikesDbFileName, STRIKES_DB);
++
++ stringSize = strlen(DATADIR)
+ + strlen(COMMANDLINE_DB)
+ + 1;
+ property->commandLineDbFileName = (char*)malloc(stringSize);
+@@ -96,6 +104,9 @@
+ property->configConfFileName[0] = 0;
+ strcpy(property->configConfFileName, ETC);
+ strcat(property->configConfFileName, CONFIGURE_CONF);
++
++ MGmSetString( property->field3strikesPortDir, "field3strikesPortDir" ); /* 3strikesDb field 0 */
++ MGmSetString( property->fieldStrikes, "fieldStrikes" ); /* 3strikesDb field 1 */
+
+ MGmSetString( property->fieldCommandLineKey, "fieldCommandLineKey" ); /* commandLineDb field 0 */
+ MGmSetString( property->fieldCommandLineValue, "fieldCommandLineValue" ); /* commandLineDb field 1 */
+diff -ruN ./libPMGR/src/PMGRrMissingDependencies.c ../portmanager-0.2.5/libPMGR/src/PMGRrMissingDependencies.c
+--- ./libPMGR/src/PMGRrMissingDependencies.c Tue Jan 18 19:30:53 2005
++++ ../portmanager-0.2.5/libPMGR/src/PMGRrMissingDependencies.c Mon Jan 24 18:31:42 2005
+@@ -95,7 +95,7 @@
+ childPortDir = MGdbSeek( property->installedPortsDb, property->fieldInstalledPortName,
+ childPortName, property->fieldInstalledPortDir );
+
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "-=>MISSING<=- %s[%s] %s %s\n", dependencyPortName, dependencyPortDir,
+ "may be a dependency of", childPortName );
+
+@@ -280,6 +280,32 @@
+ fopenIdx--;
+ pclose(makeDependAllStream);
+ /*zzzzzzzzzzzzzz*/
++/***********************************************************************/
++/* this is to handle things that have been moved to a new directory */
++/***********************************************************************/
++if( !strlen(buffer01) )
++{
++ fprintf( stdout, "%s %s WARNING: %s is missing! moved maybe? see /usr/ports/MOVED\n", id, ver, dependencyPortDir );
++ fprintf( stdout, "removing %s from ports_old.db, whoever is dependent will have to pull it in during make\n",
++ dependencyPortName );
++ property->outOfDatePortsDb = MGdbDelete( property->outOfDatePortsDb,
++ MGdbGetRecordQty( property->outOfDatePortsDb ) -1 );
++
++
++ /*zzzzzzzzzzzzzz*/
++ mallocIdx--;
++ free( buffer01 );
++ /*zzzzzzzzzzzzzz*/
++
++ if( fopenIdx != 0 || mallocIdx != 0)
++ {
++ fprintf( stderr, "%s error: fopenIdx = %d mallocIdx = %d\n", id, fopenIdx, mallocIdx );
++ assert(0);
++ }
++
++ return(0);
++}
++
+
+ buffer01Idx = 127999;
+ /* convert LINEFEEDs to NULLs */
+@@ -411,7 +437,7 @@
+ buffer01Idx += strlen( unInstalledPortDir ) + strlen( "/usr/ports/" ) + 1;
+ }
+
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fflush( stdout);
+
+ /*zzzzzzzzzzzzzz*/
+diff -ruN ./libPMGR/src/PMGRrReadConfigure.c ../portmanager-0.2.5/libPMGR/src/PMGRrReadConfigure.c
+--- ./libPMGR/src/PMGRrReadConfigure.c Tue Jan 18 19:30:53 2005
++++ ../portmanager-0.2.5/libPMGR/src/PMGRrReadConfigure.c Tue Jan 25 11:34:18 2005
+@@ -46,6 +46,7 @@
+ int PMGRrReadConfigure( structProperty* property )
+ {
+ FILE* configDbStream;
++ char* configFileNameOld = NULL;
+ char id[] = "PMGRrReadConfigure";
+ char* buffer = NULL;
+ char* command = NULL;
+@@ -56,6 +57,91 @@
+ int mallocIdx = 0;
+ int stringSize = 0;
+
++ /*************************************/
++ /* update old conf file if it exists */
++ /*************************************/
++ stringSize = strlen( ETC )
++ + strlen( "portmanager.conf" )
++ +1;
++ /*zzzzzzzzzzzzzz*/
++ mallocIdx++;
++ configFileNameOld = (char*)malloc( stringSize );
++ /*zzzzzzzzzzzzzz*/
++
++ configFileNameOld[0] = 0;
++ strcpy( configFileNameOld, ETC );
++ strcat( configFileNameOld, "portmanager.conf" );
++ if( MGrIfFileExist( configFileNameOld ) )
++ {
++
++ stringSize = strlen( "mv " )
++ + strlen( configFileNameOld )
++ + strlen( " " )
++ + strlen( configFileNameOld )
++ + strlen( "_OLD" )
++ + 1;
++
++ /*zzzzzzzzzzzzzz*/
++ mallocIdx++;
++ command = (char*)malloc( stringSize );
++ /*zzzzzzzzzzzzzz*/
++
++ command[0] = 0;
++
++ strcpy( command, "mv " );
++ strcat( command, configFileNameOld );
++ strcat( command, " " );
++ strcat( command, configFileNameOld );
++ strcat( command, "_OLD" );
++ fprintf( stdout, "moving %s to %s%s\n", configFileNameOld, configFileNameOld, "_OLD" );
++ fprintf( stdout, "portmanager configuration file is now called %s. Please review %s%s and %s and make any nessesary changes.\n",
++ property->configConfFileName, property->configConfFileName, ".SAMPLE", configFileNameOld);
++ system( command );
++
++ /*zzzzzzzzzzzzzz*/
++ mallocIdx--;
++ free( command );
++ /*zzzzzzzzzzzzzz*/
++ }
++
++ /*zzzzzzzzzzzzzz*/
++ mallocIdx--;
++ free( configFileNameOld );
++ /*zzzzzzzzzzzzzz*/
++
++ /***************************************************************************/
++ /* if pm-020.conf missing then copy pm-020.conf.SAMPLE to pm-020.conf */
++ /***************************************************************************/
++ if( !MGrIfFileExist( property->configDbFileName ) )
++ {
++ stringSize = strlen( "cp " )
++ + strlen( property->configConfFileName )
++ + strlen( ".SAMPLE " )
++ + strlen( property->configConfFileName )
++ + 1;
++
++ /*zzzzzzzzzzzzzz*/
++ mallocIdx++;
++ command = (char*)malloc( stringSize );
++ /*zzzzzzzzzzzzzz*/
++
++ command[0] = 0;
++
++ strcpy( command, "cp " );
++ strcat( command, property->configConfFileName );
++ strcat( command, ".SAMPLE " );
++ strcat( command, property->configConfFileName );
++ system( command );
++
++ /*zzzzzzzzzzzzzz*/
++ mallocIdx--;
++ free( command );
++ /*zzzzzzzzzzzzzz*/
++ }
++
++ /*********************/
++ /* parse pm-020.conf */
++ /*********************/
+ stringSize = strlen( "echo \"" )
+ + strlen( property->fieldKey )
+ + strlen( "zzNULLzz" )
+diff -ruN ./libPMGR/src/PMGRrStatus.c ../portmanager-0.2.5/libPMGR/src/PMGRrStatus.c
+--- ./libPMGR/src/PMGRrStatus.c Thu Jan 20 20:52:07 2005
++++ ../portmanager-0.2.5/libPMGR/src/PMGRrStatus.c Sat Jan 22 07:25:35 2005
+@@ -36,16 +36,16 @@
+ int IDX_installedPortsDb = 1;
+ int QTY_dependencyPortsDb = 0;
+ int QTY_installedPortsDb = 0;
++ int answer = 0;
+ int errorCode = 0;
+ int fopenIdx = 0;
+ int mallocIdx = 0;
+ int stringSize = 0;
+-
+
+ /*.............................................................*/
+- fprintf( stdout, "%s\n", LINES );
+- fprintf( stdout, "%s %s info: Creating inital data bases\n", id, ver );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout,"%s\n", SINGLE_LINES );
++ fprintf( stdout,"%s %s info: Creating inital data bases\n", id, ver );
++ fprintf( stdout,"%s\n", SINGLE_LINES );
+
+ errorCode = PMGRrDbCreate(property); /* create/open initial databases */
+ if(errorCode)
+@@ -53,9 +53,9 @@
+ exit(0);
+ }
+ /*.............................................................*/
+- fprintf( stdout, "%s\n", LINES );
+- fprintf( stdout, "%s %s info: looking for missing dependent ports\n", id, ver );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout,"%s\n", SINGLE_LINES );
++ fprintf( stdout,"%s %s info: looking for missing dependent ports\n", id, ver );
++ fprintf( stdout,"%s\n", SINGLE_LINES );
+
+ errorCode = PMGRrMissingDependencies( property );
+ if(errorCode)
+@@ -63,9 +63,9 @@
+ exit(0);
+ }
+ /*.............................................................*/
+- fprintf( stdout, "%s\n", LINES );
+- fprintf( stdout, "%s %s info: looking for old installed ports\n", id, ver );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout,"%s\n", SINGLE_LINES );
++ fprintf( stdout,"%s %s info: looking for old installed ports\n", id, ver );
++ fprintf( stdout,"%s\n", SINGLE_LINES );
+
+ /* compare installedPortsDb records to "make describe" of each installed port */
+ /* remove ports that no longer have a Makefile (deleted by CVSand in /usr/ports/MOVED hopefully ) */
+@@ -93,17 +93,28 @@
+ {
+ installedPortName =
+ MGdbGet( property->installedPortsDb, IDX_installedPortsDb, property->fieldInstalledPortName);
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout,"%s\n", SINGLE_LINES );
++
+ fprintf( stdout,
+- "removing: %s, \n\t it is no longer in the ports collection, \n\t see /usr/ports/MOVED for possible explanation\n",
+- installedPortName );
++ "%s is no longer in the ports collection, see /usr/ports/MOVED\nis it OK to remove %s from your system? [y/n]\n",
++ installedPortDir, installedPortName );
++ answer = getc(stdin);
++ if( answer != 89 && answer != 121 )
++ {
++ fprintf( stdout, "answer = %d\n", answer );
++ fprintf( stdout, "portmanager shutting down\n" );
++ exit(0);
++ }
++ ungetc(answer, stdin);
++
++ fprintf( stdout, "removing: %s\n", installedPortName );
+ stringSize = strlen("pkg_delete -f ") + strlen(installedPortName) + 1;
+ command = ( char* )malloc( stringSize );
+ command[0] = 0;
+ strcpy( command, "pkg_delete -f " );
+ strcat( command, installedPortName );
+- fprintf( stdout, "%s\n", command );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout,"%s\n", command );
++ fprintf( stdout,"%s\n", SINGLE_LINES );
+ system( command );
+ free( command );
+ /* since installedPortName is no longer in ports collection need to delete record and restart */
+@@ -121,26 +132,26 @@
+ MGdbGet( property->installedPortsDb, IDX_installedPortsDb, property->fieldInstalledPortDir);
+ if( strcmp( installedPortName, available ) )
+ {
+- fprintf( stdout, "have:%-25s status: OLD available:%-25s %-25s\n",
++ fprintf( stdout,"have:%-25s status: OLD available:%-25s %-25s\n",
+ installedPortName, available, installedPortDir );
+ MGdbAdd( property->outOfDatePortsDb, installedPortDir, installedPortName, "OLD", available, NULL );
+ IDX_installedPortsDb++;
+ continue;
+ }
+- fprintf( stdout, "have:%-25s status: CURRENT: %-25s\n", installedPortName, installedPortDir );
++ fprintf( stdout,"have:%-25s status: CURRENT: %-25s\n", installedPortName, installedPortDir );
+ IDX_installedPortsDb++;
+ }
+
+ /*.............................................................*/
+- fprintf( stdout, "%s\n", LINES );
+- fprintf( stdout, "%s %s info: looking for installed ports built with old dependencies\n", id, ver );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout,"%s\n", SINGLE_LINES );
++ fprintf( stdout,"%s %s info: looking for installed ports built with old dependencies\n", id, ver );
++ fprintf( stdout,"%s\n", SINGLE_LINES );
+ /****************************************************************************/
+ /* add any DependencyDir == installedDir && dependencyName != installedName */
+ /* to outOfDatePortsDb */
+ /****************************************************************************/
+ IDX_dependencyPortsDb = 1;
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout,"%s\n", SINGLE_LINES );
+ QTY_dependencyPortsDb = MGdbGetRecordQty( property->dependencyPortsDb);
+ while( IDX_dependencyPortsDb < QTY_dependencyPortsDb )
+ {
+@@ -165,34 +176,31 @@
+ dependencyPortName, property->fieldChildPortName )
+ ) )
+ {
+-MGdbGoTop( property->outOfDatePortsDb );
+-if( !MGdbSeek( property->outOfDatePortsDb, property->fieldOldPortName, oldPortName, property->fieldOldPortName ) )
+-{
+- fprintf( stdout, "OLD %s built with old dependency %s, current dependency is %s\n",
+- oldPortName, dependencyPortName, installedPortName );
+- MGdbGoTop( property->installedPortsDb );
+- oldPortDir = MGdbSeek( property->installedPortsDb,
+- property->fieldInstalledPortName,
+- oldPortName,
+- property->fieldInstalledPortDir );
+-
+- MGdbAdd( property->outOfDatePortsDb, oldPortDir, oldPortName, "OLD dependency",
+- installedPortName, NULL );
+-}
++ MGdbGoTop( property->outOfDatePortsDb );
++ if( !MGdbSeek( property->outOfDatePortsDb, property->fieldOldPortName, oldPortName, property->fieldOldPortName ) )
++ {
++ fprintf( stdout,"OLD %s built with old dependency %s, current dependency is %s\n",
++ oldPortName, dependencyPortName, installedPortName );
++ MGdbGoTop( property->installedPortsDb );
++ oldPortDir = MGdbSeek( property->installedPortsDb,
++ property->fieldInstalledPortName,
++ oldPortName,
++ property->fieldInstalledPortDir );
++
++ MGdbAdd( property->outOfDatePortsDb, oldPortDir, oldPortName, "OLD dependency",
++ installedPortName, NULL );
++ }
+ }
+ }
+ }
+ ++IDX_dependencyPortsDb;
+ }
+-
+- fflush(stderr);
+- fflush(stdout);
+- fprintf( stdout, "%s\n", LINES );
+- fprintf( stdout, "status report finished\n" );
+- fprintf( stdout, "%s\n", DOUBLELINES );
++ fprintf( stdout,"%s\n", SINGLE_LINES );
++ fprintf( stdout,"status report finished\n" );
++ fprintf( stdout,"%s\n", DOUBLE_LINES );
+ if( fopenIdx || mallocIdx != 0)
+ {
+- fprintf( stderr, "%s error: fopenIdx = %d mallocIdx = %d\n",
++ fprintf( stdout, "%s error: fopenIdx = %d mallocIdx = %d\n",
+ id, fopenIdx, mallocIdx );
+ assert(0);
+ }
+diff -ruN ./libPMGR/src/PMGRrUpgrade.c ../portmanager-0.2.5/libPMGR/src/PMGRrUpgrade.c
+--- ./libPMGR/src/PMGRrUpgrade.c Wed Jan 19 23:08:12 2005
++++ ../portmanager-0.2.5/libPMGR/src/PMGRrUpgrade.c Wed Jan 26 11:04:00 2005
+@@ -87,9 +87,9 @@
+ if(property->portManagerUpdated)
+ {
+ PMGRrDbDestroy( property );
+- fprintf(stdout, "%s\n", LINES);
++ fprintf(stdout, "%s\n", SINGLE_LINES);
+ fprintf(stdout, "portmanager just updated itself, executing: portmanager -u \n");
+- fprintf(stdout, "%s\n", LINES);
++ fprintf(stdout, "%s\n", SINGLE_LINES);
+ fflush(stdout);
+
+ /********************************/
+@@ -97,7 +97,8 @@
+ /********************************/
+ QTY_commandLineDb = MGdbGetRecordQty( property->commandLineDb );
+ IDX_commandLineDb = 1;
+- stringSize = strlen( "portmanager " );
++ stringSize = strlen( BINDIR )
++ + strlen( "portmanager " );
+ while( IDX_commandLineDb < QTY_commandLineDb )
+ {
+ /* continue if -ip has no options ) */
+@@ -121,7 +122,8 @@
+ stringSize += 1;
+ command = (char*)malloc( stringSize );
+ command[0] = 0;
+- strcpy( command, "./portmanager " );
++ strcpy( command, BINDIR );
++ strcat( command, "portmanager " );
+ IDX_commandLineDb = 1;
+ while( IDX_commandLineDb < QTY_commandLineDb )
+ {
+@@ -173,6 +175,7 @@
+ char* ignoreReason = NULL;
+ char* oldPortDir = NULL;
+ char* oldPortName = NULL;
++ char* strike = NULL;
+ int IDX_outOfDatePortsDb = 1;
+ int QTY_outOfDatePortsDb = 0;
+ int errorCode = 0;
+@@ -210,6 +213,38 @@
+ {
+ property->portManagerUpdated = 1;
+ }
++ /*******************/
++ /* 3 strikes check */
++ /*******************/
++ MGdbGoTop( property->strikesDb );
++ strike = MGdbSeek( property->strikesDb, property->field3strikesPortDir, oldPortDir,
++ property->fieldStrikes );
++ if( !strike )
++ {
++ MGdbAdd( property->strikesDb, oldPortDir, "1", NULL );
++ }
++ else
++ {
++ if( strike[0] == '2' )
++ {
++ MGdbAdd( property->ignoreDb, oldPortDir, "looping, 3rd attempt at make", NULL );
++ IDX_outOfDatePortsDb++;
++ continue;
++ }
++ if( strike[0] == '1' )
++ {
++ fprintf( stdout,
++ "%s %s WARNING: This is the second time %s is being built, one more attempt and it will be marked as ignore.\n",
++ id, ver, oldPortName );
++
++ property->strikesDb = MGdbDelete( property->strikesDb,
++ MGdbGetRecno( property->strikesDb ) - 1 );
++ MGdbAdd( property->strikesDb, oldPortDir, "2", NULL );
++ }
++ }
++
++
++
+ processed = 1;
+ errorCode = PMGRrDoUpgrade( property, oldPortName );
+ switch(errorCode)
+@@ -242,9 +277,9 @@
+ }
+ if( !processed )
+ {
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf(stdout, "update of ports collection complete with either some errors, ignored ports or both\n" );
+- fprintf( stdout, "%s\n", DOUBLELINES );
++ fprintf( stdout, "%s\n", DOUBLE_LINES );
+ exit(0);
+ }
+ return(0);
+diff -ruN ./libPMGR/src/libPMGR.h ../portmanager-0.2.5/libPMGR/src/libPMGR.h
+--- ./libPMGR/src/libPMGR.h Thu Jan 20 23:02:04 2005
++++ ../portmanager-0.2.5/libPMGR/src/libPMGR.h Wed Jan 26 10:23:20 2005
+@@ -26,7 +26,7 @@
+ #include <libMG.h>
+
+ #ifndef VER
+-static char ver[] = "0.2.4";
++static char ver[] = "0.2.5";
+ #define VER 1
+ #endif
+
+@@ -42,10 +42,12 @@
+ #define DATADIR "%%PREFIX%%/share/portmanager/"
+ #define ETC "%%PREFIX%%/etc/portmanager/"
+ #define LOCALBASE "%%PREFIX%%/"
++#define BINDIR "%%PREFIX%%/bin"
+ #define PKG_DBDIR "%%PKG_DBDIR%%"
+ #define PORTSDIR "%%PORTSDIR%%/"
+ #define TEMP_DIR "/tmp"
+
++#define STRIKES_DB "3strikes.db"
+ #define PORTS_INSTALLED_DB "ports_installed.db"
+ #define COMMANDLINE_DB "commandLine.db"
+ #define PORT_DEPENDENCIES_DB "port_dependencies.db"
+@@ -56,27 +58,9 @@
+ #define CACHE_RESET "rm -f"" "DATADIR""PORTS_CACHE_DB
+ #define IGNORE_DB "ignore.db"
+
+-/*
+-the following identify the fields of databases. For example
+-CONFIG_DB_PORT_DIR is for config_db and the field containing
+-port directory information is #0
+-*/
+-
+-#define CONFIGDB_PORTDIR 0
+-#define CONFIGDB_PORTOPTIONS 1
+-
+-#define DEPENDENCYPORTSDB_DEPENDENCYPORTDIR 2
+-#define DEPENDENCYPORTSDB_DEPENDENCYPORTNAME 1
+-#define DEPENDENCYPORTSDB_PORTNAME 0
+-
+-#define INSTALLEDPORTSDB_PORTDIR 1
+-#define INSTALLEDPORTSDB_PORTNAME 0
+-
+-#define OUTOFDATEPORTSDB_PORTDIR 0
+-#define OUTOFDATEPORTSDB_PORTNAME 1
+-
+ typedef struct
+ {
++ char* strikesDbFileName;
+ char* cacheDbFileName;
+ char* commandLineDbFileName;
+ char* configConfFileName;
+@@ -86,6 +70,9 @@
+ char* installedPortsDbFileName;
+ char* oldPortsFileName;
+
++ char* field3strikesPortDir; /* 3strikesDb field 0 */
++ char* fieldStrikes; /* 3strikesDb field 1 */
++
+ char* fieldCommandLineKey; /* commandLineDb field 0 */
+ char* fieldCommandLineValue; /* commandLineDb field 1 */
+
+@@ -115,6 +102,7 @@
+ char* fieldUpgradePortDir;
+ char* fieldUpgradePortName;
+
++ classDb* strikesDb;
+ classDb* cacheDb;
+ classDb* commandLineDb;
+ classDb* configDb;
+
+diff -ruN ./portmanager/portmanager.1 ../portmanager-0.2.5/portmanager/portmanager.1
+--- ./portmanager/portmanager.1 Thu Jan 20 08:43:27 2005
++++ ../portmanager-0.2.5/portmanager/portmanager.1 Mon Jan 24 14:31:26 2005
+@@ -37,7 +37,7 @@
+ .sp
+ example: portmanager \&-u \&-ip editors/nedit editors/openoffice
+ .sp
+- Do not update editors/nedit or editors/openoffice or anything
++ Do not update editors/nedit nor editors/openoffice nor anything
+ dependent on them. Update everything else.
+ .It
+ \fB\&-h\fR Quick help reference
+diff -ruN ./portmanager/portmanager.c ../portmanager-0.2.5/portmanager/portmanager.c
+--- ./portmanager/portmanager.c Thu Jan 20 14:42:32 2005
++++ ../portmanager-0.2.5/portmanager/portmanager.c Wed Jan 26 10:58:18 2005
+@@ -57,20 +57,26 @@
+ property.ignoreDb = MGdbCreate( property.ignoreDbFileName, property.fieldIgnorePortDir,
+ property.fieldIgnoreReason, NULL );
+
++ property.strikesDb = MGdbCreate(
++ property.strikesDbFileName,
++ property.field3strikesPortDir,
++ property.fieldStrikes,
++ NULL );
++
+
+- /***************************************************************/
+-
+ idx = 0;
+ while( idx < argc )
+ {
+ if( !strcmp(argv[idx], "-ip") )
+ {
+ idx++;
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ while( idx < argc && argv[idx][0] != '-' )
+ {
++
+ fprintf( stdout, "%s %s info: adding %s to ignore.db reason: command line option -ip\n",
+ id, ver, argv[idx] );
++
+ MGdbAdd( property.ignoreDb, argv[idx], "command line option -ip", NULL );
+ idx++;
+ }
+@@ -159,15 +165,15 @@
+ void rHelp( char* id )
+ {
+
+- fprintf( stdout, "%s\n", DOUBLELINES );
++ fprintf( stdout, "%s\n", DOUBLE_LINES );
+ fprintf( stdout, "%s %s help:\n", id, ver );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "\n\t-ip ( ignore port ) example:\n\t\tportmanager -u -ip editors/nedit editors/openoffice\n\t\tupgrade evrything except nedit, open office and their dependencies\n" );
+ fprintf( stdout, "\t-s or --status\n\t\tstatus of installed ports\n" );
+ fprintf( stdout, "\t-u or --upgrade\n\t\tupgrade installed ports\n" );
+ fprintf( stdout, "\t-v or --version\n\t\tportmanager version information\n\n" );
+ fprintf( stdout, "\n\tsee portmanager(1), or http://portmanager.sourceforge.net/ for more information.\n\n" );
+- fprintf( stdout, "%s\n", LINES );
++ fprintf( stdout, "%s\n", SINGLE_LINES );
+ return;
+ }
+
diff --git a/ports-mgmt/portmanager/pkg-plist b/ports-mgmt/portmanager/pkg-plist
index bb4d447f4491..bc756724d977 100644
--- a/ports-mgmt/portmanager/pkg-plist
+++ b/ports-mgmt/portmanager/pkg-plist
@@ -1,3 +1,4 @@
+@unexec rm -f %D/share/portmanager/3strikes.db 2>/dev/null || true
@unexec rm -f %D/share/portmanager/commandLine.db 2>/dev/null || true
@unexec rm -f %D/share/portmanager/configure.db 2>/dev/null || true
@unexec rm -f %D/share/portmanager/configure.db.temp 2>/dev/null || true