Update to 0.3.4

Add WITH_BUILD_DEPENDS_ARE_LEAVES in OPTIONS

PR:		88847
Submitted by:	Michael C. Shultz <ringworm01@gmail.com> (maintainer)
This commit is contained in:
Marcus Alves Grando 2005-11-11 16:24:13 +00:00
parent bfd31bcdcf
commit 154de1f792
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=147955
10 changed files with 20 additions and 5288 deletions

View file

@ -6,8 +6,7 @@
#
PORTNAME= portmanager
PORTVERSION= 0.3.3
PORTREVISION= 3
PORTVERSION= 0.3.4
CATEGORIES= sysutils
MASTER_SITES= http://portmanager.sunsite.dk/distfiles/ \
${MASTER_SITE_SOURCEFORGE}
@ -38,7 +37,8 @@ CONFIGURE_ARGS= --with-prefix=${PREFIX} --with-bindir=/bin \
--with-portsdir=${PORTSDIR} --with-sharedir=/share/portmanager \
--with-tempdir=/tmp
OPTIONS= DEBUG "Enables debug support and all compile warning" off
OPTIONS= DEBUG "Enable debug support and warnings" off \
BUILD_DEPENDS_ARE_LEAVES "Treat build dependencies as leaves" off
.include <bsd.port.pre.mk>
@ -46,6 +46,10 @@ OPTIONS= DEBUG "Enables debug support and all compile warning" off
CONFIGURE_ARGS+= --with-debug=yes
.endif
.if defined(WITH_BUILD_DEPENDS_ARE_LEAVES)
CONFIGURE_ARGS+= --with-treatBuildDependsAsLeaves=yes
.endif
# Keep this in post-configure. After run configure, he change this value.
post-configure:
@${REINPLACE_CMD} -e \

View file

@ -1,3 +1,3 @@
MD5 (portmanager-0.3.3.tar.gz) = 4d2377a4d3f760335f1f63f5b41bcdc6
SHA256 (portmanager-0.3.3.tar.gz) = 93390d715929f12a2bf0d0762f1f360263665fd8edb1ee7124b3e9817636ad7c
SIZE (portmanager-0.3.3.tar.gz) = 432705
MD5 (portmanager-0.3.4.tar.gz) = 9dcb56c7bfe8041486d8741e6b2cf9bf
SHA256 (portmanager-0.3.4.tar.gz) = 2a1281a2a36b6c4623c05ef4e656319895bdc0511d633ee26396ce8d4bafad21
SIZE (portmanager-0.3.4.tar.gz) = 435628

View file

@ -1,877 +0,0 @@
diff -ruN ../0.3.3/libMG/src/MGdbDelete.c ./libMG/src/MGdbDelete.c
--- ../0.3.3/libMG/src/MGdbDelete.c Sat Nov 5 05:43:08 2005
+++ ./libMG/src/MGdbDelete.c Tue Nov 8 11:38:35 2005
@@ -23,18 +23,19 @@
#include <libMG.h>
#include <libMG.ph>
-int MGdbDelete( classDb* db, int recordIdx )
+classDb* MGdbDelete( classDb* db, int recordIdx )
{
FILE* dbFileStream;
char id[] = "MGdbDelete";
static char* newPath = NULL;
int stringSize = 0;
+ static classDb* newDb;
/* check if we have a valid object */
if(db == NULL || db->parent.type != CLASS_TYPE_DB)
{
fprintf( stderr, "%s error: invalid object type\n", id);
- return( 1 );
+ return( NULL );
}
db->parent.recordIdx = 0;
@@ -50,7 +51,7 @@
{
fprintf( stderr, "%s error: unable to open %s mode \"w\"\n", id, db->parent.path );
perror( "system message" );
- return( 1 );
+ return( NULL );
}
/*zzzzzzzzzzzzzz*/
@@ -91,14 +92,15 @@
newPath = (char*)calloc( stringSize, 1 );
strcpy( newPath, db->parent.path );
MGdbDestroy( db );
- if( ( db = MGdbOpen( newPath ) ) == NULL )
+ if( ( newDb = MGdbOpen( newPath ) ) == NULL )
{
fprintf( stderr, "%s error: unable to MGdbOpen %s\n", id, newPath );
perror( "system message" );
- return( 1 );
+ return( NULL );
}
+ db = newDb;
free( newPath );
- return( 0 );
+ return( newDb );
}
diff -ruN ../0.3.3/libMG/src/MGdbOpen.c ./libMG/src/MGdbOpen.c
--- ../0.3.3/libMG/src/MGdbOpen.c Sat Nov 5 05:43:08 2005
+++ ./libMG/src/MGdbOpen.c Tue Nov 8 08:20:40 2005
@@ -26,11 +26,10 @@
classDb* MGdbOpen( char* dbFileName )
{
char id[] = "MGdbOpen";
- int errorCode = 0;
static classDb* db;
/*zzzzzzzzzzzzzz*/
- db = ( classDb* )malloc( sizeof(classDb) + 1 );
+ db = ( classDb* )calloc( sizeof(classDb), 1 );
db->parent.mallocIdx = 1;
/*zzzzzzzzzzzzzz*/
@@ -48,13 +47,6 @@
db->parent.recordIdx = 0;
db->parent.recordQty = 0;
db->parent.type = CLASS_TYPE_DB;
-
-
- if(errorCode)
- {
- fprintf( stderr, "%s error: %s returned errorCode %d\n", id, "MGmSetString", errorCode );
- assert(0);
- }
MGdbRead( db );
diff -ruN ../0.3.3/libMG/src/libMG.h ./libMG/src/libMG.h
--- ../0.3.3/libMG/src/libMG.h Sat Nov 5 05:43:08 2005
+++ ./libMG/src/libMG.h Tue Nov 8 11:37:11 2005
@@ -106,7 +106,7 @@
classDb* MGdbCreate( char* dbFileName, ... );
classDb* MGdbOpen( char* dbFileName );
int MGdbAdd(classDb* db, ...);
-int MGdbDelete(classDb* db, int recordIdx );
+classDb* MGdbDelete(classDb* db, int recordIdx );
int MGdbDestroy(classDb* db);
int MGdbGetRecno(classDb* db );
int MGdbGetRecordQty(classDb* db);
diff -ruN ../0.3.3/libMGPM/src/MGPMrBestOldPort.c ./libMGPM/src/MGPMrBestOldPort.c
--- ../0.3.3/libMGPM/src/MGPMrBestOldPort.c Mon Nov 7 14:51:35 2005
+++ ./libMGPM/src/MGPMrBestOldPort.c Tue Nov 8 00:16:52 2005
@@ -121,7 +121,7 @@
property->fieldOldPortsDbOldPortDir,
exact ) )
{
- fprintf( stdout, "skipping %s %s old dependency: %s\n",
+ fprintf( stdout, "skipping %s %s until dependency %s updated\n",
oldPortName,
oldPortDir,
MGdbGet( property->availableDependenciesDb,
@@ -156,7 +156,7 @@
property->fieldOldPortsDbOldPortDir,
exact ) )
{
- fprintf( stdout, "skipping %s %s old dependency: %s\n",
+ fprintf( stdout, "skipping %s %s until dependency %s updated\n",
oldPortName,
oldPortDir,
MGdbGet( property->availableDependenciesDb,
diff -ruN ../0.3.3/libMGPM/src/MGPMrController.c ./libMGPM/src/MGPMrController.c
--- ../0.3.3/libMGPM/src/MGPMrController.c Sat Nov 5 05:43:08 2005
+++ ./libMGPM/src/MGPMrController.c Tue Nov 8 12:29:47 2005
@@ -30,9 +30,18 @@
#include <libMGPM.h>
int rPmUpgradeNewMethod( structProperty* property );
-int rPmUpgradeOriginalMethod( structProperty* property );
int MGPMrController( structProperty* property, char* path )
{
+ char ignore[] = "/IGNORE";
+ char upgradeInteractive[] = "--upgrade-interactive";
+ char resume[] = "--resume";
+ char ui[] = "-ui";
+ char backUp[] = "--back-up";
+ char yes[] = "--yes";
+ char y[] = "-y";
+ char f[] = "-f";
+ char fix[] = "--fix";
+ char bu[] = "-bu";
char exact[] = "exact";
char id[] = "MGPMrController";
char* command = NULL;
@@ -52,8 +61,8 @@
int oldPortsDbTOTALIZER = 0;
command = (char*)calloc( bufferSize,1);
- oldPortDir = (char*)calloc(255,1);
- oldPortName = (char*)calloc(255,1);
+ oldPortDir = (char*)calloc(512,1);
+ oldPortName = (char*)calloc(512,1);
xtermTitle = (char*)calloc( bufferSize,1 );
property->cacheDb = MGdbCreate(
@@ -71,14 +80,14 @@
property->commandLineDb = MGdbOpen( property->commandLineDbFileName );
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "-f", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, f, property->fieldCommandLineDbKey, exact ) )
{
property->forced = 1;
fprintf( stdout, "%s %s info: running in forced update mode\n", id, PACKAGE_VERSION );
while( fflush( stdout ) );
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "--fix", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, fix, property->fieldCommandLineDbKey, exact ) )
{
property->forced = 1;
fprintf( stdout, "%s %s info: running in forced update mode\n", id, PACKAGE_VERSION );
@@ -86,37 +95,37 @@
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "-bu", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, bu, property->fieldCommandLineDbKey, exact ) )
{
property->backUp = 1;
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "--back-up", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, backUp, property->fieldCommandLineDbKey, exact ) )
{
property->backUp = 1;
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "-y", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, y, property->fieldCommandLineDbKey, exact ) )
{
property->autoConflicts = 1;
property->autoMoved = 1;
}
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "--yes", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, yes, property->fieldCommandLineDbKey, exact ) )
{
property->autoConflicts = 1;
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "--resume", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, resume, property->fieldCommandLineDbKey, exact ) )
{
property->resume = 1;
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "-ui", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, ui, property->fieldCommandLineDbKey, exact ) )
{
property->interactive = 1;
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "--upgrade-interactive", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, upgradeInteractive, property->fieldCommandLineDbKey, exact ) )
{
property->interactive = 1;
}
@@ -128,7 +137,7 @@
property->configDb = MGdbOpen( property->configDbFileName );
property->ignoreDb = MGdbOpen( property->ignoreDbFileName );
MGdbGoTop( property->configDb );
- while( ( configDbValuePtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, "/IGNORE", property->fieldConfigDbValue, exact ) ) )
+ while( ( configDbValuePtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, ignore, property->fieldConfigDbValue, exact ) ) )
{
MGdbAdd( property->ignoreDb, configDbValuePtr, "set to ignore in pm-020.conf", NULL );
fprintf( stdout, "%s %s info: Adding %s to ignoreDB reason: %s\n", id, PACKAGE_VERSION, configDbValuePtr, "set to ignore in pm-020.conf" );
@@ -146,6 +155,7 @@
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateInstalledDb", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
@@ -155,11 +165,13 @@
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrShowLeaves", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 0 );
}
@@ -190,6 +202,7 @@
"MGPMrCreateInstalledDb", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
@@ -197,6 +210,10 @@
{
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION,
"MGPMrCreateAllUpdateStatusDb", errorCode );
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 1 );
}
}
@@ -206,6 +223,10 @@
{
fprintf( stdout, "%s %s error: failed to open %s\n", id, PACKAGE_VERSION, property->ignoreDbFileName );
perror( "system" );
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 1 );
}
MGdbDestroy( property->ignoreDb );
@@ -215,11 +236,13 @@
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrShowLeavesDelete", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 0 );
}
@@ -231,6 +254,7 @@
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateStatusDb", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
@@ -238,6 +262,10 @@
if( ( errorCode = MGPMrMissingDependencies( property ) ) )
{
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrMissingDependencies", errorCode );
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 1 );
}
@@ -246,11 +274,13 @@
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateStatusDb", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return(0);
}
@@ -258,9 +288,10 @@
if( path && strcmp( path, "PMUPGRADE" ) == 0 )
{
rPmUpgradeNewMethod( property );
-/*
- rPmUpgradeOriginalMethod( property );
-*/
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 0 );
}
@@ -274,6 +305,10 @@
if( ( errorCode = MGPMrSinglePortCreateStatusDb( property, path ) ) )
{
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrSinglePortCreateStatusDb", errorCode );
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 1 );
}
@@ -293,6 +328,7 @@
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateStatusDb", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
@@ -300,6 +336,10 @@
if( ( errorCode = MGPMrSinglePortStatus( property ) ) )
{
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrSinglePortStatus", errorCode );
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 1 );
}
oldPortDir[0] = 0;
@@ -319,6 +359,10 @@
else
{
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrBestOldPort", errorCode );
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 1 );
}
}
@@ -448,236 +492,9 @@
}
free( command );
free( oldPortDir );
- free( xtermTitle );
- return( errorCode );
-}
-
-/*******************************************************/
-int rPmUpgradeOriginalMethod( structProperty* property )
-/*******************************************************/
-{
- char exact[] = "exact";
- char id[] = "rPmUpgradeOriginalMethod";
- char* command = NULL;
- char* configDbValuePtr = NULL;
- char* oldPortDir = NULL;
- char* oldPortName = NULL;
- char* oldPortsDbNewPortDirPtr = NULL;
- char* oldPortsDbNewPortNamePtr = NULL;
- char* oldPortsDbReasonPtr = NULL;
- char* term = NULL;
- char* xtermTitle = NULL;
- float percentDone = 0;
- int bufferSize = 0xffff;
- int errorCode = 0;
- int oldPortsDbIDX = 0;
- int oldPortsDbQTY = 0;
- int oldPortsDbTOTALIZER = 0;
-
- command = (char*)calloc( bufferSize,1);
- oldPortDir = (char*)calloc(255,1);
- oldPortName = (char*)calloc(255,1);
- xtermTitle = (char*)calloc( bufferSize,1 );
-
- property->cacheDb = MGdbCreate(
- property->cacheDbFileName,
- property->fieldCacheDbPortDir,
- property->fieldCacheDbAvailablePortName,
- property->fieldCacheDbMakeFileSize,
- property->fieldCacheDbMakeFileTime,
- NULL );
- MGdbDestroy( property->cacheDb );
- if( property->log )
- {
- strcpy( command, "echo \"portmanager.log\" " );
- strcat( command, " > /var/log/portmanager.log" );
- system( command );
- strcpy( command, "date >> /var/log/portmanager.log" );
- system( command );
- }
- while( 1 )
- {
- if( ( errorCode = MGPMrCreateInstalledDb( property ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateInstalledDb", errorCode );
- free( command );
- free( oldPortDir );
- free( oldPortName );
- free( xtermTitle );
- return( 1 );
- }
-
- if( ( errorCode = MGPMrMissingDependencies( property ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrMissingDependencies", errorCode );
- free( command );
- free( oldPortDir );
- free( oldPortName );
- free( xtermTitle );
- return( 1 );
- }
- if( ( errorCode = MGPMrStatus( property ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateStatusDb", errorCode );
- free( command );
- free( oldPortDir );
- free( oldPortName );
- free( xtermTitle );
- return( 1 );
- }
- oldPortDir[0] = 0;
- oldPortName[0] = 0;
- if( ( errorCode = MGPMrBestOldPort( property, oldPortDir, oldPortName ) ) )
- {
- if( errorCode == 100 )
- {
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "%s %s INFO: finished with some ports not updated if --log was used see /var/log/portmanager.log\n",
- "portmanager", PACKAGE_VERSION );
- while( fflush( stdout ) );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- errorCode = 0;
- break;
- }
- else
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrBestOldPort", errorCode );
- free( command );
- free( oldPortDir );
- free( oldPortName );
- free( xtermTitle );
- return( 1 );
- }
- }
- if( strlen(oldPortDir) > 1 )
- {
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "updating %s %s\n", oldPortName, oldPortDir );
-
- /*
- * Set xterm title bar indicator
- */
- property->oldPortsDb = MGdbOpen( property->oldPortsDbFileName );
- oldPortsDbQTY = MGdbGetRecordQty( property->oldPortsDb );
-
- if( oldPortsDbQTY - 1 > oldPortsDbTOTALIZER )
- {
- oldPortsDbTOTALIZER = oldPortsDbQTY - 1;
- }
- percentDone = 100 - ( 100 * ( ( (float)oldPortsDbQTY - 1 ) / (float)oldPortsDbTOTALIZER ) );
- fprintf( stdout, "percentDone-=>%d = 100 - ( 100 * ( oldPortsDbQTY-=>%d / oldPortsDbTOTALIZER-=>%d ) ) \n",
- (int)percentDone, oldPortsDbQTY-1, oldPortsDbTOTALIZER );
- while( fflush( stdout ) );
-
- term = getenv("TERM");
- if( term && strncmp( term, "xterm", 5 ) == 0 && isatty(fileno(stdout)) )
- {
- /*
- pr 81481
- To fix the modification of xterm title, even when redirecting, one can
- test isatty(fileno(stdout)) before printing the escape sequence.
- */
- strcpy( xtermTitle, "portmanager" );
- strcat( xtermTitle, " done:% " );
- strcat( xtermTitle, MGrIntToString( (long)percentDone ) );
- strcat( xtermTitle, " updating " );
- strcat( xtermTitle, oldPortName );
- strcat( xtermTitle, " " );
- strcat( xtermTitle, oldPortDir );
- printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
- }
- if( property->log )
- {
- property->configDb = MGdbOpen( property->configDbFileName );
- MGdbGoTop( property->configDb );
- configDbValuePtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, oldPortDir,
- property->fieldConfigDbValue, exact );
-
- MGdbGoTop( property->oldPortsDb );
- oldPortsDbReasonPtr = MGdbSeek( property->oldPortsDb, property->fieldOldPortsDbOldPortDir, oldPortDir,
- property->fieldOldPortsDbReason, exact );
- if( oldPortsDbReasonPtr )
- {
- oldPortsDbIDX = MGdbGetRecno( property->oldPortsDb ) - 1;
- oldPortsDbNewPortNamePtr = MGdbGet( property->oldPortsDb, oldPortsDbIDX,
- property->fieldOldPortsDbNewPortName );
- oldPortsDbNewPortDirPtr = MGdbGet( property->oldPortsDb, oldPortsDbIDX,
- property->fieldOldPortsDbNewPortDir );
- }
- strcpy( command, "echo \" " );
- if( strcmp( oldPortName, "not installed" ) == 0 )
- {
- strcat( command, "adding " );
- strcat( command, oldPortName );
- strcat( command, " " );
- strcat( command, oldPortDir );
- strcat( command, " " );
- }
- else
- {
- strcat( command, "updating " );
- strcat( command, oldPortName );
- strcat( command, " " );
- strcat( command, oldPortDir );
- strcat( command, " " );
- }
- if( configDbValuePtr )
- {
- strcat( command, " options " );
- strcat( command, configDbValuePtr );
- }
- if( oldPortsDbReasonPtr )
- {
- strcat( command, " " );
- strcat( command, oldPortsDbReasonPtr );
- strcat( command, " " );
- strcat( command, oldPortsDbNewPortNamePtr );
- strcat( command, " " );
- strcat( command, oldPortsDbNewPortDirPtr );
- strcat( command, " " );
- }
- strcat( command, "\" >> /var/log/portmanager.log" );
- system( command );
- MGdbDestroy( property->configDb );
- }
- MGdbDestroy( property->oldPortsDb );
- }
- else
- {
- /*
- * Set xterm title bar indicator
- *
- * pr 81481
- * To fix the modification of xterm title, even when redirecting, one can
- * test isatty(fileno(stdout)) before printing the escape sequence.
- */
- if( term && strncmp( term, "xterm", 5 ) == 0 && isatty(fileno(stdout)) )
- {
- strcpy( xtermTitle, "portmanager" );
- strcat( xtermTitle, " " );
- strcat( xtermTitle, " finished" );
- printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
- }
- fprintf( stdout, "%s %s INFO: all ports are up to date\n", "portmanager", PACKAGE_VERSION );
- while( fflush( stdout ) );
- break;
- }
- MGPMrUpdate( property, oldPortDir, oldPortName );
- }
-
- if( property->log )
- {
- strcpy( command, "echo \" end of log \" " );
- strcat( command, " >> /var/log/portmanager.log" );
- system( command );
- strcpy( command, "date >> /var/log/portmanager.log" );
- system( command );
- }
- free( command );
- free( oldPortDir );
free( oldPortName );
free( xtermTitle );
- return( 0 );
+ return( errorCode );
}
/*******************************************************/
@@ -901,6 +718,7 @@
strcpy( command, "date >> /var/log/portmanager.log" );
system( command );
}
+ free( oldPortName );
free( command );
free( oldPortDir );
free( xtermTitle );
diff -ruN ../0.3.3/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c
--- ../0.3.3/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Sun Nov 6 19:26:26 2005
+++ ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Tue Nov 8 15:49:01 2005
@@ -52,7 +52,7 @@
counterPtr = &counter;
- availablePortDir = (char*)calloc( 510, 1 );
+ availablePortDir = (char*)calloc( bufferSize, 1 );
availablePortName = (char*)calloc( bufferSize, 1 );
fprintf( stdout,"%s\n", SINGLE_LINES );
@@ -122,6 +122,7 @@
installedPortsDbIDX++;
}
MGdbDestroy( property->availablePortsDb );
+ MGdbDestroy( property->installedPortsDb );
MGdbDestroy( property->availableDependenciesDb );
MGdbDestroy( property->configDb );
free( availablePortDir );
@@ -132,10 +133,9 @@
int rrFindDepends( structProperty* property, char* availablePortDir, char* availablePortName, int* counterPtr )
{
char id[] = "rrFindDepends";
- char* availablePortsDbFlagPtr = NULL;
int availablePortsDbIDX = 0;
int errorCode = 0;
- int idx = 0;
+ int availablePortsDbQTY = 0;
if( ( errorCode = rrGetPortName( property, availablePortDir, availablePortName ) ) )
{
@@ -155,20 +155,19 @@
/*
* fill dependencies for each record in property->availablePortsDb
*/
- availablePortsDbIDX = MGdbGetRecordQty( property->availablePortsDb );
- idx = 1;
- while( idx < availablePortsDbIDX )
+ availablePortsDbQTY = MGdbGetRecordQty( property->availablePortsDb );
+ availablePortsDbIDX = 1;
+ while( availablePortsDbIDX < availablePortsDbQTY )
{
- availablePortsDbFlagPtr = MGdbGet( property->availablePortsDb, idx, property->fieldAvailablePortsDbFlag );
- if( availablePortsDbFlagPtr && strncmp( availablePortsDbFlagPtr, "0", 1 ) == 0 )
+ if( strncmp( MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbFlag ), "0", 1 ) == 0 )
{
- strcpy( availablePortDir, MGdbGet( property->availablePortsDb, idx, property->fieldAvailablePortsDbPortDir ) );
- strcpy( availablePortName, MGdbGet( property->availablePortsDb, idx, property->fieldAvailablePortsDbPortName ) );
+ strcpy( availablePortDir, MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbPortDir ) );
+ strcpy( availablePortName, MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbPortName ) );
rrFillDependencies( property, availablePortName, availablePortDir, counterPtr );
- availablePortsDbIDX = MGdbGetRecordQty( property->availablePortsDb );
- idx = 0;
+ availablePortsDbQTY = MGdbGetRecordQty( property->availablePortsDb );
+ availablePortsDbIDX = 0;
}
- idx++;
+ availablePortsDbIDX++;
}
return( 0 );
}
@@ -340,7 +339,6 @@
char* buffer = NULL;
int availablePortsDbIDX = 0;
int bufferSize = 0xffff;
- int errorCode = 0;
buffer = calloc( bufferSize + 1, 1 );
@@ -361,14 +359,10 @@
return( 1 );
}
MGdbGoTop( property->availablePortsDb );
- availablePortDirPtr = MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, availablePortDir,
- property->fieldAvailablePortsDbPortDir, exact );
- availablePortsDbIDX = MGdbGetRecno( property->availablePortsDb ) - 1;
- if( ( errorCode = MGdbDelete( property->availablePortsDb, availablePortsDbIDX ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- return( 1 );
- }
+ availablePortDirPtr = MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, availablePortDir,
+ property->fieldAvailablePortsDbPortDir, exact );
+ availablePortsDbIDX = MGdbGetRecno( property->availablePortsDb ) - 1;
+ property->availablePortsDb = MGdbDelete( property->availablePortsDb, availablePortsDbIDX );
MGdbAdd( property->availablePortsDb, availablePortName, availablePortDir, "1", NULL);
return( 0 );
@@ -435,8 +429,8 @@
int idx1 = 0;
int idx2 = 0;
- dependencyPortDir = (char*)calloc( 255, 1 );
- dependencyPortName = (char*)calloc( 255, 1 );
+ dependencyPortDir = (char*)calloc( bufferSize, 1 );
+ dependencyPortName = (char*)calloc( bufferSize, 1 );
bufferSize = strlen( buffer );
idx1 = 0;
diff -ruN ../0.3.3/libMGPM/src/MGPMrSinglePortCreateStatusDb.c ./libMGPM/src/MGPMrSinglePortCreateStatusDb.c
--- ../0.3.3/libMGPM/src/MGPMrSinglePortCreateStatusDb.c Sat Nov 5 21:12:54 2005
+++ ./libMGPM/src/MGPMrSinglePortCreateStatusDb.c Tue Nov 8 15:53:41 2005
@@ -52,7 +52,7 @@
counterPtr = &counter;
- availablePortDir = (char*)calloc( 255, 1 );
+ availablePortDir = (char*)calloc( bufferSize, 1 );
availablePortName = (char*)calloc( bufferSize, 1 );
/*.............................................................*/
@@ -237,7 +237,6 @@
char* buffer = NULL;
int availablePortsDbIDX = 0;
int bufferSize = 0xffff;
- int errorCode = 0;
buffer = calloc( bufferSize + 1, 1 );
rDependencyParse( property, buffer, availablePortName, availablePortDir, BUILD_DEPENDS, counterPtr );
@@ -257,13 +256,8 @@
availablePortDirPtr = MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, availablePortDir,
property->fieldAvailablePortsDbPortDir, exact );
availablePortsDbIDX = MGdbGetRecno( property->availablePortsDb ) - 1;
- if( ( errorCode = MGdbDelete( property->availablePortsDb, availablePortsDbIDX ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- return( 1 );
- }
+ property->availablePortsDb = MGdbDelete( property->availablePortsDb, availablePortsDbIDX );
MGdbAdd( property->availablePortsDb, availablePortName, availablePortDir, "1", NULL);
-
return( 0 );
}
@@ -328,8 +322,8 @@
int idx1 = 0;
int idx2 = 0;
- dependencyPortDir = (char*)calloc( 255, 1 );
- dependencyPortName = (char*)calloc( 255, 1 );
+ dependencyPortDir = (char*)calloc( bufferSize, 1 );
+ dependencyPortName = (char*)calloc( bufferSize, 1 );
bufferSize = strlen( buffer );
idx1 = 0;
diff -ruN ../0.3.3/libMGPM/src/MGPMrSinglePortStatus.c ./libMGPM/src/MGPMrSinglePortStatus.c
--- ../0.3.3/libMGPM/src/MGPMrSinglePortStatus.c Mon Nov 7 09:48:20 2005
+++ ./libMGPM/src/MGPMrSinglePortStatus.c Tue Nov 8 11:18:04 2005
@@ -333,6 +333,7 @@
char* oldDependencyDir,
int* counterPtr )
{
+ char* availableDependenciesDbDependencyTypePtr = NULL;
char id[] = "rCheckForOldDependencies";
char exact[] = "exact";
char* availableDependenciesDbDependencyNamePtr = NULL;
@@ -351,19 +352,20 @@
* is a BUILD_DEPENDS desired out come is installedPortsDbPortDir with
* a RUN_DEPENDS at finish time
*/
- while( ( availableDependenciesDbDependencyNamePtr = MGdbSeek( property->availableDependenciesDb,
- property->fieldAvailableDependenciesDbPortDir,
- installedPortsDbPortDir,
- property->fieldAvailableDependenciesDbDependencyName,
- exact ) ) )
+ while( ( availableDependenciesDbDependencyNamePtr = MGdbSeek( property->availableDependenciesDb,
+ property->fieldAvailableDependenciesDbPortDir,
+ installedPortsDbPortDir,
+ property->fieldAvailableDependenciesDbDependencyName,
+ exact ) ) )
{
- if( strcmp( MGdbGet( property->availableDependenciesDb,
- MGdbGetRecno( property->availableDependenciesDb ) -1,
- property->fieldAvailableDependenciesDbDependType ), "BUILD_DEPENDS" ) == 0 )
+ availableDependenciesDbDependencyTypePtr = MGdbGet( property->availableDependenciesDb,
+ MGdbGetRecno( property->availableDependenciesDb ) -1,
+ property->fieldAvailableDependenciesDbDependType );
+
+ if( availableDependenciesDbDependencyTypePtr && strcmp( availableDependenciesDbDependencyTypePtr, "BUILD_DEPENDS" ) == 0 )
{
continue;
}
-
break;
}
diff -ruN ../0.3.3/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c
--- ../0.3.3/libMGPM/src/MGPMrUpdate.c Sun Nov 6 05:17:31 2005
+++ ./libMGPM/src/MGPMrUpdate.c Tue Nov 8 16:34:59 2005
@@ -69,7 +69,6 @@
char yes[] = "--yes";
char* availableDependenciesDbDependencyDirPtr = NULL;
char* availableDependenciesDbDependencyNamePtr = NULL;
- char* availablePortsFlagPtr = NULL;
char* bufferBase = NULL;
char* dependencyDbDependencyPortDirPtr = NULL;
char* dependencyDbDependencyPortNamePtr = NULL;
@@ -272,14 +271,12 @@
fprintf( stdout, "one more attempt and it will be marked as ignore.\n\n" );
while( fflush( stdout ) );
MGdbGoTop( property->strikesDb );
- strikePtr = MGdbSeek( property->strikesDb, property->fieldStrikesDbPortDir, oldPortDir, property->fieldStrikesIDX, exact );
- if( ( errorCode = MGdbDelete( property->strikesDb, MGdbGetRecno( property->strikesDb ) - 1 ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- while( fflush( stdout ) );
- rCleanUp( property, &localProperty );
- return( 1 );
- }
+ strikePtr = MGdbSeek( property->strikesDb,
+ property->fieldStrikesDbPortDir,
+ oldPortDir,
+ property->fieldStrikesIDX,
+ exact );
+ property->strikesDb = MGdbDelete( property->strikesDb, MGdbGetRecno( property->strikesDb ) - 1 );
MGdbAdd( property->strikesDb, oldPortDir, "2", NULL );
if( property->log )
{
@@ -779,7 +776,8 @@
MGdbGetRecno( property->availablePortsDb ) - 1,
property->fieldAvailablePortsDbPortName ) );
while( fflush( stdout ) );
- MGdbDelete( property->availablePortsDb, MGdbGetRecno( property->availablePortsDb ) - 1 );
+ property->availablePortsDb = MGdbDelete( property->availablePortsDb,
+ MGdbGetRecno( property->availablePortsDb ) - 1 );
MGdbGoTop( property->availablePortsDb );
}
@@ -1262,19 +1260,17 @@
if( property->pmMode || property->forced )
{
MGdbGoTop( property->availablePortsDb );
- availablePortsFlagPtr = MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, oldPortDir,
- property->fieldAvailablePortsDbFlag, exact );
- if( availablePortsFlagPtr && strncmp( availablePortsFlagPtr, "2", 1 ) )
+ if( strncmp( MGdbSeek( property->availablePortsDb,
+ property->fieldAvailablePortsDbPortDir,
+ oldPortDir,
+ property->fieldAvailablePortsDbFlag,
+ exact ),
+ "2", 1 ) )
{
availablePortsDbIDX = MGdbGetRecno( property->availablePortsDb ) - 1;
strcpy( localProperty.newPortName, MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbPortName ) );
strcpy( localProperty.newPortDir, MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbPortDir ) );
- if( ( errorCode = MGdbDelete( property->availablePortsDb, availablePortsDbIDX ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- rCleanUp( property, &localProperty );
- return( 1 );
- }
+ property->availablePortsDb = MGdbDelete( property->availablePortsDb, availablePortsDbIDX );
MGdbAdd( property->availablePortsDb, localProperty.newPortName, localProperty.newPortDir, "2", NULL );
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,719 +0,0 @@
diff -ruN ../0.3.3_2/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c
--- ../0.3.3_2/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Tue Nov 8 17:05:25 2005
+++ ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Thu Nov 10 07:57:49 2005
@@ -159,7 +159,9 @@
availablePortsDbIDX = 1;
while( availablePortsDbIDX < availablePortsDbQTY )
{
- if( strncmp( MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbFlag ), "0", 1 ) == 0 )
+ if( MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbFlag )
+ &&
+ strncmp( MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbFlag ), "0", 1 ) == 0 )
{
strcpy( availablePortDir, MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbPortDir ) );
strcpy( availablePortName, MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbPortName ) );
diff -ruN ../0.3.3_2/libMGPM/src/MGPMrReadConfigure.c ./libMGPM/src/MGPMrReadConfigure.c
--- ../0.3.3_2/libMGPM/src/MGPMrReadConfigure.c Tue Nov 8 17:05:25 2005
+++ ./libMGPM/src/MGPMrReadConfigure.c Wed Nov 9 20:01:21 2005
@@ -93,6 +93,24 @@
strcat( command, property->configConfFileName );
system( command );
}
+ strcpy( command, "chmod 0600 " );
+ strcat( command, property->configConfFileName );
+ system( command );
+
+ strcpy( command, "chmod 0600 " );
+ strcat( command, property->configConfFileName );
+ strcat( command, ".SAMPLE " );
+ system( command );
+
+ strcpy( command, "chown root:wheel " );
+ strcat( command, property->configConfFileName );
+ system( command );
+
+ strcpy( command, "chown root:wheel " );
+ strcat( command, property->configConfFileName );
+ strcat( command, ".SAMPLE " );
+ system( command );
+
/*********************/
/* parse pm-020.conf */
/*********************/
diff -ruN ../0.3.3_2/libMGPM/src/MGPMrShowLeavesDelete.c ./libMGPM/src/MGPMrShowLeavesDelete.c
--- ../0.3.3_2/libMGPM/src/MGPMrShowLeavesDelete.c Tue Nov 8 17:05:25 2005
+++ ./libMGPM/src/MGPMrShowLeavesDelete.c Thu Nov 10 01:03:17 2005
@@ -30,17 +30,17 @@
#include <libMGPM.h>
#include <sgtty.h>
-int nuke( char* leafPortDirPtr );
+int nuke( char* leafPortDir );
int rebuildDb( structProperty* property, int* installedPortsDbQTY );
-int removePort( structProperty* property, char* leafPortNamePtr, int installedPortsDbIDX );
+int removePort( structProperty* property, char* leafPortName, int installedPortsDbIDX );
int MGPMrShowLeavesDelete( structProperty* property )
{
char exact[] = "exact";
char id[] = "MGPMrShowLeavesDelete";
char* command = NULL;
- char* leafPortDirPtr = NULL;
- char* leafPortNamePtr = NULL;
+ char* leafPortDir = NULL;
+ char* leafPortName = NULL;
char* pkgDescFile = NULL;
char* portDirPtr = NULL;
char* portTypePtr = NULL;
@@ -49,8 +49,10 @@
int installedPortsDbQTY = 0;
int key = 1;
- pkgDescFile = (char*)calloc( bufferSize, 1 );
- command = (char*)calloc( bufferSize, 1 );
+ command = calloc( bufferSize, 1 );
+ leafPortDir = calloc( bufferSize, 1 );
+ leafPortName = calloc( bufferSize, 1 );
+ pkgDescFile = calloc( bufferSize, 1 );
if( ( property->ignoreDb = MGdbOpen( property->ignoreDbFileName ) ) == NULL )
{
@@ -84,8 +86,8 @@
installedPortsDbIDX = 1;
while( installedPortsDbIDX < installedPortsDbQTY )
{
- leafPortDirPtr = MGdbGet( property->installedPortsDb, installedPortsDbIDX, property->fieldInstalledPortsDbPortDir );
- leafPortNamePtr = MGdbGet( property->installedPortsDb, installedPortsDbIDX, property->fieldInstalledPortsDbPortName );
+ strcpy( leafPortDir, MGdbGet( property->installedPortsDb, installedPortsDbIDX, property->fieldInstalledPortsDbPortDir ) );
+ strcpy( leafPortName, MGdbGet( property->installedPortsDb, installedPortsDbIDX, property->fieldInstalledPortsDbPortName ) );
/*
* check for no run depends
@@ -93,7 +95,7 @@
MGdbGoTop( property->dependencyPortsDb );
portDirPtr = MGdbSeek( property->dependencyPortsDb,
property->fieldDependencyDbDependencyPortDir,
- leafPortDirPtr,
+ leafPortDir,
property->fieldDependencyDbDependencyPortDir,
exact );
@@ -105,7 +107,7 @@
MGdbGoTop( property->availableDependenciesDb );
portTypePtr = MGdbSeek( property->availableDependenciesDb,
property->fieldAvailableDependenciesDbDependencyDir,
- leafPortDirPtr,
+ leafPortDir,
property->fieldAvailableDependenciesDbDependType,
exact );
@@ -113,7 +115,7 @@
{
portTypePtr = MGdbSeek( property->availableDependenciesDb,
property->fieldAvailableDependenciesDbDependencyDir,
- leafPortDirPtr,
+ leafPortDir,
property->fieldAvailableDependenciesDbDependType,
exact );
}
@@ -132,11 +134,11 @@
fprintf( stdout, "however, other ports may rely on these to build.\"\n" );
fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "%s dir -=> %s\n\n", leafPortNamePtr, leafPortDirPtr );
+ fprintf( stdout, "%s dir -=> %s\n\n", leafPortName, leafPortDir );
while( fflush( stdout ) );
strcpy( pkgDescFile, PORTSDIR );
- strcat( pkgDescFile, leafPortDirPtr );
+ strcat( pkgDescFile, leafPortDir );
strcat( pkgDescFile, "/pkg-descr" );
if( MGrIfFileExist( pkgDescFile ) )
@@ -150,7 +152,7 @@
{
strcpy( command, "grep COMMENT " );
strcat( command, PORTSDIR );
- strcat( command, leafPortDirPtr );
+ strcat( command, leafPortDir );
strcat( command, "/Makefile" );
system( command );
}
@@ -167,48 +169,48 @@
}
case KEY_SPACE:
{
- MGdbAdd( property->ignoreDb, leafPortDirPtr, "-slid <SPACE> skipped", NULL );
- fprintf( stdout, "<SPACE> Skipping %s\n\n", leafPortNamePtr );
+ MGdbAdd( property->ignoreDb, leafPortDir, "-slid <SPACE> skipped", NULL );
+ fprintf( stdout, "<SPACE> Skipping %s\n\n", leafPortName );
break;
}
case KEY_n:
{
/* nuke() */
- fprintf( stdout, "<n> Nuking %s\n\n", leafPortNamePtr );
- removePort( property, leafPortNamePtr, installedPortsDbIDX );
- nuke( leafPortDirPtr );
+ fprintf( stdout, "<n> Nuking %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
+ nuke( leafPortDir );
rebuildDb( property, &installedPortsDbQTY );
break;
}
case KEY_N:
{
/* nuke() */
- fprintf( stdout, "<N> Nuking %s\n\n", leafPortNamePtr );
- removePort( property, leafPortNamePtr, installedPortsDbIDX );
- nuke( leafPortDirPtr );
+ fprintf( stdout, "<N> Nuking %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
+ nuke( leafPortDir );
rebuildDb( property, &installedPortsDbQTY );
break;
}
case KEY_x:
{
/* delete() */
- fprintf( stdout, "<x> Removing %s\n\n", leafPortNamePtr );
- removePort( property, leafPortNamePtr, installedPortsDbIDX );
+ fprintf( stdout, "<x> Removing %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
rebuildDb( property, &installedPortsDbQTY );
break;
}
case KEY_X:
{
/* delete() */
- fprintf( stdout, "<X> Removing %s\n\n", leafPortNamePtr );
- removePort( property, leafPortNamePtr, installedPortsDbIDX );
+ fprintf( stdout, "<X> Removing %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
rebuildDb( property, &installedPortsDbQTY );
break;
}
default:
{
- MGdbAdd( property->ignoreDb, leafPortDirPtr, "-slid <DEFAULT> skipped", NULL );
- fprintf( stdout, "Skipping %s\n\n", leafPortNamePtr );
+ MGdbAdd( property->ignoreDb, leafPortDir, "-slid <DEFAULT> skipped", NULL );
+ fprintf( stdout, "Skipping %s\n\n", leafPortName );
break;
}
}
@@ -221,6 +223,9 @@
MGdbDestroy( property->ignoreDb );
MGdbDestroy( property->installedPortsDb );
free( command );
+ free( leafPortDir );
+ free( leafPortName );
+ free( pkgDescFile );
return(0);
}
@@ -266,7 +271,7 @@
}
/***********************************************************************/
-int nuke( char* leafPortDirPtr )
+int nuke( char* leafPortDir )
{
char* command = NULL;
@@ -274,7 +279,7 @@
strcpy( command, "cd " );
strcat( command, PORTSDIR );
- strcat( command, leafPortDirPtr );
+ strcat( command, leafPortDir );
strcat( command, "; make distclean" );
fprintf( stdout, "\nexecuting: %s\n", command );
while( fflush( stdout ) );
diff -ruN ../0.3.3_2/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c
--- ../0.3.3_2/libMGPM/src/MGPMrUpdate.c Wed Nov 9 13:24:45 2005
+++ ./libMGPM/src/MGPMrUpdate.c Wed Nov 9 21:54:00 2005
@@ -41,10 +41,15 @@
char* buffer;
char* command;
char* commandRestart;
+ char* installedPortName;
char* newPortDir;
char* newPortName;
char* optionsCheck;
char* optionsDir;
+ char* startPortCmd;
+ char* startPortDir;
+ char* stopPortCmd;
+ char* stopPortDir;
char* workDir;
} structLocalProperty;
@@ -58,6 +63,8 @@
char BROKEN[] = "BROKEN";
char FORBIDDEN[] = "FORBIDDEN";
char IGNORE[] = "IGNORE";
+ char START[] = "/START";
+ char STOP[] = "/STOP";
char backUp[] = "--back-up";
char bu[] = "-bu";
char exact[] = "exact";
@@ -71,11 +78,12 @@
char* availableDependenciesDbDependencyDirPtr = NULL;
char* availableDependenciesDbDependencyNamePtr = NULL;
char* bufferBase = NULL;
- char* installedPortsDbPortNamePtr = NULL;
char* ipPtr = NULL;
char* oldPortDirPtr = NULL;
char* options = NULL;
char* stinker = NULL;
+ char* startPortDirPtr = NULL;
+ char* stopPortDirPtr = NULL;
char* strikePtr = NULL;
int availableDependenciesDbIDX = 0;
int availableDependenciesDbQTY = 0;
@@ -99,12 +107,17 @@
localProperty.buffer = (char*)calloc( bufferSize, 1 );
localProperty.command = (char*)calloc( bufferSize, 1 );
localProperty.commandRestart = (char*)calloc( bufferSize, 1 );
+ localProperty.installedPortName = (char*)calloc( 511, 1 );
localProperty.newPortDir = (char*)calloc( 511, 1 );
localProperty.newPortName = (char*)calloc( 511, 1 );
localProperty.optionsCheck = (char*)calloc( 511, 1 );
localProperty.optionsDir = (char*)calloc( 511, 1 );
+ localProperty.startPortCmd = (char*)calloc( 511, 1 );
+ localProperty.startPortDir = (char*)calloc( 511, 1 );
+ localProperty.stopPortCmd = (char*)calloc( 511, 1 );
+ localProperty.stopPortDir = (char*)calloc( 511, 1 );
localProperty.workDir = (char*)calloc( 511, 1 );
-
+
property->availableDependenciesDb = MGdbOpen( property->availableDependenciesDbFileName );
property->availablePortsDb = MGdbOpen( property->availablePortsDbFileName );
property->commandLineDb = MGdbOpen( property->commandLineDbFileName );
@@ -179,6 +192,63 @@
strcpy( localProperty.beforeOptionsFileSize, MGrIntToString( MGrFileSize( localProperty.optionsDir ) ) );
/*
+ * gather stop/start instructions if they exist
+ */
+ MGdbGoTop( property->configDb );
+ while( MGdbSeek( property->configDb,
+ property->fieldConfigDbKey,
+ STOP,
+ property->fieldConfigDbKey,
+ exact )
+ &&
+ strncmp( oldPortDir,
+ MGdbGet( property->configDb,
+ MGdbGetRecno( property->configDb ) - 1,
+ property->fieldConfigDbValue ),
+ strlen( oldPortDir ) ) == 0 )
+ {
+ stopPortDirPtr = MGdbGet( property->configDb,
+ MGdbGetRecno( property->configDb ) - 1,
+ property->fieldConfigDbValue );
+ if( stopPortDirPtr[strlen( oldPortDir )] == SPACE )
+ {
+ strncpy( localProperty.stopPortDir, stopPortDirPtr, strlen( oldPortDir ) );
+ strcpy( localProperty.stopPortCmd, stopPortDirPtr + strlen( oldPortDir ) + 1 );
+ break;
+ }
+ else
+ {
+ break;
+ }
+ }
+ MGdbGoTop( property->configDb );
+ while( MGdbSeek( property->configDb,
+ property->fieldConfigDbKey,
+ START,
+ property->fieldConfigDbKey,
+ exact )
+ &&
+ strncmp( oldPortDir,
+ MGdbGet( property->configDb,
+ MGdbGetRecno( property->configDb ) - 1,
+ property->fieldConfigDbValue ),
+ strlen( oldPortDir ) ) == 0 )
+ {
+ startPortDirPtr = MGdbGet( property->configDb,
+ MGdbGetRecno( property->configDb ) - 1,
+ property->fieldConfigDbValue );
+ if( startPortDirPtr[strlen( oldPortDir )] == SPACE )
+ {
+ strncpy( localProperty.startPortDir, startPortDirPtr, strlen( oldPortDir ) );
+ strcpy( localProperty.startPortCmd, startPortDirPtr + strlen( oldPortDir ) + 1 );
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ /*
* Do update in interactive mode (command line switch -ui )
*/
if( property->interactive )
@@ -346,6 +416,16 @@
* options changed so need to purge oldPortDir's records
* from availablePortsDb and availableDependenciesDb
*/
+ if( property->log )
+ {
+ strcpy( localProperty.command, "echo \" options changed so returning " );
+ strcat( localProperty.command, oldPortName );
+ strcat( localProperty.command, " " );
+ strcat( localProperty.command, oldPortDir );
+ strcat( localProperty.command, " to out of date pool " );
+ strcat( localProperty.command, " \">> /var/log/portmanager.log" );
+ system( localProperty.command );
+ }
property->optionsChanged = 1;
MGdbGoTop( property->availablePortsDb );
while( MGdbSeek( property->availablePortsDb,
@@ -519,12 +599,13 @@
installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
while( installedPortsDbIDX < installedPortsDbQTY )
{
- installedPortsDbPortNamePtr = MGdbGet( property->installedPortsDb, installedPortsDbIDX,
- property->fieldInstalledPortsDbPortName );
- stinker = strstr( bufferBase, installedPortsDbPortNamePtr );
+ strcpy( localProperty.installedPortName, MGdbGet( property->installedPortsDb,
+ installedPortsDbIDX,
+ property->fieldInstalledPortsDbPortName ) );
+ stinker = strstr( bufferBase, localProperty.installedPortName );
if( stinker )
{
- fprintf( stdout, "OK to remove conflicting port %s Yy/Nn/Aa [Y]\? ", installedPortsDbPortNamePtr );
+ fprintf( stdout, "OK to remove conflicting port %s Yy/Nn/Aa [Y]\? ", localProperty.installedPortName );
while( fflush( stdout ) );
if( property->autoConflicts == 0 )
{
@@ -585,7 +666,7 @@
}
}
strcpy( localProperty.command, "pkg_delete -f " );
- strcat( localProperty.command, installedPortsDbPortNamePtr );
+ strcat( localProperty.command, localProperty.installedPortName );
fprintf( stdout, "executing: %s\n", localProperty.command );
while( fflush( stdout ) );
errorCode = system( localProperty.command );
@@ -918,6 +999,56 @@
}
else
{
+ /*
+ * use localProperty.stopPortCmd if it is defined
+ */
+ if( strcmp( oldPortDir, localProperty.stopPortDir ) == 0 )
+ {
+ fprintf( stdout, "%s %s info: running %s stop command %s\n",
+ id,
+ PACKAGE_VERSION,
+ localProperty.stopPortDir,
+ localProperty.stopPortCmd );
+ while( fflush( stdout ) );
+
+ localProperty.buffer[0] = 0;
+ pHandle = popen( localProperty.stopPortCmd, "r" );
+ fread( localProperty.buffer, bufferSize, 1, pHandle );
+ pclose( pHandle );
+/*
+ idx = 0;
+ while( idx < bufferSize )
+ {
+ if( localProperty.buffer[idx] == LINEFEED
+ ||
+ localProperty.buffer[idx] == TAB
+ ||
+ localProperty.buffer[idx] == SPACE )
+ {
+ localProperty.buffer[idx] = 0;
+ break;
+ }
+ idx++;
+ }
+*/
+ if( property->log )
+ {
+ strcpy( localProperty.command, "echo \" stopping " );
+ strcat( localProperty.command, oldPortName );
+ strcat( localProperty.command, " " );
+ strcat( localProperty.command, oldPortDir );
+ strcat( localProperty.command, " execution by running " );
+ strcat( localProperty.command, localProperty.stopPortCmd );
+ strcat( localProperty.command, " \">> /var/log/portmanager.log" );
+ system( localProperty.command );
+ }
+ fprintf( stdout, "%s reply: %s\n", localProperty.stopPortCmd, localProperty.buffer );
+ while( fflush( stdout ) );
+ }
+
+ /*
+ * remove old port
+ */
strcpy( localProperty.command, "pkg_delete -f ");
strcat( localProperty.command, oldPortName);
fprintf( stdout, "%s\n", SINGLE_LINES );
@@ -1041,6 +1172,54 @@
system( localProperty.command );
}
}
+
+ /*
+ * use localProperty.startPortCmd if it is defined
+ */
+ if( strcmp( oldPortDir, localProperty.startPortDir ) == 0 )
+ {
+ fprintf( stdout, "%s %s info: running %s start command %s\n",
+ id,
+ PACKAGE_VERSION,
+ localProperty.startPortDir,
+ localProperty.startPortCmd );
+ while( fflush( stdout ) );
+ localProperty.buffer[0] = 0;
+ pHandle = popen( localProperty.startPortCmd, "r" );
+ fread( localProperty.buffer, bufferSize, 1, pHandle );
+ pclose( pHandle );
+/*
+ idx = 0;
+ while( idx < bufferSize )
+ {
+ if( localProperty.buffer[idx] == LINEFEED
+ ||
+ localProperty.buffer[idx] == TAB
+ ||
+ localProperty.buffer[idx] == SPACE )
+ {
+ localProperty.buffer[idx] = 0;
+ break;
+ }
+ idx++;
+ }
+*/
+ if( property->log )
+ {
+ strcpy( localProperty.command, "echo \" starting " );
+ strcat( localProperty.command, oldPortName );
+ strcat( localProperty.command, " " );
+ strcat( localProperty.command, oldPortDir );
+ strcat( localProperty.command, " execution by running " );
+ strcat( localProperty.command, localProperty.startPortCmd );
+ strcat( localProperty.command, " \">> /var/log/portmanager.log" );
+ system( localProperty.command );
+ }
+
+ fprintf( stdout, "%s reply: %s\n", localProperty.startPortCmd, localProperty.buffer );
+ while( fflush( stdout ) );
+ }
+
/************************************************************************/
/* Command "13" make package */
/************************************************************************/
@@ -1229,10 +1408,15 @@
free( localProperty->buffer );
free( localProperty->command );
free( localProperty->commandRestart );
+ free( localProperty->installedPortName );
free( localProperty->newPortDir );
free( localProperty->newPortName );
free( localProperty->optionsCheck );
free( localProperty->optionsDir );
+ free( localProperty->startPortCmd );
+ free( localProperty->startPortDir );
+ free( localProperty->stopPortCmd );
+ free( localProperty->stopPortDir );
free( localProperty->workDir );
return(0);
diff -ruN ../0.3.3_2/portmanager/pm-020.conf.SAMPLE ./portmanager/pm-020.conf.SAMPLE
--- ../0.3.3_2/portmanager/pm-020.conf.SAMPLE Tue Nov 8 17:05:25 2005
+++ ./portmanager/pm-020.conf.SAMPLE Wed Nov 9 14:22:48 2005
@@ -1,42 +1,40 @@
-#............................................
-# port manager example configuration file ver 0.2.0
-#............................................................
-# the format of portmanager.conf is critical!
-#
-# 1. Comments delimited with # should be ok
-# 2. No leading white space( space or tabs )
-# 3. Placement of "|" is critical here is the format:
#
-# [port category dir/port dir] | [ all port build options go here ] |
+# port manager example configuration file ver 0.2.0
#
-# 4. white space between port options is ok, and between final "|" and
-# the start of a comment
+
+CATEGORY/PORT|OPTION=| # do not delete this line!
+
#
-# example:
-#............................................................
# port | options |
-#............................................................
-#x11-toolkits/vte|WITH_GLX=yes -DNOCLEAN| # some comment.......
-#java/jdk14|-DMINIMAL| # anothe comment....
-#............................................................
-CATEGORY/PORT|OPTION=| # do not delete this line!
+#
-#####################
-# custom settings #
-# remove "#" to use #
-#####################
#textproc/docproj|JADETEX=no|
#java/jdk14|-DMINIMAL|
#textproc/libxml2|THREADS=off SCHEMA=on MEM_DEBUG=off XMLLINT_HIST=off THREAD_ALLOC=off|
+
#
+# do not let portmanager update the following ports
#
-##
-##do not let portmanager update the following ports
+
#IGNORE|editors/openoffice-1.1|
#IGNORE|java/jdk14|
-
-
+#
+# STOP/START these programs if they are updated
+#
+# Stop command will be run after program is built, before
+# old installed version is removed
+#
+# Start command will be run after rebuilt program is
+# installed and successfully registerd
+#
+# note:
+# must have leading "/" in /{category}/{port dir}
+# anything after /{category}/{port dir} is run as
+# a sh shell command
+#
+#STOP|/mail/postfix /usr/local/sbin/postfix stop|
+#START|/mail/postfix /usr/local/sbin/postfix start|
diff -ruN ../0.3.3_2/portmanager/portmanager.1 ./portmanager/portmanager.1
--- ../0.3.3_2/portmanager/portmanager.1 Tue Nov 8 17:05:25 2005
+++ ./portmanager/portmanager.1 Wed Nov 9 18:49:17 2005
@@ -128,24 +128,6 @@
.sp
http://portmanager.sunsite.dk/
.sp
- \fBMail lists\fR
-.sp
-portmanager-questions@sunsite.dk
-.sp
-To subscribe send an empty message to:
- portmanager-questions-subscribe@sunsite.dk
-.sp
- archive: http://www.mail-archive.com/portmanager-questions%40sunsite.dk/
-.sp
-.sp
-If you would like to joint portmanager's development team let us know at:
-portmanager-devel@sunsite.dk
-.sp
-To subscribe send an empty message to:
- portmanager-devel-subscribe@sunsite.dk
-.sp
- archive: http://www.mail-archive.com/portmanager-devel%40sunsite.dk/
-.sp
.\"=======================================================================
.\".Sh IMPLEMENTATION NOTES
.\"=======================================================================
@@ -166,35 +148,44 @@
.sp
pm\&-020.conf example:
.sp
- # the format of pm\&-020.conf is critical
#
- # 1. Comments delimited with # should be ok
- # 2. No leading white space( space or tabs )
- # 3. Placement of \&"\&|\&" is critical here is the format:
- #
- # [port category dir/port dir] \&| [ all port build options go here ] \&|
- #
- # 4. white space between port options is ok, and between final \&"\&|\&" and
- # the start of a comment
- #
- # example:
- #............................................................
- # port \&| options \&|
- #............................................................
- #x11\&-toolkits/vte\&|WITH_GLX=yes \&-DNOCLEAN\&| # some comment.......
- #java/jdk14\&|\&-DMINIMAL\&| # another comment....
- #............................................................
- CATEGORY/PORT\&|OPTION=\&| # do not delete this line
- #
- devel/sdl12\&|WITH_NAS=yes\&|
- editors/openoffice\&-1.1\&|WITH_TTF_BYTECODE_ENABLED=yes\&|
- java/jdk14\&|WITH_IPV6=yes\&|
- multimedia/avifile\&|WITH_OPTIMIZED_CFLAGS=yes\&|
- local/sysutils/portmanager\&|PREFIX=/home/mike/TEMP\&|
- #
- #do not let portmanager update the following ports
- IGNORE\&|editors/openoffice\&-1.1\&|
- IGNORE\&|java/jdk14\&|
+ # port manager example configuration file ver 0.2.0
+ #
+.sp
+ CATEGORY/PORT\&|OPTION=\&| # do not delete this line!
+.sp
+ #
+ # port \&| options \&|
+ #
+.sp
+ #textproc/docproj\&|JADETEX=no\&|
+ #java/jdk14\&|-DMINIMAL\&|
+ #textproc/libxml2\&|THREADS=off SCHEMA=on MEM_DEBUG=off THREAD_ALLOC=off\&|
+.sp
+ #
+ # do not let portmanager update the following ports
+ #
+.sp
+ #IGNORE\&|editors/openoffice-1.1\&|
+ #IGNORE\&|java/jdk14\&|
+.sp
+ #
+ # STOP/START these programs if they are updated
+ #
+ # Stop command will be run after program is built, before
+ # old installed version is removed
+ #
+ # Start command will be run after rebuilt program is
+ # installed and successfully registerd
+ #
+ # note:
+ # must have leading \&"/\&" in /{category}/{port dir}
+ # anything after /{category}/{port dir} is run as
+ # a sh shell command
+ #
+ #STOP\&|/mail/postfix /usr/local/sbin/postfix stop\&|
+ #START\&|/mail/postfix /usr/local/sbin/postfix start\&|
+.sp
.\"=======================================================================
.Sh DIAGNOSTICS
Detail of how portmanager works
diff -ruN ../0.3.3_2/programmer-notes.txt ./programmer-notes.txt
--- ../0.3.3_2/programmer-notes.txt Wed Nov 9 13:24:45 2005
+++ ./programmer-notes.txt Wed Nov 9 22:32:39 2005
@@ -275,6 +275,15 @@
A) Creates database of Installed ports, checks/handles installed ports
that are no longerin the ports tree.
+=====================================
+
+Bring Joy <clarity256@yahoo.com>
+
+It actually is a good idea, but not so simple to implement. The ports system only
+knows what the current dist file so won't tell you if one is out of date, have to
+do some extra digging for that. Still an option to clean old distfiles and old
+packages as you go would be really nice so I will add your iidea to the long term
+goals list.
************** JAVA notes *******************

View file

@ -6,8 +6,7 @@
#
PORTNAME= portmanager
PORTVERSION= 0.3.3
PORTREVISION= 3
PORTVERSION= 0.3.4
CATEGORIES= sysutils
MASTER_SITES= http://portmanager.sunsite.dk/distfiles/ \
${MASTER_SITE_SOURCEFORGE}
@ -38,7 +37,8 @@ CONFIGURE_ARGS= --with-prefix=${PREFIX} --with-bindir=/bin \
--with-portsdir=${PORTSDIR} --with-sharedir=/share/portmanager \
--with-tempdir=/tmp
OPTIONS= DEBUG "Enables debug support and all compile warning" off
OPTIONS= DEBUG "Enable debug support and warnings" off \
BUILD_DEPENDS_ARE_LEAVES "Treat build dependencies as leaves" off
.include <bsd.port.pre.mk>
@ -46,6 +46,10 @@ OPTIONS= DEBUG "Enables debug support and all compile warning" off
CONFIGURE_ARGS+= --with-debug=yes
.endif
.if defined(WITH_BUILD_DEPENDS_ARE_LEAVES)
CONFIGURE_ARGS+= --with-treatBuildDependsAsLeaves=yes
.endif
# Keep this in post-configure. After run configure, he change this value.
post-configure:
@${REINPLACE_CMD} -e \

View file

@ -1,3 +1,3 @@
MD5 (portmanager-0.3.3.tar.gz) = 4d2377a4d3f760335f1f63f5b41bcdc6
SHA256 (portmanager-0.3.3.tar.gz) = 93390d715929f12a2bf0d0762f1f360263665fd8edb1ee7124b3e9817636ad7c
SIZE (portmanager-0.3.3.tar.gz) = 432705
MD5 (portmanager-0.3.4.tar.gz) = 9dcb56c7bfe8041486d8741e6b2cf9bf
SHA256 (portmanager-0.3.4.tar.gz) = 2a1281a2a36b6c4623c05ef4e656319895bdc0511d633ee26396ce8d4bafad21
SIZE (portmanager-0.3.4.tar.gz) = 435628

View file

@ -1,877 +0,0 @@
diff -ruN ../0.3.3/libMG/src/MGdbDelete.c ./libMG/src/MGdbDelete.c
--- ../0.3.3/libMG/src/MGdbDelete.c Sat Nov 5 05:43:08 2005
+++ ./libMG/src/MGdbDelete.c Tue Nov 8 11:38:35 2005
@@ -23,18 +23,19 @@
#include <libMG.h>
#include <libMG.ph>
-int MGdbDelete( classDb* db, int recordIdx )
+classDb* MGdbDelete( classDb* db, int recordIdx )
{
FILE* dbFileStream;
char id[] = "MGdbDelete";
static char* newPath = NULL;
int stringSize = 0;
+ static classDb* newDb;
/* check if we have a valid object */
if(db == NULL || db->parent.type != CLASS_TYPE_DB)
{
fprintf( stderr, "%s error: invalid object type\n", id);
- return( 1 );
+ return( NULL );
}
db->parent.recordIdx = 0;
@@ -50,7 +51,7 @@
{
fprintf( stderr, "%s error: unable to open %s mode \"w\"\n", id, db->parent.path );
perror( "system message" );
- return( 1 );
+ return( NULL );
}
/*zzzzzzzzzzzzzz*/
@@ -91,14 +92,15 @@
newPath = (char*)calloc( stringSize, 1 );
strcpy( newPath, db->parent.path );
MGdbDestroy( db );
- if( ( db = MGdbOpen( newPath ) ) == NULL )
+ if( ( newDb = MGdbOpen( newPath ) ) == NULL )
{
fprintf( stderr, "%s error: unable to MGdbOpen %s\n", id, newPath );
perror( "system message" );
- return( 1 );
+ return( NULL );
}
+ db = newDb;
free( newPath );
- return( 0 );
+ return( newDb );
}
diff -ruN ../0.3.3/libMG/src/MGdbOpen.c ./libMG/src/MGdbOpen.c
--- ../0.3.3/libMG/src/MGdbOpen.c Sat Nov 5 05:43:08 2005
+++ ./libMG/src/MGdbOpen.c Tue Nov 8 08:20:40 2005
@@ -26,11 +26,10 @@
classDb* MGdbOpen( char* dbFileName )
{
char id[] = "MGdbOpen";
- int errorCode = 0;
static classDb* db;
/*zzzzzzzzzzzzzz*/
- db = ( classDb* )malloc( sizeof(classDb) + 1 );
+ db = ( classDb* )calloc( sizeof(classDb), 1 );
db->parent.mallocIdx = 1;
/*zzzzzzzzzzzzzz*/
@@ -48,13 +47,6 @@
db->parent.recordIdx = 0;
db->parent.recordQty = 0;
db->parent.type = CLASS_TYPE_DB;
-
-
- if(errorCode)
- {
- fprintf( stderr, "%s error: %s returned errorCode %d\n", id, "MGmSetString", errorCode );
- assert(0);
- }
MGdbRead( db );
diff -ruN ../0.3.3/libMG/src/libMG.h ./libMG/src/libMG.h
--- ../0.3.3/libMG/src/libMG.h Sat Nov 5 05:43:08 2005
+++ ./libMG/src/libMG.h Tue Nov 8 11:37:11 2005
@@ -106,7 +106,7 @@
classDb* MGdbCreate( char* dbFileName, ... );
classDb* MGdbOpen( char* dbFileName );
int MGdbAdd(classDb* db, ...);
-int MGdbDelete(classDb* db, int recordIdx );
+classDb* MGdbDelete(classDb* db, int recordIdx );
int MGdbDestroy(classDb* db);
int MGdbGetRecno(classDb* db );
int MGdbGetRecordQty(classDb* db);
diff -ruN ../0.3.3/libMGPM/src/MGPMrBestOldPort.c ./libMGPM/src/MGPMrBestOldPort.c
--- ../0.3.3/libMGPM/src/MGPMrBestOldPort.c Mon Nov 7 14:51:35 2005
+++ ./libMGPM/src/MGPMrBestOldPort.c Tue Nov 8 00:16:52 2005
@@ -121,7 +121,7 @@
property->fieldOldPortsDbOldPortDir,
exact ) )
{
- fprintf( stdout, "skipping %s %s old dependency: %s\n",
+ fprintf( stdout, "skipping %s %s until dependency %s updated\n",
oldPortName,
oldPortDir,
MGdbGet( property->availableDependenciesDb,
@@ -156,7 +156,7 @@
property->fieldOldPortsDbOldPortDir,
exact ) )
{
- fprintf( stdout, "skipping %s %s old dependency: %s\n",
+ fprintf( stdout, "skipping %s %s until dependency %s updated\n",
oldPortName,
oldPortDir,
MGdbGet( property->availableDependenciesDb,
diff -ruN ../0.3.3/libMGPM/src/MGPMrController.c ./libMGPM/src/MGPMrController.c
--- ../0.3.3/libMGPM/src/MGPMrController.c Sat Nov 5 05:43:08 2005
+++ ./libMGPM/src/MGPMrController.c Tue Nov 8 12:29:47 2005
@@ -30,9 +30,18 @@
#include <libMGPM.h>
int rPmUpgradeNewMethod( structProperty* property );
-int rPmUpgradeOriginalMethod( structProperty* property );
int MGPMrController( structProperty* property, char* path )
{
+ char ignore[] = "/IGNORE";
+ char upgradeInteractive[] = "--upgrade-interactive";
+ char resume[] = "--resume";
+ char ui[] = "-ui";
+ char backUp[] = "--back-up";
+ char yes[] = "--yes";
+ char y[] = "-y";
+ char f[] = "-f";
+ char fix[] = "--fix";
+ char bu[] = "-bu";
char exact[] = "exact";
char id[] = "MGPMrController";
char* command = NULL;
@@ -52,8 +61,8 @@
int oldPortsDbTOTALIZER = 0;
command = (char*)calloc( bufferSize,1);
- oldPortDir = (char*)calloc(255,1);
- oldPortName = (char*)calloc(255,1);
+ oldPortDir = (char*)calloc(512,1);
+ oldPortName = (char*)calloc(512,1);
xtermTitle = (char*)calloc( bufferSize,1 );
property->cacheDb = MGdbCreate(
@@ -71,14 +80,14 @@
property->commandLineDb = MGdbOpen( property->commandLineDbFileName );
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "-f", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, f, property->fieldCommandLineDbKey, exact ) )
{
property->forced = 1;
fprintf( stdout, "%s %s info: running in forced update mode\n", id, PACKAGE_VERSION );
while( fflush( stdout ) );
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "--fix", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, fix, property->fieldCommandLineDbKey, exact ) )
{
property->forced = 1;
fprintf( stdout, "%s %s info: running in forced update mode\n", id, PACKAGE_VERSION );
@@ -86,37 +95,37 @@
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "-bu", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, bu, property->fieldCommandLineDbKey, exact ) )
{
property->backUp = 1;
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "--back-up", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, backUp, property->fieldCommandLineDbKey, exact ) )
{
property->backUp = 1;
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "-y", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, y, property->fieldCommandLineDbKey, exact ) )
{
property->autoConflicts = 1;
property->autoMoved = 1;
}
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "--yes", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, yes, property->fieldCommandLineDbKey, exact ) )
{
property->autoConflicts = 1;
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "--resume", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, resume, property->fieldCommandLineDbKey, exact ) )
{
property->resume = 1;
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "-ui", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, ui, property->fieldCommandLineDbKey, exact ) )
{
property->interactive = 1;
}
MGdbGoTop( property->commandLineDb );
- if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, "--upgrade-interactive", property->fieldCommandLineDbKey, exact ) )
+ if( MGdbSeek( property->commandLineDb, property->fieldCommandLineDbKey, upgradeInteractive, property->fieldCommandLineDbKey, exact ) )
{
property->interactive = 1;
}
@@ -128,7 +137,7 @@
property->configDb = MGdbOpen( property->configDbFileName );
property->ignoreDb = MGdbOpen( property->ignoreDbFileName );
MGdbGoTop( property->configDb );
- while( ( configDbValuePtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, "/IGNORE", property->fieldConfigDbValue, exact ) ) )
+ while( ( configDbValuePtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, ignore, property->fieldConfigDbValue, exact ) ) )
{
MGdbAdd( property->ignoreDb, configDbValuePtr, "set to ignore in pm-020.conf", NULL );
fprintf( stdout, "%s %s info: Adding %s to ignoreDB reason: %s\n", id, PACKAGE_VERSION, configDbValuePtr, "set to ignore in pm-020.conf" );
@@ -146,6 +155,7 @@
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateInstalledDb", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
@@ -155,11 +165,13 @@
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrShowLeaves", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 0 );
}
@@ -190,6 +202,7 @@
"MGPMrCreateInstalledDb", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
@@ -197,6 +210,10 @@
{
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION,
"MGPMrCreateAllUpdateStatusDb", errorCode );
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 1 );
}
}
@@ -206,6 +223,10 @@
{
fprintf( stdout, "%s %s error: failed to open %s\n", id, PACKAGE_VERSION, property->ignoreDbFileName );
perror( "system" );
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 1 );
}
MGdbDestroy( property->ignoreDb );
@@ -215,11 +236,13 @@
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrShowLeavesDelete", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 0 );
}
@@ -231,6 +254,7 @@
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateStatusDb", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
@@ -238,6 +262,10 @@
if( ( errorCode = MGPMrMissingDependencies( property ) ) )
{
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrMissingDependencies", errorCode );
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 1 );
}
@@ -246,11 +274,13 @@
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateStatusDb", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return(0);
}
@@ -258,9 +288,10 @@
if( path && strcmp( path, "PMUPGRADE" ) == 0 )
{
rPmUpgradeNewMethod( property );
-/*
- rPmUpgradeOriginalMethod( property );
-*/
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 0 );
}
@@ -274,6 +305,10 @@
if( ( errorCode = MGPMrSinglePortCreateStatusDb( property, path ) ) )
{
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrSinglePortCreateStatusDb", errorCode );
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 1 );
}
@@ -293,6 +328,7 @@
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateStatusDb", errorCode );
free( command );
free( oldPortDir );
+ free( oldPortName );
free( xtermTitle );
return( 1 );
}
@@ -300,6 +336,10 @@
if( ( errorCode = MGPMrSinglePortStatus( property ) ) )
{
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrSinglePortStatus", errorCode );
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 1 );
}
oldPortDir[0] = 0;
@@ -319,6 +359,10 @@
else
{
fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrBestOldPort", errorCode );
+ free( command );
+ free( oldPortDir );
+ free( oldPortName );
+ free( xtermTitle );
return( 1 );
}
}
@@ -448,236 +492,9 @@
}
free( command );
free( oldPortDir );
- free( xtermTitle );
- return( errorCode );
-}
-
-/*******************************************************/
-int rPmUpgradeOriginalMethod( structProperty* property )
-/*******************************************************/
-{
- char exact[] = "exact";
- char id[] = "rPmUpgradeOriginalMethod";
- char* command = NULL;
- char* configDbValuePtr = NULL;
- char* oldPortDir = NULL;
- char* oldPortName = NULL;
- char* oldPortsDbNewPortDirPtr = NULL;
- char* oldPortsDbNewPortNamePtr = NULL;
- char* oldPortsDbReasonPtr = NULL;
- char* term = NULL;
- char* xtermTitle = NULL;
- float percentDone = 0;
- int bufferSize = 0xffff;
- int errorCode = 0;
- int oldPortsDbIDX = 0;
- int oldPortsDbQTY = 0;
- int oldPortsDbTOTALIZER = 0;
-
- command = (char*)calloc( bufferSize,1);
- oldPortDir = (char*)calloc(255,1);
- oldPortName = (char*)calloc(255,1);
- xtermTitle = (char*)calloc( bufferSize,1 );
-
- property->cacheDb = MGdbCreate(
- property->cacheDbFileName,
- property->fieldCacheDbPortDir,
- property->fieldCacheDbAvailablePortName,
- property->fieldCacheDbMakeFileSize,
- property->fieldCacheDbMakeFileTime,
- NULL );
- MGdbDestroy( property->cacheDb );
- if( property->log )
- {
- strcpy( command, "echo \"portmanager.log\" " );
- strcat( command, " > /var/log/portmanager.log" );
- system( command );
- strcpy( command, "date >> /var/log/portmanager.log" );
- system( command );
- }
- while( 1 )
- {
- if( ( errorCode = MGPMrCreateInstalledDb( property ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateInstalledDb", errorCode );
- free( command );
- free( oldPortDir );
- free( oldPortName );
- free( xtermTitle );
- return( 1 );
- }
-
- if( ( errorCode = MGPMrMissingDependencies( property ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrMissingDependencies", errorCode );
- free( command );
- free( oldPortDir );
- free( oldPortName );
- free( xtermTitle );
- return( 1 );
- }
- if( ( errorCode = MGPMrStatus( property ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateStatusDb", errorCode );
- free( command );
- free( oldPortDir );
- free( oldPortName );
- free( xtermTitle );
- return( 1 );
- }
- oldPortDir[0] = 0;
- oldPortName[0] = 0;
- if( ( errorCode = MGPMrBestOldPort( property, oldPortDir, oldPortName ) ) )
- {
- if( errorCode == 100 )
- {
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "%s %s INFO: finished with some ports not updated if --log was used see /var/log/portmanager.log\n",
- "portmanager", PACKAGE_VERSION );
- while( fflush( stdout ) );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- errorCode = 0;
- break;
- }
- else
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrBestOldPort", errorCode );
- free( command );
- free( oldPortDir );
- free( oldPortName );
- free( xtermTitle );
- return( 1 );
- }
- }
- if( strlen(oldPortDir) > 1 )
- {
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "updating %s %s\n", oldPortName, oldPortDir );
-
- /*
- * Set xterm title bar indicator
- */
- property->oldPortsDb = MGdbOpen( property->oldPortsDbFileName );
- oldPortsDbQTY = MGdbGetRecordQty( property->oldPortsDb );
-
- if( oldPortsDbQTY - 1 > oldPortsDbTOTALIZER )
- {
- oldPortsDbTOTALIZER = oldPortsDbQTY - 1;
- }
- percentDone = 100 - ( 100 * ( ( (float)oldPortsDbQTY - 1 ) / (float)oldPortsDbTOTALIZER ) );
- fprintf( stdout, "percentDone-=>%d = 100 - ( 100 * ( oldPortsDbQTY-=>%d / oldPortsDbTOTALIZER-=>%d ) ) \n",
- (int)percentDone, oldPortsDbQTY-1, oldPortsDbTOTALIZER );
- while( fflush( stdout ) );
-
- term = getenv("TERM");
- if( term && strncmp( term, "xterm", 5 ) == 0 && isatty(fileno(stdout)) )
- {
- /*
- pr 81481
- To fix the modification of xterm title, even when redirecting, one can
- test isatty(fileno(stdout)) before printing the escape sequence.
- */
- strcpy( xtermTitle, "portmanager" );
- strcat( xtermTitle, " done:% " );
- strcat( xtermTitle, MGrIntToString( (long)percentDone ) );
- strcat( xtermTitle, " updating " );
- strcat( xtermTitle, oldPortName );
- strcat( xtermTitle, " " );
- strcat( xtermTitle, oldPortDir );
- printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
- }
- if( property->log )
- {
- property->configDb = MGdbOpen( property->configDbFileName );
- MGdbGoTop( property->configDb );
- configDbValuePtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, oldPortDir,
- property->fieldConfigDbValue, exact );
-
- MGdbGoTop( property->oldPortsDb );
- oldPortsDbReasonPtr = MGdbSeek( property->oldPortsDb, property->fieldOldPortsDbOldPortDir, oldPortDir,
- property->fieldOldPortsDbReason, exact );
- if( oldPortsDbReasonPtr )
- {
- oldPortsDbIDX = MGdbGetRecno( property->oldPortsDb ) - 1;
- oldPortsDbNewPortNamePtr = MGdbGet( property->oldPortsDb, oldPortsDbIDX,
- property->fieldOldPortsDbNewPortName );
- oldPortsDbNewPortDirPtr = MGdbGet( property->oldPortsDb, oldPortsDbIDX,
- property->fieldOldPortsDbNewPortDir );
- }
- strcpy( command, "echo \" " );
- if( strcmp( oldPortName, "not installed" ) == 0 )
- {
- strcat( command, "adding " );
- strcat( command, oldPortName );
- strcat( command, " " );
- strcat( command, oldPortDir );
- strcat( command, " " );
- }
- else
- {
- strcat( command, "updating " );
- strcat( command, oldPortName );
- strcat( command, " " );
- strcat( command, oldPortDir );
- strcat( command, " " );
- }
- if( configDbValuePtr )
- {
- strcat( command, " options " );
- strcat( command, configDbValuePtr );
- }
- if( oldPortsDbReasonPtr )
- {
- strcat( command, " " );
- strcat( command, oldPortsDbReasonPtr );
- strcat( command, " " );
- strcat( command, oldPortsDbNewPortNamePtr );
- strcat( command, " " );
- strcat( command, oldPortsDbNewPortDirPtr );
- strcat( command, " " );
- }
- strcat( command, "\" >> /var/log/portmanager.log" );
- system( command );
- MGdbDestroy( property->configDb );
- }
- MGdbDestroy( property->oldPortsDb );
- }
- else
- {
- /*
- * Set xterm title bar indicator
- *
- * pr 81481
- * To fix the modification of xterm title, even when redirecting, one can
- * test isatty(fileno(stdout)) before printing the escape sequence.
- */
- if( term && strncmp( term, "xterm", 5 ) == 0 && isatty(fileno(stdout)) )
- {
- strcpy( xtermTitle, "portmanager" );
- strcat( xtermTitle, " " );
- strcat( xtermTitle, " finished" );
- printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
- }
- fprintf( stdout, "%s %s INFO: all ports are up to date\n", "portmanager", PACKAGE_VERSION );
- while( fflush( stdout ) );
- break;
- }
- MGPMrUpdate( property, oldPortDir, oldPortName );
- }
-
- if( property->log )
- {
- strcpy( command, "echo \" end of log \" " );
- strcat( command, " >> /var/log/portmanager.log" );
- system( command );
- strcpy( command, "date >> /var/log/portmanager.log" );
- system( command );
- }
- free( command );
- free( oldPortDir );
free( oldPortName );
free( xtermTitle );
- return( 0 );
+ return( errorCode );
}
/*******************************************************/
@@ -901,6 +718,7 @@
strcpy( command, "date >> /var/log/portmanager.log" );
system( command );
}
+ free( oldPortName );
free( command );
free( oldPortDir );
free( xtermTitle );
diff -ruN ../0.3.3/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c
--- ../0.3.3/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Sun Nov 6 19:26:26 2005
+++ ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Tue Nov 8 15:49:01 2005
@@ -52,7 +52,7 @@
counterPtr = &counter;
- availablePortDir = (char*)calloc( 510, 1 );
+ availablePortDir = (char*)calloc( bufferSize, 1 );
availablePortName = (char*)calloc( bufferSize, 1 );
fprintf( stdout,"%s\n", SINGLE_LINES );
@@ -122,6 +122,7 @@
installedPortsDbIDX++;
}
MGdbDestroy( property->availablePortsDb );
+ MGdbDestroy( property->installedPortsDb );
MGdbDestroy( property->availableDependenciesDb );
MGdbDestroy( property->configDb );
free( availablePortDir );
@@ -132,10 +133,9 @@
int rrFindDepends( structProperty* property, char* availablePortDir, char* availablePortName, int* counterPtr )
{
char id[] = "rrFindDepends";
- char* availablePortsDbFlagPtr = NULL;
int availablePortsDbIDX = 0;
int errorCode = 0;
- int idx = 0;
+ int availablePortsDbQTY = 0;
if( ( errorCode = rrGetPortName( property, availablePortDir, availablePortName ) ) )
{
@@ -155,20 +155,19 @@
/*
* fill dependencies for each record in property->availablePortsDb
*/
- availablePortsDbIDX = MGdbGetRecordQty( property->availablePortsDb );
- idx = 1;
- while( idx < availablePortsDbIDX )
+ availablePortsDbQTY = MGdbGetRecordQty( property->availablePortsDb );
+ availablePortsDbIDX = 1;
+ while( availablePortsDbIDX < availablePortsDbQTY )
{
- availablePortsDbFlagPtr = MGdbGet( property->availablePortsDb, idx, property->fieldAvailablePortsDbFlag );
- if( availablePortsDbFlagPtr && strncmp( availablePortsDbFlagPtr, "0", 1 ) == 0 )
+ if( strncmp( MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbFlag ), "0", 1 ) == 0 )
{
- strcpy( availablePortDir, MGdbGet( property->availablePortsDb, idx, property->fieldAvailablePortsDbPortDir ) );
- strcpy( availablePortName, MGdbGet( property->availablePortsDb, idx, property->fieldAvailablePortsDbPortName ) );
+ strcpy( availablePortDir, MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbPortDir ) );
+ strcpy( availablePortName, MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbPortName ) );
rrFillDependencies( property, availablePortName, availablePortDir, counterPtr );
- availablePortsDbIDX = MGdbGetRecordQty( property->availablePortsDb );
- idx = 0;
+ availablePortsDbQTY = MGdbGetRecordQty( property->availablePortsDb );
+ availablePortsDbIDX = 0;
}
- idx++;
+ availablePortsDbIDX++;
}
return( 0 );
}
@@ -340,7 +339,6 @@
char* buffer = NULL;
int availablePortsDbIDX = 0;
int bufferSize = 0xffff;
- int errorCode = 0;
buffer = calloc( bufferSize + 1, 1 );
@@ -361,14 +359,10 @@
return( 1 );
}
MGdbGoTop( property->availablePortsDb );
- availablePortDirPtr = MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, availablePortDir,
- property->fieldAvailablePortsDbPortDir, exact );
- availablePortsDbIDX = MGdbGetRecno( property->availablePortsDb ) - 1;
- if( ( errorCode = MGdbDelete( property->availablePortsDb, availablePortsDbIDX ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- return( 1 );
- }
+ availablePortDirPtr = MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, availablePortDir,
+ property->fieldAvailablePortsDbPortDir, exact );
+ availablePortsDbIDX = MGdbGetRecno( property->availablePortsDb ) - 1;
+ property->availablePortsDb = MGdbDelete( property->availablePortsDb, availablePortsDbIDX );
MGdbAdd( property->availablePortsDb, availablePortName, availablePortDir, "1", NULL);
return( 0 );
@@ -435,8 +429,8 @@
int idx1 = 0;
int idx2 = 0;
- dependencyPortDir = (char*)calloc( 255, 1 );
- dependencyPortName = (char*)calloc( 255, 1 );
+ dependencyPortDir = (char*)calloc( bufferSize, 1 );
+ dependencyPortName = (char*)calloc( bufferSize, 1 );
bufferSize = strlen( buffer );
idx1 = 0;
diff -ruN ../0.3.3/libMGPM/src/MGPMrSinglePortCreateStatusDb.c ./libMGPM/src/MGPMrSinglePortCreateStatusDb.c
--- ../0.3.3/libMGPM/src/MGPMrSinglePortCreateStatusDb.c Sat Nov 5 21:12:54 2005
+++ ./libMGPM/src/MGPMrSinglePortCreateStatusDb.c Tue Nov 8 15:53:41 2005
@@ -52,7 +52,7 @@
counterPtr = &counter;
- availablePortDir = (char*)calloc( 255, 1 );
+ availablePortDir = (char*)calloc( bufferSize, 1 );
availablePortName = (char*)calloc( bufferSize, 1 );
/*.............................................................*/
@@ -237,7 +237,6 @@
char* buffer = NULL;
int availablePortsDbIDX = 0;
int bufferSize = 0xffff;
- int errorCode = 0;
buffer = calloc( bufferSize + 1, 1 );
rDependencyParse( property, buffer, availablePortName, availablePortDir, BUILD_DEPENDS, counterPtr );
@@ -257,13 +256,8 @@
availablePortDirPtr = MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, availablePortDir,
property->fieldAvailablePortsDbPortDir, exact );
availablePortsDbIDX = MGdbGetRecno( property->availablePortsDb ) - 1;
- if( ( errorCode = MGdbDelete( property->availablePortsDb, availablePortsDbIDX ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- return( 1 );
- }
+ property->availablePortsDb = MGdbDelete( property->availablePortsDb, availablePortsDbIDX );
MGdbAdd( property->availablePortsDb, availablePortName, availablePortDir, "1", NULL);
-
return( 0 );
}
@@ -328,8 +322,8 @@
int idx1 = 0;
int idx2 = 0;
- dependencyPortDir = (char*)calloc( 255, 1 );
- dependencyPortName = (char*)calloc( 255, 1 );
+ dependencyPortDir = (char*)calloc( bufferSize, 1 );
+ dependencyPortName = (char*)calloc( bufferSize, 1 );
bufferSize = strlen( buffer );
idx1 = 0;
diff -ruN ../0.3.3/libMGPM/src/MGPMrSinglePortStatus.c ./libMGPM/src/MGPMrSinglePortStatus.c
--- ../0.3.3/libMGPM/src/MGPMrSinglePortStatus.c Mon Nov 7 09:48:20 2005
+++ ./libMGPM/src/MGPMrSinglePortStatus.c Tue Nov 8 11:18:04 2005
@@ -333,6 +333,7 @@
char* oldDependencyDir,
int* counterPtr )
{
+ char* availableDependenciesDbDependencyTypePtr = NULL;
char id[] = "rCheckForOldDependencies";
char exact[] = "exact";
char* availableDependenciesDbDependencyNamePtr = NULL;
@@ -351,19 +352,20 @@
* is a BUILD_DEPENDS desired out come is installedPortsDbPortDir with
* a RUN_DEPENDS at finish time
*/
- while( ( availableDependenciesDbDependencyNamePtr = MGdbSeek( property->availableDependenciesDb,
- property->fieldAvailableDependenciesDbPortDir,
- installedPortsDbPortDir,
- property->fieldAvailableDependenciesDbDependencyName,
- exact ) ) )
+ while( ( availableDependenciesDbDependencyNamePtr = MGdbSeek( property->availableDependenciesDb,
+ property->fieldAvailableDependenciesDbPortDir,
+ installedPortsDbPortDir,
+ property->fieldAvailableDependenciesDbDependencyName,
+ exact ) ) )
{
- if( strcmp( MGdbGet( property->availableDependenciesDb,
- MGdbGetRecno( property->availableDependenciesDb ) -1,
- property->fieldAvailableDependenciesDbDependType ), "BUILD_DEPENDS" ) == 0 )
+ availableDependenciesDbDependencyTypePtr = MGdbGet( property->availableDependenciesDb,
+ MGdbGetRecno( property->availableDependenciesDb ) -1,
+ property->fieldAvailableDependenciesDbDependType );
+
+ if( availableDependenciesDbDependencyTypePtr && strcmp( availableDependenciesDbDependencyTypePtr, "BUILD_DEPENDS" ) == 0 )
{
continue;
}
-
break;
}
diff -ruN ../0.3.3/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c
--- ../0.3.3/libMGPM/src/MGPMrUpdate.c Sun Nov 6 05:17:31 2005
+++ ./libMGPM/src/MGPMrUpdate.c Tue Nov 8 16:34:59 2005
@@ -69,7 +69,6 @@
char yes[] = "--yes";
char* availableDependenciesDbDependencyDirPtr = NULL;
char* availableDependenciesDbDependencyNamePtr = NULL;
- char* availablePortsFlagPtr = NULL;
char* bufferBase = NULL;
char* dependencyDbDependencyPortDirPtr = NULL;
char* dependencyDbDependencyPortNamePtr = NULL;
@@ -272,14 +271,12 @@
fprintf( stdout, "one more attempt and it will be marked as ignore.\n\n" );
while( fflush( stdout ) );
MGdbGoTop( property->strikesDb );
- strikePtr = MGdbSeek( property->strikesDb, property->fieldStrikesDbPortDir, oldPortDir, property->fieldStrikesIDX, exact );
- if( ( errorCode = MGdbDelete( property->strikesDb, MGdbGetRecno( property->strikesDb ) - 1 ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- while( fflush( stdout ) );
- rCleanUp( property, &localProperty );
- return( 1 );
- }
+ strikePtr = MGdbSeek( property->strikesDb,
+ property->fieldStrikesDbPortDir,
+ oldPortDir,
+ property->fieldStrikesIDX,
+ exact );
+ property->strikesDb = MGdbDelete( property->strikesDb, MGdbGetRecno( property->strikesDb ) - 1 );
MGdbAdd( property->strikesDb, oldPortDir, "2", NULL );
if( property->log )
{
@@ -779,7 +776,8 @@
MGdbGetRecno( property->availablePortsDb ) - 1,
property->fieldAvailablePortsDbPortName ) );
while( fflush( stdout ) );
- MGdbDelete( property->availablePortsDb, MGdbGetRecno( property->availablePortsDb ) - 1 );
+ property->availablePortsDb = MGdbDelete( property->availablePortsDb,
+ MGdbGetRecno( property->availablePortsDb ) - 1 );
MGdbGoTop( property->availablePortsDb );
}
@@ -1262,19 +1260,17 @@
if( property->pmMode || property->forced )
{
MGdbGoTop( property->availablePortsDb );
- availablePortsFlagPtr = MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, oldPortDir,
- property->fieldAvailablePortsDbFlag, exact );
- if( availablePortsFlagPtr && strncmp( availablePortsFlagPtr, "2", 1 ) )
+ if( strncmp( MGdbSeek( property->availablePortsDb,
+ property->fieldAvailablePortsDbPortDir,
+ oldPortDir,
+ property->fieldAvailablePortsDbFlag,
+ exact ),
+ "2", 1 ) )
{
availablePortsDbIDX = MGdbGetRecno( property->availablePortsDb ) - 1;
strcpy( localProperty.newPortName, MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbPortName ) );
strcpy( localProperty.newPortDir, MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbPortDir ) );
- if( ( errorCode = MGdbDelete( property->availablePortsDb, availablePortsDbIDX ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- rCleanUp( property, &localProperty );
- return( 1 );
- }
+ property->availablePortsDb = MGdbDelete( property->availablePortsDb, availablePortsDbIDX );
MGdbAdd( property->availablePortsDb, localProperty.newPortName, localProperty.newPortDir, "2", NULL );
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,719 +0,0 @@
diff -ruN ../0.3.3_2/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c
--- ../0.3.3_2/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Tue Nov 8 17:05:25 2005
+++ ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Thu Nov 10 07:57:49 2005
@@ -159,7 +159,9 @@
availablePortsDbIDX = 1;
while( availablePortsDbIDX < availablePortsDbQTY )
{
- if( strncmp( MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbFlag ), "0", 1 ) == 0 )
+ if( MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbFlag )
+ &&
+ strncmp( MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbFlag ), "0", 1 ) == 0 )
{
strcpy( availablePortDir, MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbPortDir ) );
strcpy( availablePortName, MGdbGet( property->availablePortsDb, availablePortsDbIDX, property->fieldAvailablePortsDbPortName ) );
diff -ruN ../0.3.3_2/libMGPM/src/MGPMrReadConfigure.c ./libMGPM/src/MGPMrReadConfigure.c
--- ../0.3.3_2/libMGPM/src/MGPMrReadConfigure.c Tue Nov 8 17:05:25 2005
+++ ./libMGPM/src/MGPMrReadConfigure.c Wed Nov 9 20:01:21 2005
@@ -93,6 +93,24 @@
strcat( command, property->configConfFileName );
system( command );
}
+ strcpy( command, "chmod 0600 " );
+ strcat( command, property->configConfFileName );
+ system( command );
+
+ strcpy( command, "chmod 0600 " );
+ strcat( command, property->configConfFileName );
+ strcat( command, ".SAMPLE " );
+ system( command );
+
+ strcpy( command, "chown root:wheel " );
+ strcat( command, property->configConfFileName );
+ system( command );
+
+ strcpy( command, "chown root:wheel " );
+ strcat( command, property->configConfFileName );
+ strcat( command, ".SAMPLE " );
+ system( command );
+
/*********************/
/* parse pm-020.conf */
/*********************/
diff -ruN ../0.3.3_2/libMGPM/src/MGPMrShowLeavesDelete.c ./libMGPM/src/MGPMrShowLeavesDelete.c
--- ../0.3.3_2/libMGPM/src/MGPMrShowLeavesDelete.c Tue Nov 8 17:05:25 2005
+++ ./libMGPM/src/MGPMrShowLeavesDelete.c Thu Nov 10 01:03:17 2005
@@ -30,17 +30,17 @@
#include <libMGPM.h>
#include <sgtty.h>
-int nuke( char* leafPortDirPtr );
+int nuke( char* leafPortDir );
int rebuildDb( structProperty* property, int* installedPortsDbQTY );
-int removePort( structProperty* property, char* leafPortNamePtr, int installedPortsDbIDX );
+int removePort( structProperty* property, char* leafPortName, int installedPortsDbIDX );
int MGPMrShowLeavesDelete( structProperty* property )
{
char exact[] = "exact";
char id[] = "MGPMrShowLeavesDelete";
char* command = NULL;
- char* leafPortDirPtr = NULL;
- char* leafPortNamePtr = NULL;
+ char* leafPortDir = NULL;
+ char* leafPortName = NULL;
char* pkgDescFile = NULL;
char* portDirPtr = NULL;
char* portTypePtr = NULL;
@@ -49,8 +49,10 @@
int installedPortsDbQTY = 0;
int key = 1;
- pkgDescFile = (char*)calloc( bufferSize, 1 );
- command = (char*)calloc( bufferSize, 1 );
+ command = calloc( bufferSize, 1 );
+ leafPortDir = calloc( bufferSize, 1 );
+ leafPortName = calloc( bufferSize, 1 );
+ pkgDescFile = calloc( bufferSize, 1 );
if( ( property->ignoreDb = MGdbOpen( property->ignoreDbFileName ) ) == NULL )
{
@@ -84,8 +86,8 @@
installedPortsDbIDX = 1;
while( installedPortsDbIDX < installedPortsDbQTY )
{
- leafPortDirPtr = MGdbGet( property->installedPortsDb, installedPortsDbIDX, property->fieldInstalledPortsDbPortDir );
- leafPortNamePtr = MGdbGet( property->installedPortsDb, installedPortsDbIDX, property->fieldInstalledPortsDbPortName );
+ strcpy( leafPortDir, MGdbGet( property->installedPortsDb, installedPortsDbIDX, property->fieldInstalledPortsDbPortDir ) );
+ strcpy( leafPortName, MGdbGet( property->installedPortsDb, installedPortsDbIDX, property->fieldInstalledPortsDbPortName ) );
/*
* check for no run depends
@@ -93,7 +95,7 @@
MGdbGoTop( property->dependencyPortsDb );
portDirPtr = MGdbSeek( property->dependencyPortsDb,
property->fieldDependencyDbDependencyPortDir,
- leafPortDirPtr,
+ leafPortDir,
property->fieldDependencyDbDependencyPortDir,
exact );
@@ -105,7 +107,7 @@
MGdbGoTop( property->availableDependenciesDb );
portTypePtr = MGdbSeek( property->availableDependenciesDb,
property->fieldAvailableDependenciesDbDependencyDir,
- leafPortDirPtr,
+ leafPortDir,
property->fieldAvailableDependenciesDbDependType,
exact );
@@ -113,7 +115,7 @@
{
portTypePtr = MGdbSeek( property->availableDependenciesDb,
property->fieldAvailableDependenciesDbDependencyDir,
- leafPortDirPtr,
+ leafPortDir,
property->fieldAvailableDependenciesDbDependType,
exact );
}
@@ -132,11 +134,11 @@
fprintf( stdout, "however, other ports may rely on these to build.\"\n" );
fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "%s dir -=> %s\n\n", leafPortNamePtr, leafPortDirPtr );
+ fprintf( stdout, "%s dir -=> %s\n\n", leafPortName, leafPortDir );
while( fflush( stdout ) );
strcpy( pkgDescFile, PORTSDIR );
- strcat( pkgDescFile, leafPortDirPtr );
+ strcat( pkgDescFile, leafPortDir );
strcat( pkgDescFile, "/pkg-descr" );
if( MGrIfFileExist( pkgDescFile ) )
@@ -150,7 +152,7 @@
{
strcpy( command, "grep COMMENT " );
strcat( command, PORTSDIR );
- strcat( command, leafPortDirPtr );
+ strcat( command, leafPortDir );
strcat( command, "/Makefile" );
system( command );
}
@@ -167,48 +169,48 @@
}
case KEY_SPACE:
{
- MGdbAdd( property->ignoreDb, leafPortDirPtr, "-slid <SPACE> skipped", NULL );
- fprintf( stdout, "<SPACE> Skipping %s\n\n", leafPortNamePtr );
+ MGdbAdd( property->ignoreDb, leafPortDir, "-slid <SPACE> skipped", NULL );
+ fprintf( stdout, "<SPACE> Skipping %s\n\n", leafPortName );
break;
}
case KEY_n:
{
/* nuke() */
- fprintf( stdout, "<n> Nuking %s\n\n", leafPortNamePtr );
- removePort( property, leafPortNamePtr, installedPortsDbIDX );
- nuke( leafPortDirPtr );
+ fprintf( stdout, "<n> Nuking %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
+ nuke( leafPortDir );
rebuildDb( property, &installedPortsDbQTY );
break;
}
case KEY_N:
{
/* nuke() */
- fprintf( stdout, "<N> Nuking %s\n\n", leafPortNamePtr );
- removePort( property, leafPortNamePtr, installedPortsDbIDX );
- nuke( leafPortDirPtr );
+ fprintf( stdout, "<N> Nuking %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
+ nuke( leafPortDir );
rebuildDb( property, &installedPortsDbQTY );
break;
}
case KEY_x:
{
/* delete() */
- fprintf( stdout, "<x> Removing %s\n\n", leafPortNamePtr );
- removePort( property, leafPortNamePtr, installedPortsDbIDX );
+ fprintf( stdout, "<x> Removing %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
rebuildDb( property, &installedPortsDbQTY );
break;
}
case KEY_X:
{
/* delete() */
- fprintf( stdout, "<X> Removing %s\n\n", leafPortNamePtr );
- removePort( property, leafPortNamePtr, installedPortsDbIDX );
+ fprintf( stdout, "<X> Removing %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
rebuildDb( property, &installedPortsDbQTY );
break;
}
default:
{
- MGdbAdd( property->ignoreDb, leafPortDirPtr, "-slid <DEFAULT> skipped", NULL );
- fprintf( stdout, "Skipping %s\n\n", leafPortNamePtr );
+ MGdbAdd( property->ignoreDb, leafPortDir, "-slid <DEFAULT> skipped", NULL );
+ fprintf( stdout, "Skipping %s\n\n", leafPortName );
break;
}
}
@@ -221,6 +223,9 @@
MGdbDestroy( property->ignoreDb );
MGdbDestroy( property->installedPortsDb );
free( command );
+ free( leafPortDir );
+ free( leafPortName );
+ free( pkgDescFile );
return(0);
}
@@ -266,7 +271,7 @@
}
/***********************************************************************/
-int nuke( char* leafPortDirPtr )
+int nuke( char* leafPortDir )
{
char* command = NULL;
@@ -274,7 +279,7 @@
strcpy( command, "cd " );
strcat( command, PORTSDIR );
- strcat( command, leafPortDirPtr );
+ strcat( command, leafPortDir );
strcat( command, "; make distclean" );
fprintf( stdout, "\nexecuting: %s\n", command );
while( fflush( stdout ) );
diff -ruN ../0.3.3_2/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c
--- ../0.3.3_2/libMGPM/src/MGPMrUpdate.c Wed Nov 9 13:24:45 2005
+++ ./libMGPM/src/MGPMrUpdate.c Wed Nov 9 21:54:00 2005
@@ -41,10 +41,15 @@
char* buffer;
char* command;
char* commandRestart;
+ char* installedPortName;
char* newPortDir;
char* newPortName;
char* optionsCheck;
char* optionsDir;
+ char* startPortCmd;
+ char* startPortDir;
+ char* stopPortCmd;
+ char* stopPortDir;
char* workDir;
} structLocalProperty;
@@ -58,6 +63,8 @@
char BROKEN[] = "BROKEN";
char FORBIDDEN[] = "FORBIDDEN";
char IGNORE[] = "IGNORE";
+ char START[] = "/START";
+ char STOP[] = "/STOP";
char backUp[] = "--back-up";
char bu[] = "-bu";
char exact[] = "exact";
@@ -71,11 +78,12 @@
char* availableDependenciesDbDependencyDirPtr = NULL;
char* availableDependenciesDbDependencyNamePtr = NULL;
char* bufferBase = NULL;
- char* installedPortsDbPortNamePtr = NULL;
char* ipPtr = NULL;
char* oldPortDirPtr = NULL;
char* options = NULL;
char* stinker = NULL;
+ char* startPortDirPtr = NULL;
+ char* stopPortDirPtr = NULL;
char* strikePtr = NULL;
int availableDependenciesDbIDX = 0;
int availableDependenciesDbQTY = 0;
@@ -99,12 +107,17 @@
localProperty.buffer = (char*)calloc( bufferSize, 1 );
localProperty.command = (char*)calloc( bufferSize, 1 );
localProperty.commandRestart = (char*)calloc( bufferSize, 1 );
+ localProperty.installedPortName = (char*)calloc( 511, 1 );
localProperty.newPortDir = (char*)calloc( 511, 1 );
localProperty.newPortName = (char*)calloc( 511, 1 );
localProperty.optionsCheck = (char*)calloc( 511, 1 );
localProperty.optionsDir = (char*)calloc( 511, 1 );
+ localProperty.startPortCmd = (char*)calloc( 511, 1 );
+ localProperty.startPortDir = (char*)calloc( 511, 1 );
+ localProperty.stopPortCmd = (char*)calloc( 511, 1 );
+ localProperty.stopPortDir = (char*)calloc( 511, 1 );
localProperty.workDir = (char*)calloc( 511, 1 );
-
+
property->availableDependenciesDb = MGdbOpen( property->availableDependenciesDbFileName );
property->availablePortsDb = MGdbOpen( property->availablePortsDbFileName );
property->commandLineDb = MGdbOpen( property->commandLineDbFileName );
@@ -179,6 +192,63 @@
strcpy( localProperty.beforeOptionsFileSize, MGrIntToString( MGrFileSize( localProperty.optionsDir ) ) );
/*
+ * gather stop/start instructions if they exist
+ */
+ MGdbGoTop( property->configDb );
+ while( MGdbSeek( property->configDb,
+ property->fieldConfigDbKey,
+ STOP,
+ property->fieldConfigDbKey,
+ exact )
+ &&
+ strncmp( oldPortDir,
+ MGdbGet( property->configDb,
+ MGdbGetRecno( property->configDb ) - 1,
+ property->fieldConfigDbValue ),
+ strlen( oldPortDir ) ) == 0 )
+ {
+ stopPortDirPtr = MGdbGet( property->configDb,
+ MGdbGetRecno( property->configDb ) - 1,
+ property->fieldConfigDbValue );
+ if( stopPortDirPtr[strlen( oldPortDir )] == SPACE )
+ {
+ strncpy( localProperty.stopPortDir, stopPortDirPtr, strlen( oldPortDir ) );
+ strcpy( localProperty.stopPortCmd, stopPortDirPtr + strlen( oldPortDir ) + 1 );
+ break;
+ }
+ else
+ {
+ break;
+ }
+ }
+ MGdbGoTop( property->configDb );
+ while( MGdbSeek( property->configDb,
+ property->fieldConfigDbKey,
+ START,
+ property->fieldConfigDbKey,
+ exact )
+ &&
+ strncmp( oldPortDir,
+ MGdbGet( property->configDb,
+ MGdbGetRecno( property->configDb ) - 1,
+ property->fieldConfigDbValue ),
+ strlen( oldPortDir ) ) == 0 )
+ {
+ startPortDirPtr = MGdbGet( property->configDb,
+ MGdbGetRecno( property->configDb ) - 1,
+ property->fieldConfigDbValue );
+ if( startPortDirPtr[strlen( oldPortDir )] == SPACE )
+ {
+ strncpy( localProperty.startPortDir, startPortDirPtr, strlen( oldPortDir ) );
+ strcpy( localProperty.startPortCmd, startPortDirPtr + strlen( oldPortDir ) + 1 );
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ /*
* Do update in interactive mode (command line switch -ui )
*/
if( property->interactive )
@@ -346,6 +416,16 @@
* options changed so need to purge oldPortDir's records
* from availablePortsDb and availableDependenciesDb
*/
+ if( property->log )
+ {
+ strcpy( localProperty.command, "echo \" options changed so returning " );
+ strcat( localProperty.command, oldPortName );
+ strcat( localProperty.command, " " );
+ strcat( localProperty.command, oldPortDir );
+ strcat( localProperty.command, " to out of date pool " );
+ strcat( localProperty.command, " \">> /var/log/portmanager.log" );
+ system( localProperty.command );
+ }
property->optionsChanged = 1;
MGdbGoTop( property->availablePortsDb );
while( MGdbSeek( property->availablePortsDb,
@@ -519,12 +599,13 @@
installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
while( installedPortsDbIDX < installedPortsDbQTY )
{
- installedPortsDbPortNamePtr = MGdbGet( property->installedPortsDb, installedPortsDbIDX,
- property->fieldInstalledPortsDbPortName );
- stinker = strstr( bufferBase, installedPortsDbPortNamePtr );
+ strcpy( localProperty.installedPortName, MGdbGet( property->installedPortsDb,
+ installedPortsDbIDX,
+ property->fieldInstalledPortsDbPortName ) );
+ stinker = strstr( bufferBase, localProperty.installedPortName );
if( stinker )
{
- fprintf( stdout, "OK to remove conflicting port %s Yy/Nn/Aa [Y]\? ", installedPortsDbPortNamePtr );
+ fprintf( stdout, "OK to remove conflicting port %s Yy/Nn/Aa [Y]\? ", localProperty.installedPortName );
while( fflush( stdout ) );
if( property->autoConflicts == 0 )
{
@@ -585,7 +666,7 @@
}
}
strcpy( localProperty.command, "pkg_delete -f " );
- strcat( localProperty.command, installedPortsDbPortNamePtr );
+ strcat( localProperty.command, localProperty.installedPortName );
fprintf( stdout, "executing: %s\n", localProperty.command );
while( fflush( stdout ) );
errorCode = system( localProperty.command );
@@ -918,6 +999,56 @@
}
else
{
+ /*
+ * use localProperty.stopPortCmd if it is defined
+ */
+ if( strcmp( oldPortDir, localProperty.stopPortDir ) == 0 )
+ {
+ fprintf( stdout, "%s %s info: running %s stop command %s\n",
+ id,
+ PACKAGE_VERSION,
+ localProperty.stopPortDir,
+ localProperty.stopPortCmd );
+ while( fflush( stdout ) );
+
+ localProperty.buffer[0] = 0;
+ pHandle = popen( localProperty.stopPortCmd, "r" );
+ fread( localProperty.buffer, bufferSize, 1, pHandle );
+ pclose( pHandle );
+/*
+ idx = 0;
+ while( idx < bufferSize )
+ {
+ if( localProperty.buffer[idx] == LINEFEED
+ ||
+ localProperty.buffer[idx] == TAB
+ ||
+ localProperty.buffer[idx] == SPACE )
+ {
+ localProperty.buffer[idx] = 0;
+ break;
+ }
+ idx++;
+ }
+*/
+ if( property->log )
+ {
+ strcpy( localProperty.command, "echo \" stopping " );
+ strcat( localProperty.command, oldPortName );
+ strcat( localProperty.command, " " );
+ strcat( localProperty.command, oldPortDir );
+ strcat( localProperty.command, " execution by running " );
+ strcat( localProperty.command, localProperty.stopPortCmd );
+ strcat( localProperty.command, " \">> /var/log/portmanager.log" );
+ system( localProperty.command );
+ }
+ fprintf( stdout, "%s reply: %s\n", localProperty.stopPortCmd, localProperty.buffer );
+ while( fflush( stdout ) );
+ }
+
+ /*
+ * remove old port
+ */
strcpy( localProperty.command, "pkg_delete -f ");
strcat( localProperty.command, oldPortName);
fprintf( stdout, "%s\n", SINGLE_LINES );
@@ -1041,6 +1172,54 @@
system( localProperty.command );
}
}
+
+ /*
+ * use localProperty.startPortCmd if it is defined
+ */
+ if( strcmp( oldPortDir, localProperty.startPortDir ) == 0 )
+ {
+ fprintf( stdout, "%s %s info: running %s start command %s\n",
+ id,
+ PACKAGE_VERSION,
+ localProperty.startPortDir,
+ localProperty.startPortCmd );
+ while( fflush( stdout ) );
+ localProperty.buffer[0] = 0;
+ pHandle = popen( localProperty.startPortCmd, "r" );
+ fread( localProperty.buffer, bufferSize, 1, pHandle );
+ pclose( pHandle );
+/*
+ idx = 0;
+ while( idx < bufferSize )
+ {
+ if( localProperty.buffer[idx] == LINEFEED
+ ||
+ localProperty.buffer[idx] == TAB
+ ||
+ localProperty.buffer[idx] == SPACE )
+ {
+ localProperty.buffer[idx] = 0;
+ break;
+ }
+ idx++;
+ }
+*/
+ if( property->log )
+ {
+ strcpy( localProperty.command, "echo \" starting " );
+ strcat( localProperty.command, oldPortName );
+ strcat( localProperty.command, " " );
+ strcat( localProperty.command, oldPortDir );
+ strcat( localProperty.command, " execution by running " );
+ strcat( localProperty.command, localProperty.startPortCmd );
+ strcat( localProperty.command, " \">> /var/log/portmanager.log" );
+ system( localProperty.command );
+ }
+
+ fprintf( stdout, "%s reply: %s\n", localProperty.startPortCmd, localProperty.buffer );
+ while( fflush( stdout ) );
+ }
+
/************************************************************************/
/* Command "13" make package */
/************************************************************************/
@@ -1229,10 +1408,15 @@
free( localProperty->buffer );
free( localProperty->command );
free( localProperty->commandRestart );
+ free( localProperty->installedPortName );
free( localProperty->newPortDir );
free( localProperty->newPortName );
free( localProperty->optionsCheck );
free( localProperty->optionsDir );
+ free( localProperty->startPortCmd );
+ free( localProperty->startPortDir );
+ free( localProperty->stopPortCmd );
+ free( localProperty->stopPortDir );
free( localProperty->workDir );
return(0);
diff -ruN ../0.3.3_2/portmanager/pm-020.conf.SAMPLE ./portmanager/pm-020.conf.SAMPLE
--- ../0.3.3_2/portmanager/pm-020.conf.SAMPLE Tue Nov 8 17:05:25 2005
+++ ./portmanager/pm-020.conf.SAMPLE Wed Nov 9 14:22:48 2005
@@ -1,42 +1,40 @@
-#............................................
-# port manager example configuration file ver 0.2.0
-#............................................................
-# the format of portmanager.conf is critical!
-#
-# 1. Comments delimited with # should be ok
-# 2. No leading white space( space or tabs )
-# 3. Placement of "|" is critical here is the format:
#
-# [port category dir/port dir] | [ all port build options go here ] |
+# port manager example configuration file ver 0.2.0
#
-# 4. white space between port options is ok, and between final "|" and
-# the start of a comment
+
+CATEGORY/PORT|OPTION=| # do not delete this line!
+
#
-# example:
-#............................................................
# port | options |
-#............................................................
-#x11-toolkits/vte|WITH_GLX=yes -DNOCLEAN| # some comment.......
-#java/jdk14|-DMINIMAL| # anothe comment....
-#............................................................
-CATEGORY/PORT|OPTION=| # do not delete this line!
+#
-#####################
-# custom settings #
-# remove "#" to use #
-#####################
#textproc/docproj|JADETEX=no|
#java/jdk14|-DMINIMAL|
#textproc/libxml2|THREADS=off SCHEMA=on MEM_DEBUG=off XMLLINT_HIST=off THREAD_ALLOC=off|
+
#
+# do not let portmanager update the following ports
#
-##
-##do not let portmanager update the following ports
+
#IGNORE|editors/openoffice-1.1|
#IGNORE|java/jdk14|
-
-
+#
+# STOP/START these programs if they are updated
+#
+# Stop command will be run after program is built, before
+# old installed version is removed
+#
+# Start command will be run after rebuilt program is
+# installed and successfully registerd
+#
+# note:
+# must have leading "/" in /{category}/{port dir}
+# anything after /{category}/{port dir} is run as
+# a sh shell command
+#
+#STOP|/mail/postfix /usr/local/sbin/postfix stop|
+#START|/mail/postfix /usr/local/sbin/postfix start|
diff -ruN ../0.3.3_2/portmanager/portmanager.1 ./portmanager/portmanager.1
--- ../0.3.3_2/portmanager/portmanager.1 Tue Nov 8 17:05:25 2005
+++ ./portmanager/portmanager.1 Wed Nov 9 18:49:17 2005
@@ -128,24 +128,6 @@
.sp
http://portmanager.sunsite.dk/
.sp
- \fBMail lists\fR
-.sp
-portmanager-questions@sunsite.dk
-.sp
-To subscribe send an empty message to:
- portmanager-questions-subscribe@sunsite.dk
-.sp
- archive: http://www.mail-archive.com/portmanager-questions%40sunsite.dk/
-.sp
-.sp
-If you would like to joint portmanager's development team let us know at:
-portmanager-devel@sunsite.dk
-.sp
-To subscribe send an empty message to:
- portmanager-devel-subscribe@sunsite.dk
-.sp
- archive: http://www.mail-archive.com/portmanager-devel%40sunsite.dk/
-.sp
.\"=======================================================================
.\".Sh IMPLEMENTATION NOTES
.\"=======================================================================
@@ -166,35 +148,44 @@
.sp
pm\&-020.conf example:
.sp
- # the format of pm\&-020.conf is critical
#
- # 1. Comments delimited with # should be ok
- # 2. No leading white space( space or tabs )
- # 3. Placement of \&"\&|\&" is critical here is the format:
- #
- # [port category dir/port dir] \&| [ all port build options go here ] \&|
- #
- # 4. white space between port options is ok, and between final \&"\&|\&" and
- # the start of a comment
- #
- # example:
- #............................................................
- # port \&| options \&|
- #............................................................
- #x11\&-toolkits/vte\&|WITH_GLX=yes \&-DNOCLEAN\&| # some comment.......
- #java/jdk14\&|\&-DMINIMAL\&| # another comment....
- #............................................................
- CATEGORY/PORT\&|OPTION=\&| # do not delete this line
- #
- devel/sdl12\&|WITH_NAS=yes\&|
- editors/openoffice\&-1.1\&|WITH_TTF_BYTECODE_ENABLED=yes\&|
- java/jdk14\&|WITH_IPV6=yes\&|
- multimedia/avifile\&|WITH_OPTIMIZED_CFLAGS=yes\&|
- local/sysutils/portmanager\&|PREFIX=/home/mike/TEMP\&|
- #
- #do not let portmanager update the following ports
- IGNORE\&|editors/openoffice\&-1.1\&|
- IGNORE\&|java/jdk14\&|
+ # port manager example configuration file ver 0.2.0
+ #
+.sp
+ CATEGORY/PORT\&|OPTION=\&| # do not delete this line!
+.sp
+ #
+ # port \&| options \&|
+ #
+.sp
+ #textproc/docproj\&|JADETEX=no\&|
+ #java/jdk14\&|-DMINIMAL\&|
+ #textproc/libxml2\&|THREADS=off SCHEMA=on MEM_DEBUG=off THREAD_ALLOC=off\&|
+.sp
+ #
+ # do not let portmanager update the following ports
+ #
+.sp
+ #IGNORE\&|editors/openoffice-1.1\&|
+ #IGNORE\&|java/jdk14\&|
+.sp
+ #
+ # STOP/START these programs if they are updated
+ #
+ # Stop command will be run after program is built, before
+ # old installed version is removed
+ #
+ # Start command will be run after rebuilt program is
+ # installed and successfully registerd
+ #
+ # note:
+ # must have leading \&"/\&" in /{category}/{port dir}
+ # anything after /{category}/{port dir} is run as
+ # a sh shell command
+ #
+ #STOP\&|/mail/postfix /usr/local/sbin/postfix stop\&|
+ #START\&|/mail/postfix /usr/local/sbin/postfix start\&|
+.sp
.\"=======================================================================
.Sh DIAGNOSTICS
Detail of how portmanager works
diff -ruN ../0.3.3_2/programmer-notes.txt ./programmer-notes.txt
--- ../0.3.3_2/programmer-notes.txt Wed Nov 9 13:24:45 2005
+++ ./programmer-notes.txt Wed Nov 9 22:32:39 2005
@@ -275,6 +275,15 @@
A) Creates database of Installed ports, checks/handles installed ports
that are no longerin the ports tree.
+=====================================
+
+Bring Joy <clarity256@yahoo.com>
+
+It actually is a good idea, but not so simple to implement. The ports system only
+knows what the current dist file so won't tell you if one is out of date, have to
+do some extra digging for that. Still an option to clean old distfiles and old
+packages as you go would be really nice so I will add your iidea to the long term
+goals list.
************** JAVA notes *******************