1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00

- Using bzip2 in pkg_create by default for a while now. Patch to

allow removing either .tgz or .tbz temporary pkgs.
- Refactor the existing patches so that we have one patch per file to ease
  maintenance.
- Pass maintainership to submitter.
- Bump PORTREVISION

PR:		ports/106652
Submitted by:	Robert C. Noland III <rnoland@2hip.net>
This commit is contained in:
Martin Wilke 2006-12-13 10:13:00 +00:00
parent 86bfbfa6c4
commit 007189ceb1
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=179642
36 changed files with 1510 additions and 1840 deletions

View File

@ -7,12 +7,12 @@
PORTNAME= portmanager
PORTVERSION= 0.4.1
PORTREVISION= 6
PORTREVISION= 7
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= portmanager
MAINTAINER= ports@FreeBSD.org
MAINTAINER= rnoland@2hip.net
COMMENT= FreeBSD installed ports status and safe update utility
MAN1= portmanager.1

View File

@ -1,703 +0,0 @@
diff -ruN ../0.4.1/libMG/src/MGdbAdd.c ./libMG/src/MGdbAdd.c
--- ../0.4.1/libMG/src/MGdbAdd.c Mon Dec 12 12:32:34 2005
+++ ./libMG/src/MGdbAdd.c Thu Dec 15 19:00:23 2005
@@ -39,7 +39,9 @@
int idx = 0;
va_list paramList;
- /* check if we have a valid object */
+ /*
+ * check if we have a valid object
+ */
if( db->parent.type != CLASS_TYPE_DB )
{
fprintf( stderr, "%s error: invalid object type\n", id);
@@ -71,6 +73,8 @@
*/
if( MGrBufferlen( paramPtr, MAXBUFFERSIZE ) < 1 )
{
+ fprintf( stderr, "%s error: attempt to place null data into record halted\n", id );
+ while( fflush( stderr ) );
assert(0);
}
fprintf( dbFileStream, "%s%c", paramPtr, 0 );
@@ -85,6 +89,7 @@
{
fprintf( stderr, "%s error: fields added (%d) exceed field quantity (%d)\n did you forget to terminate MGdbAdd with a NULL field?\n",
id, idx, db->fieldQty );
+ while( fflush( stderr ) );
assert(0);
}
}
diff -ruN ../0.4.1/libMG/src/MGdbRead.c ./libMG/src/MGdbRead.c
--- ../0.4.1/libMG/src/MGdbRead.c Mon Dec 12 12:32:34 2005
+++ ./libMG/src/MGdbRead.c Thu Dec 15 19:04:13 2005
@@ -58,6 +58,7 @@
fprintf( stderr, "%s error: unable to allocate %d bytes memory for db->dataBuffer\n",
id, dataBufferSize );
perror( "system message" );
+ while( fflush( stderr ) );
assert(0);
}
/*zzzzzzzzzzzzzz*/
@@ -70,6 +71,7 @@
{
fprintf( stderr, "%s error: reading file %s into db->dataBuffer\n", id, db->parent.path );
perror( "system message" ); \
+ while( fflush( stderr ) );
assert(0);
}
diff -ruN ../0.4.1/libMG/src/Makefile.am ./libMG/src/Makefile.am
--- ../0.4.1/libMG/src/Makefile.am Tue Dec 13 10:57:20 2005
+++ ./libMG/src/Makefile.am Sat Dec 17 08:03:02 2005
@@ -32,7 +32,7 @@
MGrStrlen.c \
MGxTermBarCreate.c \
MGxTermBarDestroy.c \
- MGxTermBarUpdate.c
+ MGxTermBarUpdate.c
include_HEADERS = libMG.h
diff -ruN ../0.4.1/libMG/src/libMG.h ./libMG/src/libMG.h
--- ../0.4.1/libMG/src/libMG.h Tue Dec 13 10:56:16 2005
+++ ./libMG/src/libMG.h Sat Dec 17 08:19:23 2005
@@ -57,6 +57,7 @@
#define KEY_a 97
#define CLASS_TYPE_DB 1
#define CLASS_TYPE_DIR 2
+#define CLASS_TYPE_MEM 3
#define CR 13
#define DEBUG_MGdb 0
#define DEBUG_MGdir 0
@@ -77,15 +78,15 @@
#define SINGLE_LINES "------------------------------------------------------------------------"
#define DOUBLE_LINES "========================================================================"
- char** MGm__command;
- int MGm__forkStatus;
- pid_t MGm__pid;
-struct stat fstatBuf;
-struct stat lstatBuf;
-typedef struct classDb classDb;
-typedef struct classDir classDir;
-unsigned int MGm__bufferSize;
-unsigned int MGm__stringSize;
+ char** MGm__command;
+ int MGm__forkStatus;
+ pid_t MGm__pid;
+ struct stat fstatBuf;
+ struct stat lstatBuf;
+ unsigned int MGm__bufferSize;
+ unsigned int MGm__stringSize;
+typedef struct classDb classDb;
+typedef struct classDir classDir;
#define MAXSTRINGSIZE 0x1ff
#define MAXBUFFERSIZE 0xffff
@@ -270,7 +271,7 @@
int MGrInStringSwap( char* originalString, char* oldString, char* newString );
int MGrStripComment( char*, char );
unsigned int MGrBufferlen( char* buffer, unsigned int maxBufferSize );
-unsigned int MGrStrlen( char* string );
+unsigned int MGrStrlen( char* String );
unsigned long int MGrFileTime( char* );
#endif
diff -ruN ../0.4.1/libMGPM/src/MGPMrPortBrokeCheck.c ./libMGPM/src/MGPMrPortBrokeCheck.c
--- ../0.4.1/libMGPM/src/MGPMrPortBrokeCheck.c Tue Dec 13 14:08:27 2005
+++ ./libMGPM/src/MGPMrPortBrokeCheck.c Sat Dec 17 07:20:37 2005
@@ -78,7 +78,7 @@
}
buffer[0] = 0;
fread( buffer, MAXBUFFERSIZE, 1, pHandle );
- if( ferror( pHandle ) == 0 && MGrStrlen( buffer ) > 1 )
+ if( ferror( pHandle ) == 0 && MGrBufferlen( buffer, MAXBUFFERSIZE ) > 1 )
{
fprintf( stdout, "%s %s error: %s %s marked %s, adding to ignore.db\n", id, PACKAGE_VERSION, oldPortName, oldPortDir, brokeCheckType );
while( fflush( stdout ) );
diff -ruN ../0.4.1/libMGPM/src/MGPMrShowLeavesDelete.c ./libMGPM/src/MGPMrShowLeavesDelete.c
--- ../0.4.1/libMGPM/src/MGPMrShowLeavesDelete.c Mon Dec 12 12:32:34 2005
+++ ./libMGPM/src/MGPMrShowLeavesDelete.c Sat Dec 17 08:54:02 2005
@@ -39,19 +39,21 @@
char exact[] = "exact";
char id[] = "MGPMrShowLeavesDelete";
char* command = NULL;
- char* leafPortDir = NULL;
+ char* leafPortDir;
char* leafPortName = NULL;
char* pkgDescFile = NULL;
+ char** cmd;
+ char** env;
int answer = 1;
- int bufferSize = 0xffff;
int doubleBreak = 0;
int installedPortsDbIDX = 0;
int installedPortsDbQTY = 0;
- command = calloc( bufferSize, 1 );
- leafPortDir = calloc( bufferSize, 1 );
- leafPortName = calloc( bufferSize, 1 );
- pkgDescFile = calloc( bufferSize, 1 );
+ leafPortDir = calloc( MAXSTRINGSIZE, 1 );
+ leafPortName = calloc( MAXSTRINGSIZE, 1 );
+
+ command = calloc( MAXBUFFERSIZE, 1 );
+ pkgDescFile = calloc( MAXBUFFERSIZE, 1 );
if( ( property->ignoreDb = MGdbOpen( property->ignoreDbFileName ) ) == NULL )
{
@@ -108,50 +110,94 @@
installedPortsDbIDX++;
continue;
}
-/*
- if( answer != KEY_ENTER )
+
+ cmd = malloc( sizeof( char* ) * 2 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = 0;
+
+ env = malloc( sizeof( char* ) * 2 );
+ env[0] = malloc( MAXSTRINGSIZE );
+ env[1] = 0;
+
+ MGmStrcpy( env[0], "TERM=" );
+ MGmStrcat( env[0], getenv( "TERM" ) );
+
+ MGmStrcpy( cmd[0], "/usr/bin/clear" );
+
+ MGmSystem( cmd, env );
+
+ free( env[0] );
+ free( env );
+
+ free( cmd[0] );
+ free( cmd );
+
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "*** for safety run portmanager -u after using this feature for deletion ***\n" );
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "Ports with no ports depending on them AKA \"leaf ports.\"\n" );
+ fprintf( stdout, "These ports may be deinstalled because no other ports rely on them to run;\"\n" );
+ if( property->buildDependsAreLeaves )
{
-*/
- system( "clear" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "*** for safety run portmanager -u after using this feature for deletion ***\n" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "Ports with no ports depending on them AKA \"leaf ports.\"\n" );
- fprintf( stdout, "These ports may be deinstalled because no other ports rely on them to run;\"\n" );
- if( property->buildDependsAreLeaves )
- {
- fprintf( stdout, "however, other ports may rely on these to build.\"\n" );
- }
- fprintf( stdout, "%s\n", SINGLE_LINES );
+ 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", leafPortName, leafPortDir );
- while( fflush( stdout ) );
+ fprintf( stdout, "%s dir -=> %s\n\n", leafPortName, leafPortDir );
+ while( fflush( stdout ) );
- MGmStrcpy( pkgDescFile, PORTSDIR );
- MGmStrcat( pkgDescFile, leafPortDir );
- MGmStrcat( pkgDescFile, "/pkg-descr" );
+ MGmStrcpy( pkgDescFile, PORTSDIR );
+ MGmStrcat( pkgDescFile, leafPortDir );
+ MGmStrcat( pkgDescFile, "/pkg-descr" );
- if( MGrIfFileExist( pkgDescFile ) )
- {
- MGmStrcpy( command, "cat " );
- MGmStrcat( command, pkgDescFile );
- system( command );
- fprintf( stdout, "\n" );
- }
- else
- {
- MGmStrcpy( command, "grep COMMENT " );
- MGmStrcat( command, PORTSDIR );
- MGmStrcat( command, leafPortDir );
- MGmStrcat( command, "/Makefile" );
- system( command );
- }
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "\n<ENTER> to skip\n<X><ENTER> removes port\n<N><ENTER> *Nuke it*, removes distribution files\n\n" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
-/*
+ if( MGrIfFileExist( pkgDescFile ) )
+ {
+ cmd = malloc( sizeof( char* ) * 3 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = 0;
+
+ MGmStrcpy( cmd[0], "/bin/cat" );
+ MGmStrcpy( cmd[1], pkgDescFile );
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[0] );
+ free( cmd[1] );
+ free( cmd );
+
+ fprintf( stdout, "\n" );
+ while( fflush( stdout ) );
+ }
+ else
+ {
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = malloc( MAXSTRINGSIZE );
+ cmd[3] = 0;
+
+ MGmStrcpy( cmd[0], "/usr/bin/grep" );
+ MGmStrcpy( cmd[1], "COMMENT" );
+ MGmStrcpy( cmd[2], PORTSDIR );
+ MGmStrcat( cmd[2], leafPortDir );
+ MGmStrcat( cmd[2], "/Makefile" );
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[0] );
+ free( cmd[1] );
+ free( cmd[2] );
+ free( cmd );
+
+ fprintf( stdout, "\n" );
+ while( fflush( stdout ) );
}
-*/
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "\n<ENTER> to skip\n<X><ENTER> removes port\n<N><ENTER> *Nuke it*, removes distribution files\n\n" );
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ while( fflush( stdout ) );
+
property->STDIN = fopen( "/dev/stdin", "r" ); /* Flawfinder: ignore */
doubleBreak = 0;
while( 1 == 1 )
@@ -243,9 +289,7 @@
{
char id[] = "removePort";
char exact[] = "exact";
- char* command = NULL;
-
- command = (char*)calloc( 0xffff, 1 );
+ char** cmd;
property->installedPortsDb = MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
@@ -261,12 +305,26 @@
MGdbGoTop( property->availableDependenciesDb );
}
- MGmStrcpy( command, "pkg_delete -f " );
- MGmStrcat( command, leafPortNamePtr );
- fprintf( stdout, "\nexecuting: %s\n", command );
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = malloc( MAXSTRINGSIZE );
+ cmd[3] = 0;
+
+ MGmStrcpy( cmd[0], "/usr/sbin/pkg_delete" );
+ MGmStrcpy( cmd[1], "-f" );
+ MGmStrcpy( cmd[2], leafPortNamePtr );
+
+ fprintf( stdout, "\nexecuting: %s %s %s\n", cmd[0], cmd[1], cmd[2] );
while( fflush( stdout ) );
- system( command );
- free(command);
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[2] );
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
return( 0 );
}
@@ -274,18 +332,35 @@
int nuke( char* leafPortDir )
{
char id[] = "nuke";
- char* command = NULL;
+ char** cmd;
- command = (char*)calloc( 0xffff, 1 );
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = 0;
+
+ MGmStrcpy( cmd[0], PORTSDIR );
+ MGmStrcat( cmd[0], leafPortDir );
+ if( chdir( cmd[0] ) != 0 )
+ {
+ fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
+ perror( "chroot" );
+ while( fflush( stderr ) );
+ assert( 0 );
+ }
- MGmStrcpy( command, "cd " );
- MGmStrcat( command, PORTSDIR );
- MGmStrcat( command, leafPortDir );
- MGmStrcat( command, "; make distclean" );
- fprintf( stdout, "\nexecuting: %s\n", command );
+ MGmStrcpy( cmd[0], "/usr/bin/make" );
+ MGmStrcpy( cmd[1], "distclean" );
+
+ fprintf( stdout, "\nexecuting: %s %s\n", cmd[0], cmd[1] );
while( fflush( stdout ) );
- system( command );
- free(command);
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
return( 0 );
}
diff -ruN ../0.4.1/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c
--- ../0.4.1/libMGPM/src/MGPMrUpdate.c Wed Dec 14 10:23:59 2005
+++ ./libMGPM/src/MGPMrUpdate.c Thu Dec 15 12:07:52 2005
@@ -60,6 +60,7 @@
char* stopPortDirPtr = NULL;
char* strikePtr = NULL;
char** cmd;
+ char** env;
int answer = 1;
int availableDependenciesDbIDX = 0;
int availableDependenciesDbQTY = 0;
@@ -74,12 +75,6 @@
property->optionsChanged = 0;
- localProperty.environment = malloc( sizeof( char** ) * 4 );
- localProperty.environment[0] = malloc( MAXSTRINGSIZE );
- localProperty.environment[1] = malloc( MAXSTRINGSIZE );
- localProperty.environment[2] = malloc( MAXSTRINGSIZE );
- localProperty.environment[3] = 0;
-
localProperty.CURDIR = calloc( MAXSTRINGSIZE, 1 );
localProperty.afterOptionsFileSize = calloc( MAXSTRINGSIZE, 1 );
localProperty.afterOptionsFileTime = calloc( MAXSTRINGSIZE, 1 );
@@ -122,30 +117,6 @@
return( 0 );
}
- /*
- * setup environment
- */
- MGmStrcpy( localProperty.environment[0], "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin" );
-
- if( getenv( "CCACHE_DIR" ) != NULL )
- {
- MGmStrcpy( localProperty.environment[1], "CCACHE_DIR=" );
- MGmStrcat( localProperty.environment[1], getenv( "CCACHE_DIR" ) );
- }
- else
- {
- localProperty.environment[1][0] = 0;
- }
-
- if( getenv( "CCACHE_PATH" ) != NULL )
- {
- MGmStrcpy( localProperty.environment[2], "CCACHE_PATH=/usr/bin:/usr/local/bin" );
- }
- else
- {
- localProperty.environment[2][0] = 0;
- }
-
/*
* test for bsd.ports.mk patch
*/
@@ -466,25 +437,53 @@
*/
/*
* If here we know OPTIONS is defined, need to run make config
- * if /var/db/ports/{package name}/options exists
+ * if /var/db/ports/{package name}/options does not exist
*/
if( MGrIfFileExist( localProperty.optionsDir ) == 0 )
{
- MGmStrcpy( localProperty.command, "cd " );
- MGmStrcat( localProperty.command, PORTSDIR );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " && make config " );
- if( MGrStrlen( localProperty.options ) > 0 )
+ cmd = malloc( sizeof( char* ) * 3 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = 0;
+
+ env = malloc( sizeof( char* ) * 2 );
+ env[0] = malloc( MAXSTRINGSIZE );
+ env[1] = 0;
+
+ MGmStrcpy( env[0], "TERM=" );
+ MGmStrcat( env[0], getenv( "TERM" ) );
+
+ MGmStrcpy( cmd[0], PORTSDIR );
+ MGmStrcat( cmd[0], oldPortDir );
+
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "config %s \n", cmd[0] );
+ while( fflush( stdout ) );
+
+ if( chdir( cmd[0] ) != 0 )
{
- MGmStrcat( localProperty.command, localProperty.options );
+ fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
+ perror( "chroot" );
+ while( fflush( stderr ) );
+ assert( 0 );
}
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "update %s \n", oldPortName );
- fprintf( stdout, "%s %s command: #2 of 14 %s\n", id, PACKAGE_VERSION, localProperty.command );
- fprintf( stdout, "%s\n", SINGLE_LINES );
+ MGmStrcpy( cmd[0], "/usr/bin/make" );
+ MGmStrcpy( cmd[1], "config" );
+ fprintf( stdout, "%s %s command: #2 of 14 %s %s\n", id, PACKAGE_VERSION, cmd[0], cmd[1] );
while( fflush( stdout ) );
- system(localProperty.command);
+
+ MGmSystem( cmd, env );
+
+ free( env[0] );
+ free( env );
+
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+
}
MGmStrcpy( localProperty.afterOptionsFileTime,
MGrIntToString( (int)MGrFileTime( localProperty.optionsDir ) ) );
@@ -567,17 +566,8 @@
MGmStrcpy( strike, strikePtr );
if( strike[0] == '2' )
{
+ MGPMlogAdd( property, oldPortName, oldPortDir, "make Strike 3, marking port as ignore/looping ", " ", " " );
MGdbAdd( property->ignoreDb, oldPortDir, "looping, 3rd attempt at make", NULL );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \"make Strike 3 " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " marking port as ignore/looping " );
- MGmStrcat( localProperty.command, " \">> /var/log/portmanager.log" );
- system( localProperty.command );
- }
rCleanUp( property, &localProperty );
return( 0 );
}
@@ -593,16 +583,8 @@
property->fieldStrikesIDX,
exact );
property->strikesDb = MGdbDelete( property->strikesDb, MGdbGetRecno( property->strikesDb ) - 1 );
+ MGPMlogAdd( property, oldPortName, oldPortDir, "make Strike 2", " ", " " );
MGdbAdd( property->strikesDb, oldPortDir, "2", NULL );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \"make Strike 2 " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " \">> /var/log/portmanager.log" );
- system( localProperty.command );
- }
/*
* dualOriginCheck( property, oldPortName ); used to be here in old portmanager ver < 0.3.1, seems to be no longer
* needed, keep this note just in case
@@ -797,20 +779,28 @@
MGPMlogAdd( property, "conflicting installed ", localProperty.installedPortName,
" removed from system: conflicted with ", oldPortName, " " );
}
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = malloc( MAXSTRINGSIZE );
+ cmd[3] = 0;
+
+ MGmStrcpy( cmd[0], "/usr/sbin/pkg_delete" );
+ MGmStrcpy( cmd[1], "-f" );
+ MGmStrcpy( cmd[2], localProperty.installedPortName );
- MGmStrcpy( localProperty.command, "pkg_delete -f " );
- MGmStrcat( localProperty.command, localProperty.installedPortName );
- fprintf( stdout, "executing: %s\n", localProperty.command );
+ fprintf( stdout, "\nexecuting: %s %s %s\n", cmd[0], cmd[1], cmd[2] );
while( fflush( stdout ) );
- errorCode = system( localProperty.command );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \"removed conflicting port " );
- MGmStrcat( localProperty.command, localProperty.installedPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, " \">> /var/log/portmanager.log" );
- system( localProperty.command );
- }
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[2] );
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
+ MGPMlogAdd( property, "removed conflicting port", localProperty.installedPortName,
+ " ", " ", " " );
}
installedPortsDbIDX++;
}
@@ -848,15 +838,7 @@
fprintf( stderr, "marking %s as ignored\n", oldPortName );
fprintf( stdout, "%s\n", DOUBLE_LINES );
while( fflush( stderr ) );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \" " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " conflicts with another installed port so marked ignore\" >> /var/log/portmanager.log" );
- system( localProperty.command );
- }
+ MGPMlogAdd( property, oldPortName, oldPortDir, "conflicts with another installed port so marked ignore", " ", " " );
MGdbAdd( property->ignoreDb, oldPortDir, "conflicts with another installed port", NULL );
rCleanUp( property, &localProperty );
return( 0 );
@@ -986,15 +968,7 @@
while( fflush( stdout ) );
if( ( errorCode = system(localProperty.command) ) )
{
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \" " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " failed to fetch\" >> /var/log/portmanager.log" );
- system( localProperty.command );
- }
+ MGPMlogAdd( property, oldPortName, oldPortDir, "failed to fetch, adding to ignore.db", " ", " " );
fprintf( stdout, "%s %s error: make fetch returned an error, adding %s to ignore.db\n", id, PACKAGE_VERSION, oldPortDir );
while( fflush( stdout ) );
MGdbAdd( property->ignoreDb, oldPortDir, "failed during make fetch", NULL );
@@ -1005,6 +979,36 @@
/************************************************************************/
/* Command "9" " make" */
/************************************************************************/
+ env = malloc( sizeof( char** ) * 4 );
+ env[0] = malloc( MAXSTRINGSIZE );
+ env[1] = malloc( MAXSTRINGSIZE );
+ env[2] = malloc( MAXSTRINGSIZE );
+ env[3] = 0;
+
+ /*
+ * setup environment
+ */
+ MGmStrcpy( env[0], "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin" );
+
+ if( getenv( "CCACHE_DIR" ) != NULL )
+ {
+ MGmStrcpy( env[1], "CCACHE_DIR=" );
+ MGmStrcat( env[1], getenv( "CCACHE_DIR" ) );
+ }
+ else
+ {
+ env[1][0] = 0;
+ }
+
+ if( getenv( "CCACHE_PATH" ) != NULL )
+ {
+ MGmStrcpy( env[2], "CCACHE_PATH=/usr/bin:/usr/local/bin" );
+ }
+ else
+ {
+ env[2][0] = 0;
+ }
+
if( MGrStrlen( localProperty.options ) > 0 )
{
cmd = malloc( sizeof( char** ) * 3 );
@@ -1027,7 +1031,7 @@
fprintf( stdout, "%s %s command: #9 of 14 %s\nOPTIONS-=>%s\n", id, PACKAGE_VERSION, cmd[0], cmd[1] );
fprintf( stdout, "%s\n", SINGLE_LINES );
while( fflush( stdout ) );
- MGmSystem( cmd, localProperty.environment );
+ MGmSystem( cmd, env );
free( cmd[0] );
free( cmd[1] );
free( cmd );
@@ -1052,7 +1056,7 @@
fprintf( stdout, "%s %s command: #9 of 14 %s\n", id, PACKAGE_VERSION, cmd[0] );
fprintf( stdout, "%s\n", SINGLE_LINES );
while( fflush( stdout ) );
- MGmSystem( cmd, localProperty.environment );
+ MGmSystem( cmd, env );
free( cmd[0] );
free( cmd );
}
@@ -1066,9 +1070,18 @@
MGPMlogAdd( property, oldPortName, oldPortDir, "port failed to build during make, adding to ignore.db", " ", " " );
MGdbAdd( property->ignoreDb, oldPortDir, "port failed to build during make\n", NULL );
rCleanUp( property, &localProperty );
+ free( env[0] );
+ free( env[1] );
+ free( env[2] );
+ free( env );
return(0);
}
+ free( env[0] );
+ free( env[1] );
+ free( env[2] );
+ free( env );
+
/************************************************************************/
/* Command "10" pkg_create -b */
/************************************************************************/
@@ -1555,12 +1568,6 @@
MGdbDestroy( property->ignoreDb );
MGdbDestroy( property->installedPortsDb );
MGdbDestroy( property->strikesDb );
-
-
- free( localProperty->environment[0] );
- free( localProperty->environment[1] );
- free( localProperty->environment[2] );
- free( localProperty->environment );
free( localProperty->CURDIR );
free( localProperty->afterOptionsFileSize );
diff -ruN ../0.4.1/libMGPM/src/libMGPM.h ./libMGPM/src/libMGPM.h
--- ../0.4.1/libMGPM/src/libMGPM.h Tue Dec 13 14:23:14 2005
+++ ./libMGPM/src/libMGPM.h Thu Dec 15 07:42:29 2005
@@ -118,7 +118,6 @@
char* workDir;
char* workFullPath;
char* xtermTitle;
- char** environment;
int bufferSize;
int optionsBufferSize;
} structLocalProperty;

View File

@ -1,52 +0,0 @@
diff -ruN ../0.4.1_1/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c
--- ../0.4.1_1/libMGPM/src/MGPMrUpdate.c Sat Dec 17 20:06:52 2005
+++ ./libMGPM/src/MGPMrUpdate.c Sun Dec 18 18:06:47 2005
@@ -983,30 +983,34 @@
env[0] = malloc( MAXSTRINGSIZE );
env[1] = malloc( MAXSTRINGSIZE );
env[2] = malloc( MAXSTRINGSIZE );
- env[3] = 0;
+ env[3] = malloc( MAXSTRINGSIZE );
+ env[4] = 0;
/*
* setup environment
*/
MGmStrcpy( env[0], "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin" );
+ MGmStrcpy( env[1], "TERM=" );
+ MGmStrcat( env[1], getenv( "TERM" ) );
+
if( getenv( "CCACHE_DIR" ) != NULL )
{
- MGmStrcpy( env[1], "CCACHE_DIR=" );
- MGmStrcat( env[1], getenv( "CCACHE_DIR" ) );
+ MGmStrcpy( env[2], "CCACHE_DIR=" );
+ MGmStrcat( env[2], getenv( "CCACHE_DIR" ) );
}
else
{
- env[1][0] = 0;
+ env[2][0] = 0;
}
if( getenv( "CCACHE_PATH" ) != NULL )
{
- MGmStrcpy( env[2], "CCACHE_PATH=/usr/bin:/usr/local/bin" );
+ MGmStrcpy( env[3], "CCACHE_PATH=/usr/bin:/usr/local/bin" );
}
else
{
- env[2][0] = 0;
+ env[3][0] = 0;
}
if( MGrStrlen( localProperty.options ) > 0 )
@@ -1080,6 +1084,7 @@
free( env[0] );
free( env[1] );
free( env[2] );
+ free( env[3] );
free( env );
/************************************************************************/

View File

@ -1,133 +0,0 @@
diff -ruN ../0.4.1_2/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c
--- ../0.4.1_2/libMGPM/src/MGPMrUpdate.c Mon Dec 19 11:45:50 2005
+++ ./libMGPM/src/MGPMrUpdate.c Wed Dec 21 22:16:31 2005
@@ -979,114 +979,29 @@
/************************************************************************/
/* Command "9" " make" */
/************************************************************************/
- env = malloc( sizeof( char** ) * 4 );
- env[0] = malloc( MAXSTRINGSIZE );
- env[1] = malloc( MAXSTRINGSIZE );
- env[2] = malloc( MAXSTRINGSIZE );
- env[3] = malloc( MAXSTRINGSIZE );
- env[4] = 0;
-
- /*
- * setup environment
- */
- MGmStrcpy( env[0], "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin" );
-
- MGmStrcpy( env[1], "TERM=" );
- MGmStrcat( env[1], getenv( "TERM" ) );
-
- if( getenv( "CCACHE_DIR" ) != NULL )
- {
- MGmStrcpy( env[2], "CCACHE_DIR=" );
- MGmStrcat( env[2], getenv( "CCACHE_DIR" ) );
- }
- else
- {
- env[2][0] = 0;
- }
-
- if( getenv( "CCACHE_PATH" ) != NULL )
- {
- MGmStrcpy( env[3], "CCACHE_PATH=/usr/bin:/usr/local/bin" );
- }
- else
- {
- env[3][0] = 0;
- }
-
+ MGmStrcpy( localProperty.command, "cd " );
+ MGmStrcat( localProperty.command, PORTSDIR );
+ MGmStrcat( localProperty.command, oldPortDir );
+ MGmStrcat( localProperty.command, " && make " );
if( MGrStrlen( localProperty.options ) > 0 )
{
- cmd = malloc( sizeof( char** ) * 3 );
- cmd[0] = malloc( MAXSTRINGSIZE );
- cmd[1] = malloc( MAXBUFFERSIZE );
- cmd[2] = 0;
- MGmStrcpy( cmd[0], PORTSDIR );
- MGmStrcat( cmd[0], oldPortDir );
- if( chdir( cmd[0] ) != 0 )
- {
- fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
- perror( "chroot" );
- while( fflush( stderr ) );
- assert( 0 );
- }
- MGmStrcpy( cmd[0], "/usr/bin/make" );
- MGmBuffercpy( cmd[1], localProperty.options, MAXBUFFERSIZE );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "update %s \n", oldPortName );
- fprintf( stdout, "%s %s command: #9 of 14 %s\nOPTIONS-=>%s\n", id, PACKAGE_VERSION, cmd[0], cmd[1] );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- while( fflush( stdout ) );
- MGmSystem( cmd, env );
- free( cmd[0] );
- free( cmd[1] );
- free( cmd );
- }
- else
- {
- cmd = malloc( sizeof( char** ) * 2 );
- cmd[0] = malloc( MAXSTRINGSIZE );
- cmd[1] = 0;
- MGmStrcpy( cmd[0], PORTSDIR );
- MGmStrcat( cmd[0], oldPortDir );
- if( chdir( cmd[0] ) != 0 )
- {
- fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
- perror( "chroot" );
- while( fflush( stderr ) );
- assert( 0 );
- }
- MGmStrcpy( cmd[0], "/usr/bin/make" );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "update %s \n", oldPortName );
- fprintf( stdout, "%s %s command: #9 of 14 %s\n", id, PACKAGE_VERSION, cmd[0] );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- while( fflush( stdout ) );
- MGmSystem( cmd, env );
- free( cmd[0] );
- free( cmd );
+ MGmStrcat( localProperty.command, localProperty.options );
}
- if( MGrIfDirEntry( localProperty.workFullPath, ".build_done" ) == 0 )
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "update %s \n", oldPortName );
+ fprintf( stdout, "%s %s command: #9 of 14 %s\n", id, PACKAGE_VERSION, localProperty.command );
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+ while( fflush( stdout ) );
+ if( ( errorCode = system(localProperty.command) ) )
{
- fprintf( stderr, "%s\n", SINGLE_LINES );
- fprintf( stderr, "%s error: %s %s failed during make, adding to ignore.db\n", id, oldPortName, oldPortDir );
- fprintf( stderr, "%s\n", SINGLE_LINES );
- while( fflush( stderr ) );
- MGPMlogAdd( property, oldPortName, oldPortDir, "port failed to build during make, adding to ignore.db", " ", " " );
- MGdbAdd( property->ignoreDb, oldPortDir, "port failed to build during make\n", NULL );
+ MGPMlogAdd( property, oldPortName, oldPortDir, "failed during make, adding to ignore.db", " ", " " );
+ fprintf( stdout, "%s %s error: make returned an error, adding %s to ignore.db\n", id, PACKAGE_VERSION, oldPortDir );
+ while( fflush( stdout ) );
+ MGdbAdd( property->ignoreDb, oldPortDir, "failed during make", NULL );
rCleanUp( property, &localProperty );
- free( env[0] );
- free( env[1] );
- free( env[2] );
- free( env );
return(0);
}
-
- free( env[0] );
- free( env[1] );
- free( env[2] );
- free( env[3] );
- free( env );
-
/************************************************************************/
/* Command "10" pkg_create -b */
/************************************************************************/

View File

@ -1,24 +0,0 @@
diff -ruN ../0.4.1_3/libMGPM/src/MGPMrInitialize.c ./libMGPM/src/MGPMrInitialize.c
--- ../0.4.1_3/libMGPM/src/MGPMrInitialize.c Thu Dec 22 06:42:13 2005
+++ ./libMGPM/src/MGPMrInitialize.c Mon Dec 26 20:00:02 2005
@@ -47,7 +47,7 @@
*/
property->configConfFileName = calloc( stringSize + 1, 1 );
MGmStrcpy(property->configConfFileName, ETCDIR);
- MGmStrcat(property->configConfFileName, "/portmanager/" );
+ MGmStrcat(property->configConfFileName, "/portmanager" );
MGmStrcat(property->configConfFileName, CONFIGURE_CONF);
/*
diff -ruN ../0.4.1_3/libMGPM/src/MGPMrReadConfigure.c ./libMGPM/src/MGPMrReadConfigure.c
--- ../0.4.1_3/libMGPM/src/MGPMrReadConfigure.c Thu Dec 22 06:42:13 2005
+++ ./libMGPM/src/MGPMrReadConfigure.c Mon Dec 26 20:05:15 2005
@@ -156,7 +156,7 @@
MGmStrcpy( cmd[0], "/bin/cp" );
MGmStrcpy( cmd[1], property->configConfFileName );
- MGmStrcat( cmd[1], ".SAMPLE " );
+ MGmStrcat( cmd[1], ".SAMPLE" );
MGmStrcpy( cmd[2], property->configConfFileName );
MGmSystem( cmd, NULL );

View File

@ -1,5 +1,5 @@
--- libMGPM/src/MGPMrGetPortName.c.orig Thu Feb 23 03:04:28 2006
+++ libMGPM/src/MGPMrGetPortName.c Thu Feb 23 03:06:22 2006
--- ./libMGPM/src/MGPMrGetPortName.c.orig Wed Dec 14 10:27:41 2005
+++ ./libMGPM/src/MGPMrGetPortName.c Fri Dec 8 17:13:00 2006
@@ -180,7 +180,8 @@
}
else

View File

@ -0,0 +1,11 @@
--- ./libMGPM/src/MGPMrInitialize.c.orig Mon Dec 12 15:32:34 2005
+++ ./libMGPM/src/MGPMrInitialize.c Fri Dec 8 17:13:00 2006
@@ -47,7 +47,7 @@
*/
property->configConfFileName = calloc( stringSize + 1, 1 );
MGmStrcpy(property->configConfFileName, ETCDIR);
- MGmStrcat(property->configConfFileName, "/portmanager/" );
+ MGmStrcat(property->configConfFileName, "/portmanager" );
MGmStrcat(property->configConfFileName, CONFIGURE_CONF);
/*

View File

@ -0,0 +1,11 @@
--- ./libMGPM/src/MGPMrPortBrokeCheck.c.orig Tue Dec 13 17:08:27 2005
+++ ./libMGPM/src/MGPMrPortBrokeCheck.c Fri Dec 8 17:13:00 2006
@@ -78,7 +78,7 @@
}
buffer[0] = 0;
fread( buffer, MAXBUFFERSIZE, 1, pHandle );
- if( ferror( pHandle ) == 0 && MGrStrlen( buffer ) > 1 )
+ if( ferror( pHandle ) == 0 && MGrBufferlen( buffer, MAXBUFFERSIZE ) > 1 )
{
fprintf( stdout, "%s %s error: %s %s marked %s, adding to ignore.db\n", id, PACKAGE_VERSION, oldPortName, oldPortDir, brokeCheckType );
while( fflush( stdout ) );

View File

@ -0,0 +1,11 @@
--- ./libMGPM/src/MGPMrReadConfigure.c.orig Wed Dec 14 00:12:40 2005
+++ ./libMGPM/src/MGPMrReadConfigure.c Fri Dec 8 17:13:00 2006
@@ -156,7 +156,7 @@
MGmStrcpy( cmd[0], "/bin/cp" );
MGmStrcpy( cmd[1], property->configConfFileName );
- MGmStrcat( cmd[1], ".SAMPLE " );
+ MGmStrcat( cmd[1], ".SAMPLE" );
MGmStrcpy( cmd[2], property->configConfFileName );
MGmSystem( cmd, NULL );

View File

@ -0,0 +1,252 @@
--- ./libMGPM/src/MGPMrShowLeavesDelete.c.orig Mon Dec 12 15:32:34 2005
+++ ./libMGPM/src/MGPMrShowLeavesDelete.c Fri Dec 8 17:13:00 2006
@@ -39,19 +39,21 @@
char exact[] = "exact";
char id[] = "MGPMrShowLeavesDelete";
char* command = NULL;
- char* leafPortDir = NULL;
+ char* leafPortDir;
char* leafPortName = NULL;
char* pkgDescFile = NULL;
+ char** cmd;
+ char** env;
int answer = 1;
- int bufferSize = 0xffff;
int doubleBreak = 0;
int installedPortsDbIDX = 0;
int installedPortsDbQTY = 0;
- command = calloc( bufferSize, 1 );
- leafPortDir = calloc( bufferSize, 1 );
- leafPortName = calloc( bufferSize, 1 );
- pkgDescFile = calloc( bufferSize, 1 );
+ leafPortDir = calloc( MAXSTRINGSIZE, 1 );
+ leafPortName = calloc( MAXSTRINGSIZE, 1 );
+
+ command = calloc( MAXBUFFERSIZE, 1 );
+ pkgDescFile = calloc( MAXBUFFERSIZE, 1 );
if( ( property->ignoreDb = MGdbOpen( property->ignoreDbFileName ) ) == NULL )
{
@@ -108,50 +110,94 @@
installedPortsDbIDX++;
continue;
}
-/*
- if( answer != KEY_ENTER )
+
+ cmd = malloc( sizeof( char* ) * 2 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = 0;
+
+ env = malloc( sizeof( char* ) * 2 );
+ env[0] = malloc( MAXSTRINGSIZE );
+ env[1] = 0;
+
+ MGmStrcpy( env[0], "TERM=" );
+ MGmStrcat( env[0], getenv( "TERM" ) );
+
+ MGmStrcpy( cmd[0], "/usr/bin/clear" );
+
+ MGmSystem( cmd, env );
+
+ free( env[0] );
+ free( env );
+
+ free( cmd[0] );
+ free( cmd );
+
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "*** for safety run portmanager -u after using this feature for deletion ***\n" );
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "Ports with no ports depending on them AKA \"leaf ports.\"\n" );
+ fprintf( stdout, "These ports may be deinstalled because no other ports rely on them to run;\"\n" );
+ if( property->buildDependsAreLeaves )
{
-*/
- system( "clear" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "*** for safety run portmanager -u after using this feature for deletion ***\n" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "Ports with no ports depending on them AKA \"leaf ports.\"\n" );
- fprintf( stdout, "These ports may be deinstalled because no other ports rely on them to run;\"\n" );
- if( property->buildDependsAreLeaves )
- {
- fprintf( stdout, "however, other ports may rely on these to build.\"\n" );
- }
- fprintf( stdout, "%s\n", SINGLE_LINES );
+ 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", leafPortName, leafPortDir );
- while( fflush( stdout ) );
+ fprintf( stdout, "%s dir -=> %s\n\n", leafPortName, leafPortDir );
+ while( fflush( stdout ) );
- MGmStrcpy( pkgDescFile, PORTSDIR );
- MGmStrcat( pkgDescFile, leafPortDir );
- MGmStrcat( pkgDescFile, "/pkg-descr" );
+ MGmStrcpy( pkgDescFile, PORTSDIR );
+ MGmStrcat( pkgDescFile, leafPortDir );
+ MGmStrcat( pkgDescFile, "/pkg-descr" );
- if( MGrIfFileExist( pkgDescFile ) )
- {
- MGmStrcpy( command, "cat " );
- MGmStrcat( command, pkgDescFile );
- system( command );
- fprintf( stdout, "\n" );
- }
- else
- {
- MGmStrcpy( command, "grep COMMENT " );
- MGmStrcat( command, PORTSDIR );
- MGmStrcat( command, leafPortDir );
- MGmStrcat( command, "/Makefile" );
- system( command );
- }
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "\n<ENTER> to skip\n<X><ENTER> removes port\n<N><ENTER> *Nuke it*, removes distribution files\n\n" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
-/*
+ if( MGrIfFileExist( pkgDescFile ) )
+ {
+ cmd = malloc( sizeof( char* ) * 3 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = 0;
+
+ MGmStrcpy( cmd[0], "/bin/cat" );
+ MGmStrcpy( cmd[1], pkgDescFile );
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[0] );
+ free( cmd[1] );
+ free( cmd );
+
+ fprintf( stdout, "\n" );
+ while( fflush( stdout ) );
+ }
+ else
+ {
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = malloc( MAXSTRINGSIZE );
+ cmd[3] = 0;
+
+ MGmStrcpy( cmd[0], "/usr/bin/grep" );
+ MGmStrcpy( cmd[1], "COMMENT" );
+ MGmStrcpy( cmd[2], PORTSDIR );
+ MGmStrcat( cmd[2], leafPortDir );
+ MGmStrcat( cmd[2], "/Makefile" );
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[0] );
+ free( cmd[1] );
+ free( cmd[2] );
+ free( cmd );
+
+ fprintf( stdout, "\n" );
+ while( fflush( stdout ) );
}
-*/
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "\n<ENTER> to skip\n<X><ENTER> removes port\n<N><ENTER> *Nuke it*, removes distribution files\n\n" );
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ while( fflush( stdout ) );
+
property->STDIN = fopen( "/dev/stdin", "r" ); /* Flawfinder: ignore */
doubleBreak = 0;
while( 1 == 1 )
@@ -243,9 +289,7 @@
{
char id[] = "removePort";
char exact[] = "exact";
- char* command = NULL;
-
- command = (char*)calloc( 0xffff, 1 );
+ char** cmd;
property->installedPortsDb = MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
@@ -261,12 +305,26 @@
MGdbGoTop( property->availableDependenciesDb );
}
- MGmStrcpy( command, "pkg_delete -f " );
- MGmStrcat( command, leafPortNamePtr );
- fprintf( stdout, "\nexecuting: %s\n", command );
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = malloc( MAXSTRINGSIZE );
+ cmd[3] = 0;
+
+ MGmStrcpy( cmd[0], "/usr/sbin/pkg_delete" );
+ MGmStrcpy( cmd[1], "-f" );
+ MGmStrcpy( cmd[2], leafPortNamePtr );
+
+ fprintf( stdout, "\nexecuting: %s %s %s\n", cmd[0], cmd[1], cmd[2] );
while( fflush( stdout ) );
- system( command );
- free(command);
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[2] );
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
return( 0 );
}
@@ -274,18 +332,35 @@
int nuke( char* leafPortDir )
{
char id[] = "nuke";
- char* command = NULL;
+ char** cmd;
- command = (char*)calloc( 0xffff, 1 );
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = 0;
+
+ MGmStrcpy( cmd[0], PORTSDIR );
+ MGmStrcat( cmd[0], leafPortDir );
+ if( chdir( cmd[0] ) != 0 )
+ {
+ fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
+ perror( "chroot" );
+ while( fflush( stderr ) );
+ assert( 0 );
+ }
- MGmStrcpy( command, "cd " );
- MGmStrcat( command, PORTSDIR );
- MGmStrcat( command, leafPortDir );
- MGmStrcat( command, "; make distclean" );
- fprintf( stdout, "\nexecuting: %s\n", command );
+ MGmStrcpy( cmd[0], "/usr/bin/make" );
+ MGmStrcpy( cmd[1], "distclean" );
+
+ fprintf( stdout, "\nexecuting: %s %s\n", cmd[0], cmd[1] );
while( fflush( stdout ) );
- system( command );
- free(command);
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
return( 0 );
}

View File

@ -0,0 +1,349 @@
--- libMGPM/src/MGPMrUpdate.c.orig Wed Dec 14 13:23:59 2005
+++ libMGPM/src/MGPMrUpdate.c Fri Dec 8 17:24:30 2006
@@ -60,6 +60,7 @@
char* stopPortDirPtr = NULL;
char* strikePtr = NULL;
char** cmd;
+ char** env;
int answer = 1;
int availableDependenciesDbIDX = 0;
int availableDependenciesDbQTY = 0;
@@ -74,12 +75,6 @@
property->optionsChanged = 0;
- localProperty.environment = malloc( sizeof( char** ) * 4 );
- localProperty.environment[0] = malloc( MAXSTRINGSIZE );
- localProperty.environment[1] = malloc( MAXSTRINGSIZE );
- localProperty.environment[2] = malloc( MAXSTRINGSIZE );
- localProperty.environment[3] = 0;
-
localProperty.CURDIR = calloc( MAXSTRINGSIZE, 1 );
localProperty.afterOptionsFileSize = calloc( MAXSTRINGSIZE, 1 );
localProperty.afterOptionsFileTime = calloc( MAXSTRINGSIZE, 1 );
@@ -122,30 +117,6 @@
return( 0 );
}
- /*
- * setup environment
- */
- MGmStrcpy( localProperty.environment[0], "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin" );
-
- if( getenv( "CCACHE_DIR" ) != NULL )
- {
- MGmStrcpy( localProperty.environment[1], "CCACHE_DIR=" );
- MGmStrcat( localProperty.environment[1], getenv( "CCACHE_DIR" ) );
- }
- else
- {
- localProperty.environment[1][0] = 0;
- }
-
- if( getenv( "CCACHE_PATH" ) != NULL )
- {
- MGmStrcpy( localProperty.environment[2], "CCACHE_PATH=/usr/bin:/usr/local/bin" );
- }
- else
- {
- localProperty.environment[2][0] = 0;
- }
-
/*
* test for bsd.ports.mk patch
*/
@@ -466,25 +437,53 @@
*/
/*
* If here we know OPTIONS is defined, need to run make config
- * if /var/db/ports/{package name}/options exists
+ * if /var/db/ports/{package name}/options does not exist
*/
if( MGrIfFileExist( localProperty.optionsDir ) == 0 )
{
- MGmStrcpy( localProperty.command, "cd " );
- MGmStrcat( localProperty.command, PORTSDIR );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " && make config " );
- if( MGrStrlen( localProperty.options ) > 0 )
+ cmd = malloc( sizeof( char* ) * 3 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = 0;
+
+ env = malloc( sizeof( char* ) * 2 );
+ env[0] = malloc( MAXSTRINGSIZE );
+ env[1] = 0;
+
+ MGmStrcpy( env[0], "TERM=" );
+ MGmStrcat( env[0], getenv( "TERM" ) );
+
+ MGmStrcpy( cmd[0], PORTSDIR );
+ MGmStrcat( cmd[0], oldPortDir );
+
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "config %s \n", cmd[0] );
+ while( fflush( stdout ) );
+
+ if( chdir( cmd[0] ) != 0 )
{
- MGmStrcat( localProperty.command, localProperty.options );
+ fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
+ perror( "chroot" );
+ while( fflush( stderr ) );
+ assert( 0 );
}
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "update %s \n", oldPortName );
- fprintf( stdout, "%s %s command: #2 of 14 %s\n", id, PACKAGE_VERSION, localProperty.command );
- fprintf( stdout, "%s\n", SINGLE_LINES );
+ MGmStrcpy( cmd[0], "/usr/bin/make" );
+ MGmStrcpy( cmd[1], "config" );
+ fprintf( stdout, "%s %s command: #2 of 14 %s %s\n", id, PACKAGE_VERSION, cmd[0], cmd[1] );
while( fflush( stdout ) );
- system(localProperty.command);
+
+ MGmSystem( cmd, env );
+
+ free( env[0] );
+ free( env );
+
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+
}
MGmStrcpy( localProperty.afterOptionsFileTime,
MGrIntToString( (int)MGrFileTime( localProperty.optionsDir ) ) );
@@ -567,17 +566,8 @@
MGmStrcpy( strike, strikePtr );
if( strike[0] == '2' )
{
+ MGPMlogAdd( property, oldPortName, oldPortDir, "make Strike 3, marking port as ignore/looping ", " ", " " );
MGdbAdd( property->ignoreDb, oldPortDir, "looping, 3rd attempt at make", NULL );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \"make Strike 3 " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " marking port as ignore/looping " );
- MGmStrcat( localProperty.command, " \">> /var/log/portmanager.log" );
- system( localProperty.command );
- }
rCleanUp( property, &localProperty );
return( 0 );
}
@@ -593,16 +583,8 @@
property->fieldStrikesIDX,
exact );
property->strikesDb = MGdbDelete( property->strikesDb, MGdbGetRecno( property->strikesDb ) - 1 );
+ MGPMlogAdd( property, oldPortName, oldPortDir, "make Strike 2", " ", " " );
MGdbAdd( property->strikesDb, oldPortDir, "2", NULL );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \"make Strike 2 " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " \">> /var/log/portmanager.log" );
- system( localProperty.command );
- }
/*
* dualOriginCheck( property, oldPortName ); used to be here in old portmanager ver < 0.3.1, seems to be no longer
* needed, keep this note just in case
@@ -797,20 +779,28 @@
MGPMlogAdd( property, "conflicting installed ", localProperty.installedPortName,
" removed from system: conflicted with ", oldPortName, " " );
}
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = malloc( MAXSTRINGSIZE );
+ cmd[3] = 0;
+
+ MGmStrcpy( cmd[0], "/usr/sbin/pkg_delete" );
+ MGmStrcpy( cmd[1], "-f" );
+ MGmStrcpy( cmd[2], localProperty.installedPortName );
- MGmStrcpy( localProperty.command, "pkg_delete -f " );
- MGmStrcat( localProperty.command, localProperty.installedPortName );
- fprintf( stdout, "executing: %s\n", localProperty.command );
+ fprintf( stdout, "\nexecuting: %s %s %s\n", cmd[0], cmd[1], cmd[2] );
while( fflush( stdout ) );
- errorCode = system( localProperty.command );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \"removed conflicting port " );
- MGmStrcat( localProperty.command, localProperty.installedPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, " \">> /var/log/portmanager.log" );
- system( localProperty.command );
- }
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[2] );
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
+ MGPMlogAdd( property, "removed conflicting port", localProperty.installedPortName,
+ " ", " ", " " );
}
installedPortsDbIDX++;
}
@@ -848,15 +838,7 @@
fprintf( stderr, "marking %s as ignored\n", oldPortName );
fprintf( stdout, "%s\n", DOUBLE_LINES );
while( fflush( stderr ) );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \" " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " conflicts with another installed port so marked ignore\" >> /var/log/portmanager.log" );
- system( localProperty.command );
- }
+ MGPMlogAdd( property, oldPortName, oldPortDir, "conflicts with another installed port so marked ignore", " ", " " );
MGdbAdd( property->ignoreDb, oldPortDir, "conflicts with another installed port", NULL );
rCleanUp( property, &localProperty );
return( 0 );
@@ -986,15 +968,7 @@
while( fflush( stdout ) );
if( ( errorCode = system(localProperty.command) ) )
{
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \" " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " failed to fetch\" >> /var/log/portmanager.log" );
- system( localProperty.command );
- }
+ MGPMlogAdd( property, oldPortName, oldPortDir, "failed to fetch, adding to ignore.db", " ", " " );
fprintf( stdout, "%s %s error: make fetch returned an error, adding %s to ignore.db\n", id, PACKAGE_VERSION, oldPortDir );
while( fflush( stdout ) );
MGdbAdd( property->ignoreDb, oldPortDir, "failed during make fetch", NULL );
@@ -1005,70 +979,29 @@
/************************************************************************/
/* Command "9" " make" */
/************************************************************************/
+ MGmStrcpy( localProperty.command, "cd " );
+ MGmStrcat( localProperty.command, PORTSDIR );
+ MGmStrcat( localProperty.command, oldPortDir );
+ MGmStrcat( localProperty.command, " && make " );
if( MGrStrlen( localProperty.options ) > 0 )
{
- cmd = malloc( sizeof( char** ) * 3 );
- cmd[0] = malloc( MAXSTRINGSIZE );
- cmd[1] = malloc( MAXBUFFERSIZE );
- cmd[2] = 0;
- MGmStrcpy( cmd[0], PORTSDIR );
- MGmStrcat( cmd[0], oldPortDir );
- if( chdir( cmd[0] ) != 0 )
- {
- fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
- perror( "chroot" );
- while( fflush( stderr ) );
- assert( 0 );
- }
- MGmStrcpy( cmd[0], "/usr/bin/make" );
- MGmBuffercpy( cmd[1], localProperty.options, MAXBUFFERSIZE );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "update %s \n", oldPortName );
- fprintf( stdout, "%s %s command: #9 of 14 %s\nOPTIONS-=>%s\n", id, PACKAGE_VERSION, cmd[0], cmd[1] );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- while( fflush( stdout ) );
- MGmSystem( cmd, localProperty.environment );
- free( cmd[0] );
- free( cmd[1] );
- free( cmd );
- }
- else
- {
- cmd = malloc( sizeof( char** ) * 2 );
- cmd[0] = malloc( MAXSTRINGSIZE );
- cmd[1] = 0;
- MGmStrcpy( cmd[0], PORTSDIR );
- MGmStrcat( cmd[0], oldPortDir );
- if( chdir( cmd[0] ) != 0 )
- {
- fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
- perror( "chroot" );
- while( fflush( stderr ) );
- assert( 0 );
- }
- MGmStrcpy( cmd[0], "/usr/bin/make" );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "update %s \n", oldPortName );
- fprintf( stdout, "%s %s command: #9 of 14 %s\n", id, PACKAGE_VERSION, cmd[0] );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- while( fflush( stdout ) );
- MGmSystem( cmd, localProperty.environment );
- free( cmd[0] );
- free( cmd );
+ MGmStrcat( localProperty.command, localProperty.options );
}
- if( MGrIfDirEntry( localProperty.workFullPath, ".build_done" ) == 0 )
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "update %s \n", oldPortName );
+ fprintf( stdout, "%s %s command: #9 of 14 %s\n", id, PACKAGE_VERSION, localProperty.command );
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+ while( fflush( stdout ) );
+ if( ( errorCode = system(localProperty.command) ) )
{
- fprintf( stderr, "%s\n", SINGLE_LINES );
- fprintf( stderr, "%s error: %s %s failed during make, adding to ignore.db\n", id, oldPortName, oldPortDir );
- fprintf( stderr, "%s\n", SINGLE_LINES );
- while( fflush( stderr ) );
- MGPMlogAdd( property, oldPortName, oldPortDir, "port failed to build during make, adding to ignore.db", " ", " " );
- MGdbAdd( property->ignoreDb, oldPortDir, "port failed to build during make\n", NULL );
+ MGPMlogAdd( property, oldPortName, oldPortDir, "failed during make, adding to ignore.db", " ", " " );
+ fprintf( stdout, "%s %s error: make returned an error, adding %s to ignore.db\n", id, PACKAGE_VERSION, oldPortDir );
+ while( fflush( stdout ) );
+ MGdbAdd( property->ignoreDb, oldPortDir, "failed during make", NULL );
rCleanUp( property, &localProperty );
return(0);
}
-
/************************************************************************/
/* Command "10" pkg_create -b */
/************************************************************************/
@@ -1266,7 +1199,7 @@
MGmStrcat(localProperty.command, TEMPDIR);
MGmStrcat(localProperty.command, "/");
MGmStrcat(localProperty.command, oldPortName);
- MGmStrcat(localProperty.command, ".tgz");
+ MGmStrcat(localProperty.command, ".t[bg]z");
fprintf( stdout, "%s\n", SINGLE_LINES );
fprintf( stderr, "restoring original port from backup \n" );
fprintf( stderr, "%s %s command: #12 of 14!! ***Emergancy restore*** %s\n", id, PACKAGE_VERSION, localProperty.command );
@@ -1330,7 +1263,7 @@
MGmStrcat( localProperty.command, TEMPDIR);
MGmStrcat( localProperty.command, "; rm -f ");
MGmStrcat( localProperty.command, oldPortName);
- MGmStrcat( localProperty.command, ".tgz" );
+ MGmStrcat( localProperty.command, ".t[bg]z" );
fprintf( stdout, "%s\n", SINGLE_LINES );
fprintf( stderr, "deleting backup copy, installation of updated %s successful\n", oldPortDir );
fprintf( stdout, "%s %s localProperty.command: #12 of 14 %s\n", id, PACKAGE_VERSION, localProperty.command );
@@ -1555,12 +1488,6 @@
MGdbDestroy( property->ignoreDb );
MGdbDestroy( property->installedPortsDb );
MGdbDestroy( property->strikesDb );
-
-
- free( localProperty->environment[0] );
- free( localProperty->environment[1] );
- free( localProperty->environment[2] );
- free( localProperty->environment );
free( localProperty->CURDIR );
free( localProperty->afterOptionsFileSize );

View File

@ -0,0 +1,10 @@
--- ./libMGPM/src/libMGPM.h.orig Tue Dec 13 17:23:14 2005
+++ ./libMGPM/src/libMGPM.h Fri Dec 8 17:13:00 2006
@@ -118,7 +118,6 @@
char* workDir;
char* workFullPath;
char* xtermTitle;
- char** environment;
int bufferSize;
int optionsBufferSize;
} structLocalProperty;

View File

@ -0,0 +1,30 @@
--- ./libMG/src/MGdbAdd.c.orig Mon Dec 12 15:32:34 2005
+++ ./libMG/src/MGdbAdd.c Fri Dec 8 17:13:00 2006
@@ -39,7 +39,9 @@
int idx = 0;
va_list paramList;
- /* check if we have a valid object */
+ /*
+ * check if we have a valid object
+ */
if( db->parent.type != CLASS_TYPE_DB )
{
fprintf( stderr, "%s error: invalid object type\n", id);
@@ -71,6 +73,8 @@
*/
if( MGrBufferlen( paramPtr, MAXBUFFERSIZE ) < 1 )
{
+ fprintf( stderr, "%s error: attempt to place null data into record halted\n", id );
+ while( fflush( stderr ) );
assert(0);
}
fprintf( dbFileStream, "%s%c", paramPtr, 0 );
@@ -85,6 +89,7 @@
{
fprintf( stderr, "%s error: fields added (%d) exceed field quantity (%d)\n did you forget to terminate MGdbAdd with a NULL field?\n",
id, idx, db->fieldQty );
+ while( fflush( stderr ) );
assert(0);
}
}

View File

@ -0,0 +1,18 @@
--- ./libMG/src/MGdbRead.c.orig Mon Dec 12 15:32:34 2005
+++ ./libMG/src/MGdbRead.c Fri Dec 8 17:13:00 2006
@@ -58,6 +58,7 @@
fprintf( stderr, "%s error: unable to allocate %d bytes memory for db->dataBuffer\n",
id, dataBufferSize );
perror( "system message" );
+ while( fflush( stderr ) );
assert(0);
}
/*zzzzzzzzzzzzzz*/
@@ -70,6 +71,7 @@
{
fprintf( stderr, "%s error: reading file %s into db->dataBuffer\n", id, db->parent.path );
perror( "system message" ); \
+ while( fflush( stderr ) );
assert(0);
}

View File

@ -0,0 +1,11 @@
--- ./libMG/src/Makefile.am.orig Tue Dec 13 13:57:20 2005
+++ ./libMG/src/Makefile.am Fri Dec 8 17:13:00 2006
@@ -32,7 +32,7 @@
MGrStrlen.c \
MGxTermBarCreate.c \
MGxTermBarDestroy.c \
- MGxTermBarUpdate.c
+ MGxTermBarUpdate.c
include_HEADERS = libMG.h

View File

@ -0,0 +1,44 @@
--- ./libMG/src/libMG.h.orig Tue Dec 13 13:56:16 2005
+++ ./libMG/src/libMG.h Fri Dec 8 17:13:00 2006
@@ -57,6 +57,7 @@
#define KEY_a 97
#define CLASS_TYPE_DB 1
#define CLASS_TYPE_DIR 2
+#define CLASS_TYPE_MEM 3
#define CR 13
#define DEBUG_MGdb 0
#define DEBUG_MGdir 0
@@ -77,15 +78,15 @@
#define SINGLE_LINES "------------------------------------------------------------------------"
#define DOUBLE_LINES "========================================================================"
- char** MGm__command;
- int MGm__forkStatus;
- pid_t MGm__pid;
-struct stat fstatBuf;
-struct stat lstatBuf;
-typedef struct classDb classDb;
-typedef struct classDir classDir;
-unsigned int MGm__bufferSize;
-unsigned int MGm__stringSize;
+ char** MGm__command;
+ int MGm__forkStatus;
+ pid_t MGm__pid;
+ struct stat fstatBuf;
+ struct stat lstatBuf;
+ unsigned int MGm__bufferSize;
+ unsigned int MGm__stringSize;
+typedef struct classDb classDb;
+typedef struct classDir classDir;
#define MAXSTRINGSIZE 0x1ff
#define MAXBUFFERSIZE 0xffff
@@ -270,7 +271,7 @@
int MGrInStringSwap( char* originalString, char* oldString, char* newString );
int MGrStripComment( char*, char );
unsigned int MGrBufferlen( char* buffer, unsigned int maxBufferSize );
-unsigned int MGrStrlen( char* string );
+unsigned int MGrStrlen( char* String );
unsigned long int MGrFileTime( char* );
#endif

View File

@ -1,5 +1,5 @@
--- ./portmanager/patch-bsd.port.mk-0.3.6.orig Sat Nov 4 13:20:22 2006
+++ ./portmanager/patch-bsd.port.mk-0.3.6 Sat Nov 4 13:20:47 2006
--- ./portmanager/patch-bsd.port.mk-0.3.6.orig Mon Dec 12 15:32:34 2005
+++ ./portmanager/patch-bsd.port.mk-0.3.6 Fri Dec 8 17:13:00 2006
@@ -5,7 +5,7 @@
.endif
.if !defined(PKG_ARGS)

View File

@ -1,5 +1,5 @@
--- portmanager/portmanager.c.orig Tue Dec 13 00:20:58 2005
+++ portmanager/portmanager.c Sat May 27 18:08:32 2006
--- ./portmanager/portmanager.c.orig Mon Dec 12 19:20:58 2005
+++ ./portmanager/portmanager.c Fri Dec 8 17:13:00 2006
@@ -34,7 +34,13 @@
int main( int argc, char** argv, char** argp)
{

View File

@ -7,12 +7,12 @@
PORTNAME= portmanager
PORTVERSION= 0.4.1
PORTREVISION= 6
PORTREVISION= 7
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= portmanager
MAINTAINER= ports@FreeBSD.org
MAINTAINER= rnoland@2hip.net
COMMENT= FreeBSD installed ports status and safe update utility
MAN1= portmanager.1

View File

@ -1,703 +0,0 @@
diff -ruN ../0.4.1/libMG/src/MGdbAdd.c ./libMG/src/MGdbAdd.c
--- ../0.4.1/libMG/src/MGdbAdd.c Mon Dec 12 12:32:34 2005
+++ ./libMG/src/MGdbAdd.c Thu Dec 15 19:00:23 2005
@@ -39,7 +39,9 @@
int idx = 0;
va_list paramList;
- /* check if we have a valid object */
+ /*
+ * check if we have a valid object
+ */
if( db->parent.type != CLASS_TYPE_DB )
{
fprintf( stderr, "%s error: invalid object type\n", id);
@@ -71,6 +73,8 @@
*/
if( MGrBufferlen( paramPtr, MAXBUFFERSIZE ) < 1 )
{
+ fprintf( stderr, "%s error: attempt to place null data into record halted\n", id );
+ while( fflush( stderr ) );
assert(0);
}
fprintf( dbFileStream, "%s%c", paramPtr, 0 );
@@ -85,6 +89,7 @@
{
fprintf( stderr, "%s error: fields added (%d) exceed field quantity (%d)\n did you forget to terminate MGdbAdd with a NULL field?\n",
id, idx, db->fieldQty );
+ while( fflush( stderr ) );
assert(0);
}
}
diff -ruN ../0.4.1/libMG/src/MGdbRead.c ./libMG/src/MGdbRead.c
--- ../0.4.1/libMG/src/MGdbRead.c Mon Dec 12 12:32:34 2005
+++ ./libMG/src/MGdbRead.c Thu Dec 15 19:04:13 2005
@@ -58,6 +58,7 @@
fprintf( stderr, "%s error: unable to allocate %d bytes memory for db->dataBuffer\n",
id, dataBufferSize );
perror( "system message" );
+ while( fflush( stderr ) );
assert(0);
}
/*zzzzzzzzzzzzzz*/
@@ -70,6 +71,7 @@
{
fprintf( stderr, "%s error: reading file %s into db->dataBuffer\n", id, db->parent.path );
perror( "system message" ); \
+ while( fflush( stderr ) );
assert(0);
}
diff -ruN ../0.4.1/libMG/src/Makefile.am ./libMG/src/Makefile.am
--- ../0.4.1/libMG/src/Makefile.am Tue Dec 13 10:57:20 2005
+++ ./libMG/src/Makefile.am Sat Dec 17 08:03:02 2005
@@ -32,7 +32,7 @@
MGrStrlen.c \
MGxTermBarCreate.c \
MGxTermBarDestroy.c \
- MGxTermBarUpdate.c
+ MGxTermBarUpdate.c
include_HEADERS = libMG.h
diff -ruN ../0.4.1/libMG/src/libMG.h ./libMG/src/libMG.h
--- ../0.4.1/libMG/src/libMG.h Tue Dec 13 10:56:16 2005
+++ ./libMG/src/libMG.h Sat Dec 17 08:19:23 2005
@@ -57,6 +57,7 @@
#define KEY_a 97
#define CLASS_TYPE_DB 1
#define CLASS_TYPE_DIR 2
+#define CLASS_TYPE_MEM 3
#define CR 13
#define DEBUG_MGdb 0
#define DEBUG_MGdir 0
@@ -77,15 +78,15 @@
#define SINGLE_LINES "------------------------------------------------------------------------"
#define DOUBLE_LINES "========================================================================"
- char** MGm__command;
- int MGm__forkStatus;
- pid_t MGm__pid;
-struct stat fstatBuf;
-struct stat lstatBuf;
-typedef struct classDb classDb;
-typedef struct classDir classDir;
-unsigned int MGm__bufferSize;
-unsigned int MGm__stringSize;
+ char** MGm__command;
+ int MGm__forkStatus;
+ pid_t MGm__pid;
+ struct stat fstatBuf;
+ struct stat lstatBuf;
+ unsigned int MGm__bufferSize;
+ unsigned int MGm__stringSize;
+typedef struct classDb classDb;
+typedef struct classDir classDir;
#define MAXSTRINGSIZE 0x1ff
#define MAXBUFFERSIZE 0xffff
@@ -270,7 +271,7 @@
int MGrInStringSwap( char* originalString, char* oldString, char* newString );
int MGrStripComment( char*, char );
unsigned int MGrBufferlen( char* buffer, unsigned int maxBufferSize );
-unsigned int MGrStrlen( char* string );
+unsigned int MGrStrlen( char* String );
unsigned long int MGrFileTime( char* );
#endif
diff -ruN ../0.4.1/libMGPM/src/MGPMrPortBrokeCheck.c ./libMGPM/src/MGPMrPortBrokeCheck.c
--- ../0.4.1/libMGPM/src/MGPMrPortBrokeCheck.c Tue Dec 13 14:08:27 2005
+++ ./libMGPM/src/MGPMrPortBrokeCheck.c Sat Dec 17 07:20:37 2005
@@ -78,7 +78,7 @@
}
buffer[0] = 0;
fread( buffer, MAXBUFFERSIZE, 1, pHandle );
- if( ferror( pHandle ) == 0 && MGrStrlen( buffer ) > 1 )
+ if( ferror( pHandle ) == 0 && MGrBufferlen( buffer, MAXBUFFERSIZE ) > 1 )
{
fprintf( stdout, "%s %s error: %s %s marked %s, adding to ignore.db\n", id, PACKAGE_VERSION, oldPortName, oldPortDir, brokeCheckType );
while( fflush( stdout ) );
diff -ruN ../0.4.1/libMGPM/src/MGPMrShowLeavesDelete.c ./libMGPM/src/MGPMrShowLeavesDelete.c
--- ../0.4.1/libMGPM/src/MGPMrShowLeavesDelete.c Mon Dec 12 12:32:34 2005
+++ ./libMGPM/src/MGPMrShowLeavesDelete.c Sat Dec 17 08:54:02 2005
@@ -39,19 +39,21 @@
char exact[] = "exact";
char id[] = "MGPMrShowLeavesDelete";
char* command = NULL;
- char* leafPortDir = NULL;
+ char* leafPortDir;
char* leafPortName = NULL;
char* pkgDescFile = NULL;
+ char** cmd;
+ char** env;
int answer = 1;
- int bufferSize = 0xffff;
int doubleBreak = 0;
int installedPortsDbIDX = 0;
int installedPortsDbQTY = 0;
- command = calloc( bufferSize, 1 );
- leafPortDir = calloc( bufferSize, 1 );
- leafPortName = calloc( bufferSize, 1 );
- pkgDescFile = calloc( bufferSize, 1 );
+ leafPortDir = calloc( MAXSTRINGSIZE, 1 );
+ leafPortName = calloc( MAXSTRINGSIZE, 1 );
+
+ command = calloc( MAXBUFFERSIZE, 1 );
+ pkgDescFile = calloc( MAXBUFFERSIZE, 1 );
if( ( property->ignoreDb = MGdbOpen( property->ignoreDbFileName ) ) == NULL )
{
@@ -108,50 +110,94 @@
installedPortsDbIDX++;
continue;
}
-/*
- if( answer != KEY_ENTER )
+
+ cmd = malloc( sizeof( char* ) * 2 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = 0;
+
+ env = malloc( sizeof( char* ) * 2 );
+ env[0] = malloc( MAXSTRINGSIZE );
+ env[1] = 0;
+
+ MGmStrcpy( env[0], "TERM=" );
+ MGmStrcat( env[0], getenv( "TERM" ) );
+
+ MGmStrcpy( cmd[0], "/usr/bin/clear" );
+
+ MGmSystem( cmd, env );
+
+ free( env[0] );
+ free( env );
+
+ free( cmd[0] );
+ free( cmd );
+
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "*** for safety run portmanager -u after using this feature for deletion ***\n" );
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "Ports with no ports depending on them AKA \"leaf ports.\"\n" );
+ fprintf( stdout, "These ports may be deinstalled because no other ports rely on them to run;\"\n" );
+ if( property->buildDependsAreLeaves )
{
-*/
- system( "clear" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "*** for safety run portmanager -u after using this feature for deletion ***\n" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "Ports with no ports depending on them AKA \"leaf ports.\"\n" );
- fprintf( stdout, "These ports may be deinstalled because no other ports rely on them to run;\"\n" );
- if( property->buildDependsAreLeaves )
- {
- fprintf( stdout, "however, other ports may rely on these to build.\"\n" );
- }
- fprintf( stdout, "%s\n", SINGLE_LINES );
+ 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", leafPortName, leafPortDir );
- while( fflush( stdout ) );
+ fprintf( stdout, "%s dir -=> %s\n\n", leafPortName, leafPortDir );
+ while( fflush( stdout ) );
- MGmStrcpy( pkgDescFile, PORTSDIR );
- MGmStrcat( pkgDescFile, leafPortDir );
- MGmStrcat( pkgDescFile, "/pkg-descr" );
+ MGmStrcpy( pkgDescFile, PORTSDIR );
+ MGmStrcat( pkgDescFile, leafPortDir );
+ MGmStrcat( pkgDescFile, "/pkg-descr" );
- if( MGrIfFileExist( pkgDescFile ) )
- {
- MGmStrcpy( command, "cat " );
- MGmStrcat( command, pkgDescFile );
- system( command );
- fprintf( stdout, "\n" );
- }
- else
- {
- MGmStrcpy( command, "grep COMMENT " );
- MGmStrcat( command, PORTSDIR );
- MGmStrcat( command, leafPortDir );
- MGmStrcat( command, "/Makefile" );
- system( command );
- }
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "\n<ENTER> to skip\n<X><ENTER> removes port\n<N><ENTER> *Nuke it*, removes distribution files\n\n" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
-/*
+ if( MGrIfFileExist( pkgDescFile ) )
+ {
+ cmd = malloc( sizeof( char* ) * 3 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = 0;
+
+ MGmStrcpy( cmd[0], "/bin/cat" );
+ MGmStrcpy( cmd[1], pkgDescFile );
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[0] );
+ free( cmd[1] );
+ free( cmd );
+
+ fprintf( stdout, "\n" );
+ while( fflush( stdout ) );
+ }
+ else
+ {
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = malloc( MAXSTRINGSIZE );
+ cmd[3] = 0;
+
+ MGmStrcpy( cmd[0], "/usr/bin/grep" );
+ MGmStrcpy( cmd[1], "COMMENT" );
+ MGmStrcpy( cmd[2], PORTSDIR );
+ MGmStrcat( cmd[2], leafPortDir );
+ MGmStrcat( cmd[2], "/Makefile" );
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[0] );
+ free( cmd[1] );
+ free( cmd[2] );
+ free( cmd );
+
+ fprintf( stdout, "\n" );
+ while( fflush( stdout ) );
}
-*/
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "\n<ENTER> to skip\n<X><ENTER> removes port\n<N><ENTER> *Nuke it*, removes distribution files\n\n" );
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ while( fflush( stdout ) );
+
property->STDIN = fopen( "/dev/stdin", "r" ); /* Flawfinder: ignore */
doubleBreak = 0;
while( 1 == 1 )
@@ -243,9 +289,7 @@
{
char id[] = "removePort";
char exact[] = "exact";
- char* command = NULL;
-
- command = (char*)calloc( 0xffff, 1 );
+ char** cmd;
property->installedPortsDb = MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
@@ -261,12 +305,26 @@
MGdbGoTop( property->availableDependenciesDb );
}
- MGmStrcpy( command, "pkg_delete -f " );
- MGmStrcat( command, leafPortNamePtr );
- fprintf( stdout, "\nexecuting: %s\n", command );
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = malloc( MAXSTRINGSIZE );
+ cmd[3] = 0;
+
+ MGmStrcpy( cmd[0], "/usr/sbin/pkg_delete" );
+ MGmStrcpy( cmd[1], "-f" );
+ MGmStrcpy( cmd[2], leafPortNamePtr );
+
+ fprintf( stdout, "\nexecuting: %s %s %s\n", cmd[0], cmd[1], cmd[2] );
while( fflush( stdout ) );
- system( command );
- free(command);
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[2] );
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
return( 0 );
}
@@ -274,18 +332,35 @@
int nuke( char* leafPortDir )
{
char id[] = "nuke";
- char* command = NULL;
+ char** cmd;
- command = (char*)calloc( 0xffff, 1 );
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = 0;
+
+ MGmStrcpy( cmd[0], PORTSDIR );
+ MGmStrcat( cmd[0], leafPortDir );
+ if( chdir( cmd[0] ) != 0 )
+ {
+ fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
+ perror( "chroot" );
+ while( fflush( stderr ) );
+ assert( 0 );
+ }
- MGmStrcpy( command, "cd " );
- MGmStrcat( command, PORTSDIR );
- MGmStrcat( command, leafPortDir );
- MGmStrcat( command, "; make distclean" );
- fprintf( stdout, "\nexecuting: %s\n", command );
+ MGmStrcpy( cmd[0], "/usr/bin/make" );
+ MGmStrcpy( cmd[1], "distclean" );
+
+ fprintf( stdout, "\nexecuting: %s %s\n", cmd[0], cmd[1] );
while( fflush( stdout ) );
- system( command );
- free(command);
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
return( 0 );
}
diff -ruN ../0.4.1/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c
--- ../0.4.1/libMGPM/src/MGPMrUpdate.c Wed Dec 14 10:23:59 2005
+++ ./libMGPM/src/MGPMrUpdate.c Thu Dec 15 12:07:52 2005
@@ -60,6 +60,7 @@
char* stopPortDirPtr = NULL;
char* strikePtr = NULL;
char** cmd;
+ char** env;
int answer = 1;
int availableDependenciesDbIDX = 0;
int availableDependenciesDbQTY = 0;
@@ -74,12 +75,6 @@
property->optionsChanged = 0;
- localProperty.environment = malloc( sizeof( char** ) * 4 );
- localProperty.environment[0] = malloc( MAXSTRINGSIZE );
- localProperty.environment[1] = malloc( MAXSTRINGSIZE );
- localProperty.environment[2] = malloc( MAXSTRINGSIZE );
- localProperty.environment[3] = 0;
-
localProperty.CURDIR = calloc( MAXSTRINGSIZE, 1 );
localProperty.afterOptionsFileSize = calloc( MAXSTRINGSIZE, 1 );
localProperty.afterOptionsFileTime = calloc( MAXSTRINGSIZE, 1 );
@@ -122,30 +117,6 @@
return( 0 );
}
- /*
- * setup environment
- */
- MGmStrcpy( localProperty.environment[0], "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin" );
-
- if( getenv( "CCACHE_DIR" ) != NULL )
- {
- MGmStrcpy( localProperty.environment[1], "CCACHE_DIR=" );
- MGmStrcat( localProperty.environment[1], getenv( "CCACHE_DIR" ) );
- }
- else
- {
- localProperty.environment[1][0] = 0;
- }
-
- if( getenv( "CCACHE_PATH" ) != NULL )
- {
- MGmStrcpy( localProperty.environment[2], "CCACHE_PATH=/usr/bin:/usr/local/bin" );
- }
- else
- {
- localProperty.environment[2][0] = 0;
- }
-
/*
* test for bsd.ports.mk patch
*/
@@ -466,25 +437,53 @@
*/
/*
* If here we know OPTIONS is defined, need to run make config
- * if /var/db/ports/{package name}/options exists
+ * if /var/db/ports/{package name}/options does not exist
*/
if( MGrIfFileExist( localProperty.optionsDir ) == 0 )
{
- MGmStrcpy( localProperty.command, "cd " );
- MGmStrcat( localProperty.command, PORTSDIR );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " && make config " );
- if( MGrStrlen( localProperty.options ) > 0 )
+ cmd = malloc( sizeof( char* ) * 3 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = 0;
+
+ env = malloc( sizeof( char* ) * 2 );
+ env[0] = malloc( MAXSTRINGSIZE );
+ env[1] = 0;
+
+ MGmStrcpy( env[0], "TERM=" );
+ MGmStrcat( env[0], getenv( "TERM" ) );
+
+ MGmStrcpy( cmd[0], PORTSDIR );
+ MGmStrcat( cmd[0], oldPortDir );
+
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "config %s \n", cmd[0] );
+ while( fflush( stdout ) );
+
+ if( chdir( cmd[0] ) != 0 )
{
- MGmStrcat( localProperty.command, localProperty.options );
+ fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
+ perror( "chroot" );
+ while( fflush( stderr ) );
+ assert( 0 );
}
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "update %s \n", oldPortName );
- fprintf( stdout, "%s %s command: #2 of 14 %s\n", id, PACKAGE_VERSION, localProperty.command );
- fprintf( stdout, "%s\n", SINGLE_LINES );
+ MGmStrcpy( cmd[0], "/usr/bin/make" );
+ MGmStrcpy( cmd[1], "config" );
+ fprintf( stdout, "%s %s command: #2 of 14 %s %s\n", id, PACKAGE_VERSION, cmd[0], cmd[1] );
while( fflush( stdout ) );
- system(localProperty.command);
+
+ MGmSystem( cmd, env );
+
+ free( env[0] );
+ free( env );
+
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+
}
MGmStrcpy( localProperty.afterOptionsFileTime,
MGrIntToString( (int)MGrFileTime( localProperty.optionsDir ) ) );
@@ -567,17 +566,8 @@
MGmStrcpy( strike, strikePtr );
if( strike[0] == '2' )
{
+ MGPMlogAdd( property, oldPortName, oldPortDir, "make Strike 3, marking port as ignore/looping ", " ", " " );
MGdbAdd( property->ignoreDb, oldPortDir, "looping, 3rd attempt at make", NULL );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \"make Strike 3 " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " marking port as ignore/looping " );
- MGmStrcat( localProperty.command, " \">> /var/log/portmanager.log" );
- system( localProperty.command );
- }
rCleanUp( property, &localProperty );
return( 0 );
}
@@ -593,16 +583,8 @@
property->fieldStrikesIDX,
exact );
property->strikesDb = MGdbDelete( property->strikesDb, MGdbGetRecno( property->strikesDb ) - 1 );
+ MGPMlogAdd( property, oldPortName, oldPortDir, "make Strike 2", " ", " " );
MGdbAdd( property->strikesDb, oldPortDir, "2", NULL );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \"make Strike 2 " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " \">> /var/log/portmanager.log" );
- system( localProperty.command );
- }
/*
* dualOriginCheck( property, oldPortName ); used to be here in old portmanager ver < 0.3.1, seems to be no longer
* needed, keep this note just in case
@@ -797,20 +779,28 @@
MGPMlogAdd( property, "conflicting installed ", localProperty.installedPortName,
" removed from system: conflicted with ", oldPortName, " " );
}
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = malloc( MAXSTRINGSIZE );
+ cmd[3] = 0;
+
+ MGmStrcpy( cmd[0], "/usr/sbin/pkg_delete" );
+ MGmStrcpy( cmd[1], "-f" );
+ MGmStrcpy( cmd[2], localProperty.installedPortName );
- MGmStrcpy( localProperty.command, "pkg_delete -f " );
- MGmStrcat( localProperty.command, localProperty.installedPortName );
- fprintf( stdout, "executing: %s\n", localProperty.command );
+ fprintf( stdout, "\nexecuting: %s %s %s\n", cmd[0], cmd[1], cmd[2] );
while( fflush( stdout ) );
- errorCode = system( localProperty.command );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \"removed conflicting port " );
- MGmStrcat( localProperty.command, localProperty.installedPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, " \">> /var/log/portmanager.log" );
- system( localProperty.command );
- }
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[2] );
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
+ MGPMlogAdd( property, "removed conflicting port", localProperty.installedPortName,
+ " ", " ", " " );
}
installedPortsDbIDX++;
}
@@ -848,15 +838,7 @@
fprintf( stderr, "marking %s as ignored\n", oldPortName );
fprintf( stdout, "%s\n", DOUBLE_LINES );
while( fflush( stderr ) );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \" " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " conflicts with another installed port so marked ignore\" >> /var/log/portmanager.log" );
- system( localProperty.command );
- }
+ MGPMlogAdd( property, oldPortName, oldPortDir, "conflicts with another installed port so marked ignore", " ", " " );
MGdbAdd( property->ignoreDb, oldPortDir, "conflicts with another installed port", NULL );
rCleanUp( property, &localProperty );
return( 0 );
@@ -986,15 +968,7 @@
while( fflush( stdout ) );
if( ( errorCode = system(localProperty.command) ) )
{
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \" " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " failed to fetch\" >> /var/log/portmanager.log" );
- system( localProperty.command );
- }
+ MGPMlogAdd( property, oldPortName, oldPortDir, "failed to fetch, adding to ignore.db", " ", " " );
fprintf( stdout, "%s %s error: make fetch returned an error, adding %s to ignore.db\n", id, PACKAGE_VERSION, oldPortDir );
while( fflush( stdout ) );
MGdbAdd( property->ignoreDb, oldPortDir, "failed during make fetch", NULL );
@@ -1005,6 +979,36 @@
/************************************************************************/
/* Command "9" " make" */
/************************************************************************/
+ env = malloc( sizeof( char** ) * 4 );
+ env[0] = malloc( MAXSTRINGSIZE );
+ env[1] = malloc( MAXSTRINGSIZE );
+ env[2] = malloc( MAXSTRINGSIZE );
+ env[3] = 0;
+
+ /*
+ * setup environment
+ */
+ MGmStrcpy( env[0], "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin" );
+
+ if( getenv( "CCACHE_DIR" ) != NULL )
+ {
+ MGmStrcpy( env[1], "CCACHE_DIR=" );
+ MGmStrcat( env[1], getenv( "CCACHE_DIR" ) );
+ }
+ else
+ {
+ env[1][0] = 0;
+ }
+
+ if( getenv( "CCACHE_PATH" ) != NULL )
+ {
+ MGmStrcpy( env[2], "CCACHE_PATH=/usr/bin:/usr/local/bin" );
+ }
+ else
+ {
+ env[2][0] = 0;
+ }
+
if( MGrStrlen( localProperty.options ) > 0 )
{
cmd = malloc( sizeof( char** ) * 3 );
@@ -1027,7 +1031,7 @@
fprintf( stdout, "%s %s command: #9 of 14 %s\nOPTIONS-=>%s\n", id, PACKAGE_VERSION, cmd[0], cmd[1] );
fprintf( stdout, "%s\n", SINGLE_LINES );
while( fflush( stdout ) );
- MGmSystem( cmd, localProperty.environment );
+ MGmSystem( cmd, env );
free( cmd[0] );
free( cmd[1] );
free( cmd );
@@ -1052,7 +1056,7 @@
fprintf( stdout, "%s %s command: #9 of 14 %s\n", id, PACKAGE_VERSION, cmd[0] );
fprintf( stdout, "%s\n", SINGLE_LINES );
while( fflush( stdout ) );
- MGmSystem( cmd, localProperty.environment );
+ MGmSystem( cmd, env );
free( cmd[0] );
free( cmd );
}
@@ -1066,9 +1070,18 @@
MGPMlogAdd( property, oldPortName, oldPortDir, "port failed to build during make, adding to ignore.db", " ", " " );
MGdbAdd( property->ignoreDb, oldPortDir, "port failed to build during make\n", NULL );
rCleanUp( property, &localProperty );
+ free( env[0] );
+ free( env[1] );
+ free( env[2] );
+ free( env );
return(0);
}
+ free( env[0] );
+ free( env[1] );
+ free( env[2] );
+ free( env );
+
/************************************************************************/
/* Command "10" pkg_create -b */
/************************************************************************/
@@ -1555,12 +1568,6 @@
MGdbDestroy( property->ignoreDb );
MGdbDestroy( property->installedPortsDb );
MGdbDestroy( property->strikesDb );
-
-
- free( localProperty->environment[0] );
- free( localProperty->environment[1] );
- free( localProperty->environment[2] );
- free( localProperty->environment );
free( localProperty->CURDIR );
free( localProperty->afterOptionsFileSize );
diff -ruN ../0.4.1/libMGPM/src/libMGPM.h ./libMGPM/src/libMGPM.h
--- ../0.4.1/libMGPM/src/libMGPM.h Tue Dec 13 14:23:14 2005
+++ ./libMGPM/src/libMGPM.h Thu Dec 15 07:42:29 2005
@@ -118,7 +118,6 @@
char* workDir;
char* workFullPath;
char* xtermTitle;
- char** environment;
int bufferSize;
int optionsBufferSize;
} structLocalProperty;

View File

@ -1,52 +0,0 @@
diff -ruN ../0.4.1_1/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c
--- ../0.4.1_1/libMGPM/src/MGPMrUpdate.c Sat Dec 17 20:06:52 2005
+++ ./libMGPM/src/MGPMrUpdate.c Sun Dec 18 18:06:47 2005
@@ -983,30 +983,34 @@
env[0] = malloc( MAXSTRINGSIZE );
env[1] = malloc( MAXSTRINGSIZE );
env[2] = malloc( MAXSTRINGSIZE );
- env[3] = 0;
+ env[3] = malloc( MAXSTRINGSIZE );
+ env[4] = 0;
/*
* setup environment
*/
MGmStrcpy( env[0], "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin" );
+ MGmStrcpy( env[1], "TERM=" );
+ MGmStrcat( env[1], getenv( "TERM" ) );
+
if( getenv( "CCACHE_DIR" ) != NULL )
{
- MGmStrcpy( env[1], "CCACHE_DIR=" );
- MGmStrcat( env[1], getenv( "CCACHE_DIR" ) );
+ MGmStrcpy( env[2], "CCACHE_DIR=" );
+ MGmStrcat( env[2], getenv( "CCACHE_DIR" ) );
}
else
{
- env[1][0] = 0;
+ env[2][0] = 0;
}
if( getenv( "CCACHE_PATH" ) != NULL )
{
- MGmStrcpy( env[2], "CCACHE_PATH=/usr/bin:/usr/local/bin" );
+ MGmStrcpy( env[3], "CCACHE_PATH=/usr/bin:/usr/local/bin" );
}
else
{
- env[2][0] = 0;
+ env[3][0] = 0;
}
if( MGrStrlen( localProperty.options ) > 0 )
@@ -1080,6 +1084,7 @@
free( env[0] );
free( env[1] );
free( env[2] );
+ free( env[3] );
free( env );
/************************************************************************/

View File

@ -1,133 +0,0 @@
diff -ruN ../0.4.1_2/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c
--- ../0.4.1_2/libMGPM/src/MGPMrUpdate.c Mon Dec 19 11:45:50 2005
+++ ./libMGPM/src/MGPMrUpdate.c Wed Dec 21 22:16:31 2005
@@ -979,114 +979,29 @@
/************************************************************************/
/* Command "9" " make" */
/************************************************************************/
- env = malloc( sizeof( char** ) * 4 );
- env[0] = malloc( MAXSTRINGSIZE );
- env[1] = malloc( MAXSTRINGSIZE );
- env[2] = malloc( MAXSTRINGSIZE );
- env[3] = malloc( MAXSTRINGSIZE );
- env[4] = 0;
-
- /*
- * setup environment
- */
- MGmStrcpy( env[0], "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin" );
-
- MGmStrcpy( env[1], "TERM=" );
- MGmStrcat( env[1], getenv( "TERM" ) );
-
- if( getenv( "CCACHE_DIR" ) != NULL )
- {
- MGmStrcpy( env[2], "CCACHE_DIR=" );
- MGmStrcat( env[2], getenv( "CCACHE_DIR" ) );
- }
- else
- {
- env[2][0] = 0;
- }
-
- if( getenv( "CCACHE_PATH" ) != NULL )
- {
- MGmStrcpy( env[3], "CCACHE_PATH=/usr/bin:/usr/local/bin" );
- }
- else
- {
- env[3][0] = 0;
- }
-
+ MGmStrcpy( localProperty.command, "cd " );
+ MGmStrcat( localProperty.command, PORTSDIR );
+ MGmStrcat( localProperty.command, oldPortDir );
+ MGmStrcat( localProperty.command, " && make " );
if( MGrStrlen( localProperty.options ) > 0 )
{
- cmd = malloc( sizeof( char** ) * 3 );
- cmd[0] = malloc( MAXSTRINGSIZE );
- cmd[1] = malloc( MAXBUFFERSIZE );
- cmd[2] = 0;
- MGmStrcpy( cmd[0], PORTSDIR );
- MGmStrcat( cmd[0], oldPortDir );
- if( chdir( cmd[0] ) != 0 )
- {
- fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
- perror( "chroot" );
- while( fflush( stderr ) );
- assert( 0 );
- }
- MGmStrcpy( cmd[0], "/usr/bin/make" );
- MGmBuffercpy( cmd[1], localProperty.options, MAXBUFFERSIZE );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "update %s \n", oldPortName );
- fprintf( stdout, "%s %s command: #9 of 14 %s\nOPTIONS-=>%s\n", id, PACKAGE_VERSION, cmd[0], cmd[1] );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- while( fflush( stdout ) );
- MGmSystem( cmd, env );
- free( cmd[0] );
- free( cmd[1] );
- free( cmd );
- }
- else
- {
- cmd = malloc( sizeof( char** ) * 2 );
- cmd[0] = malloc( MAXSTRINGSIZE );
- cmd[1] = 0;
- MGmStrcpy( cmd[0], PORTSDIR );
- MGmStrcat( cmd[0], oldPortDir );
- if( chdir( cmd[0] ) != 0 )
- {
- fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
- perror( "chroot" );
- while( fflush( stderr ) );
- assert( 0 );
- }
- MGmStrcpy( cmd[0], "/usr/bin/make" );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "update %s \n", oldPortName );
- fprintf( stdout, "%s %s command: #9 of 14 %s\n", id, PACKAGE_VERSION, cmd[0] );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- while( fflush( stdout ) );
- MGmSystem( cmd, env );
- free( cmd[0] );
- free( cmd );
+ MGmStrcat( localProperty.command, localProperty.options );
}
- if( MGrIfDirEntry( localProperty.workFullPath, ".build_done" ) == 0 )
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "update %s \n", oldPortName );
+ fprintf( stdout, "%s %s command: #9 of 14 %s\n", id, PACKAGE_VERSION, localProperty.command );
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+ while( fflush( stdout ) );
+ if( ( errorCode = system(localProperty.command) ) )
{
- fprintf( stderr, "%s\n", SINGLE_LINES );
- fprintf( stderr, "%s error: %s %s failed during make, adding to ignore.db\n", id, oldPortName, oldPortDir );
- fprintf( stderr, "%s\n", SINGLE_LINES );
- while( fflush( stderr ) );
- MGPMlogAdd( property, oldPortName, oldPortDir, "port failed to build during make, adding to ignore.db", " ", " " );
- MGdbAdd( property->ignoreDb, oldPortDir, "port failed to build during make\n", NULL );
+ MGPMlogAdd( property, oldPortName, oldPortDir, "failed during make, adding to ignore.db", " ", " " );
+ fprintf( stdout, "%s %s error: make returned an error, adding %s to ignore.db\n", id, PACKAGE_VERSION, oldPortDir );
+ while( fflush( stdout ) );
+ MGdbAdd( property->ignoreDb, oldPortDir, "failed during make", NULL );
rCleanUp( property, &localProperty );
- free( env[0] );
- free( env[1] );
- free( env[2] );
- free( env );
return(0);
}
-
- free( env[0] );
- free( env[1] );
- free( env[2] );
- free( env[3] );
- free( env );
-
/************************************************************************/
/* Command "10" pkg_create -b */
/************************************************************************/

View File

@ -1,24 +0,0 @@
diff -ruN ../0.4.1_3/libMGPM/src/MGPMrInitialize.c ./libMGPM/src/MGPMrInitialize.c
--- ../0.4.1_3/libMGPM/src/MGPMrInitialize.c Thu Dec 22 06:42:13 2005
+++ ./libMGPM/src/MGPMrInitialize.c Mon Dec 26 20:00:02 2005
@@ -47,7 +47,7 @@
*/
property->configConfFileName = calloc( stringSize + 1, 1 );
MGmStrcpy(property->configConfFileName, ETCDIR);
- MGmStrcat(property->configConfFileName, "/portmanager/" );
+ MGmStrcat(property->configConfFileName, "/portmanager" );
MGmStrcat(property->configConfFileName, CONFIGURE_CONF);
/*
diff -ruN ../0.4.1_3/libMGPM/src/MGPMrReadConfigure.c ./libMGPM/src/MGPMrReadConfigure.c
--- ../0.4.1_3/libMGPM/src/MGPMrReadConfigure.c Thu Dec 22 06:42:13 2005
+++ ./libMGPM/src/MGPMrReadConfigure.c Mon Dec 26 20:05:15 2005
@@ -156,7 +156,7 @@
MGmStrcpy( cmd[0], "/bin/cp" );
MGmStrcpy( cmd[1], property->configConfFileName );
- MGmStrcat( cmd[1], ".SAMPLE " );
+ MGmStrcat( cmd[1], ".SAMPLE" );
MGmStrcpy( cmd[2], property->configConfFileName );
MGmSystem( cmd, NULL );

View File

@ -1,5 +1,5 @@
--- libMGPM/src/MGPMrGetPortName.c.orig Thu Feb 23 03:04:28 2006
+++ libMGPM/src/MGPMrGetPortName.c Thu Feb 23 03:06:22 2006
--- ./libMGPM/src/MGPMrGetPortName.c.orig Wed Dec 14 10:27:41 2005
+++ ./libMGPM/src/MGPMrGetPortName.c Fri Dec 8 17:13:00 2006
@@ -180,7 +180,8 @@
}
else

View File

@ -0,0 +1,11 @@
--- ./libMGPM/src/MGPMrInitialize.c.orig Mon Dec 12 15:32:34 2005
+++ ./libMGPM/src/MGPMrInitialize.c Fri Dec 8 17:13:00 2006
@@ -47,7 +47,7 @@
*/
property->configConfFileName = calloc( stringSize + 1, 1 );
MGmStrcpy(property->configConfFileName, ETCDIR);
- MGmStrcat(property->configConfFileName, "/portmanager/" );
+ MGmStrcat(property->configConfFileName, "/portmanager" );
MGmStrcat(property->configConfFileName, CONFIGURE_CONF);
/*

View File

@ -0,0 +1,11 @@
--- ./libMGPM/src/MGPMrPortBrokeCheck.c.orig Tue Dec 13 17:08:27 2005
+++ ./libMGPM/src/MGPMrPortBrokeCheck.c Fri Dec 8 17:13:00 2006
@@ -78,7 +78,7 @@
}
buffer[0] = 0;
fread( buffer, MAXBUFFERSIZE, 1, pHandle );
- if( ferror( pHandle ) == 0 && MGrStrlen( buffer ) > 1 )
+ if( ferror( pHandle ) == 0 && MGrBufferlen( buffer, MAXBUFFERSIZE ) > 1 )
{
fprintf( stdout, "%s %s error: %s %s marked %s, adding to ignore.db\n", id, PACKAGE_VERSION, oldPortName, oldPortDir, brokeCheckType );
while( fflush( stdout ) );

View File

@ -0,0 +1,11 @@
--- ./libMGPM/src/MGPMrReadConfigure.c.orig Wed Dec 14 00:12:40 2005
+++ ./libMGPM/src/MGPMrReadConfigure.c Fri Dec 8 17:13:00 2006
@@ -156,7 +156,7 @@
MGmStrcpy( cmd[0], "/bin/cp" );
MGmStrcpy( cmd[1], property->configConfFileName );
- MGmStrcat( cmd[1], ".SAMPLE " );
+ MGmStrcat( cmd[1], ".SAMPLE" );
MGmStrcpy( cmd[2], property->configConfFileName );
MGmSystem( cmd, NULL );

View File

@ -0,0 +1,252 @@
--- ./libMGPM/src/MGPMrShowLeavesDelete.c.orig Mon Dec 12 15:32:34 2005
+++ ./libMGPM/src/MGPMrShowLeavesDelete.c Fri Dec 8 17:13:00 2006
@@ -39,19 +39,21 @@
char exact[] = "exact";
char id[] = "MGPMrShowLeavesDelete";
char* command = NULL;
- char* leafPortDir = NULL;
+ char* leafPortDir;
char* leafPortName = NULL;
char* pkgDescFile = NULL;
+ char** cmd;
+ char** env;
int answer = 1;
- int bufferSize = 0xffff;
int doubleBreak = 0;
int installedPortsDbIDX = 0;
int installedPortsDbQTY = 0;
- command = calloc( bufferSize, 1 );
- leafPortDir = calloc( bufferSize, 1 );
- leafPortName = calloc( bufferSize, 1 );
- pkgDescFile = calloc( bufferSize, 1 );
+ leafPortDir = calloc( MAXSTRINGSIZE, 1 );
+ leafPortName = calloc( MAXSTRINGSIZE, 1 );
+
+ command = calloc( MAXBUFFERSIZE, 1 );
+ pkgDescFile = calloc( MAXBUFFERSIZE, 1 );
if( ( property->ignoreDb = MGdbOpen( property->ignoreDbFileName ) ) == NULL )
{
@@ -108,50 +110,94 @@
installedPortsDbIDX++;
continue;
}
-/*
- if( answer != KEY_ENTER )
+
+ cmd = malloc( sizeof( char* ) * 2 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = 0;
+
+ env = malloc( sizeof( char* ) * 2 );
+ env[0] = malloc( MAXSTRINGSIZE );
+ env[1] = 0;
+
+ MGmStrcpy( env[0], "TERM=" );
+ MGmStrcat( env[0], getenv( "TERM" ) );
+
+ MGmStrcpy( cmd[0], "/usr/bin/clear" );
+
+ MGmSystem( cmd, env );
+
+ free( env[0] );
+ free( env );
+
+ free( cmd[0] );
+ free( cmd );
+
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "*** for safety run portmanager -u after using this feature for deletion ***\n" );
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "Ports with no ports depending on them AKA \"leaf ports.\"\n" );
+ fprintf( stdout, "These ports may be deinstalled because no other ports rely on them to run;\"\n" );
+ if( property->buildDependsAreLeaves )
{
-*/
- system( "clear" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "*** for safety run portmanager -u after using this feature for deletion ***\n" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "Ports with no ports depending on them AKA \"leaf ports.\"\n" );
- fprintf( stdout, "These ports may be deinstalled because no other ports rely on them to run;\"\n" );
- if( property->buildDependsAreLeaves )
- {
- fprintf( stdout, "however, other ports may rely on these to build.\"\n" );
- }
- fprintf( stdout, "%s\n", SINGLE_LINES );
+ 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", leafPortName, leafPortDir );
- while( fflush( stdout ) );
+ fprintf( stdout, "%s dir -=> %s\n\n", leafPortName, leafPortDir );
+ while( fflush( stdout ) );
- MGmStrcpy( pkgDescFile, PORTSDIR );
- MGmStrcat( pkgDescFile, leafPortDir );
- MGmStrcat( pkgDescFile, "/pkg-descr" );
+ MGmStrcpy( pkgDescFile, PORTSDIR );
+ MGmStrcat( pkgDescFile, leafPortDir );
+ MGmStrcat( pkgDescFile, "/pkg-descr" );
- if( MGrIfFileExist( pkgDescFile ) )
- {
- MGmStrcpy( command, "cat " );
- MGmStrcat( command, pkgDescFile );
- system( command );
- fprintf( stdout, "\n" );
- }
- else
- {
- MGmStrcpy( command, "grep COMMENT " );
- MGmStrcat( command, PORTSDIR );
- MGmStrcat( command, leafPortDir );
- MGmStrcat( command, "/Makefile" );
- system( command );
- }
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "\n<ENTER> to skip\n<X><ENTER> removes port\n<N><ENTER> *Nuke it*, removes distribution files\n\n" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
-/*
+ if( MGrIfFileExist( pkgDescFile ) )
+ {
+ cmd = malloc( sizeof( char* ) * 3 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = 0;
+
+ MGmStrcpy( cmd[0], "/bin/cat" );
+ MGmStrcpy( cmd[1], pkgDescFile );
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[0] );
+ free( cmd[1] );
+ free( cmd );
+
+ fprintf( stdout, "\n" );
+ while( fflush( stdout ) );
+ }
+ else
+ {
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = malloc( MAXSTRINGSIZE );
+ cmd[3] = 0;
+
+ MGmStrcpy( cmd[0], "/usr/bin/grep" );
+ MGmStrcpy( cmd[1], "COMMENT" );
+ MGmStrcpy( cmd[2], PORTSDIR );
+ MGmStrcat( cmd[2], leafPortDir );
+ MGmStrcat( cmd[2], "/Makefile" );
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[0] );
+ free( cmd[1] );
+ free( cmd[2] );
+ free( cmd );
+
+ fprintf( stdout, "\n" );
+ while( fflush( stdout ) );
}
-*/
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "\n<ENTER> to skip\n<X><ENTER> removes port\n<N><ENTER> *Nuke it*, removes distribution files\n\n" );
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ while( fflush( stdout ) );
+
property->STDIN = fopen( "/dev/stdin", "r" ); /* Flawfinder: ignore */
doubleBreak = 0;
while( 1 == 1 )
@@ -243,9 +289,7 @@
{
char id[] = "removePort";
char exact[] = "exact";
- char* command = NULL;
-
- command = (char*)calloc( 0xffff, 1 );
+ char** cmd;
property->installedPortsDb = MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
@@ -261,12 +305,26 @@
MGdbGoTop( property->availableDependenciesDb );
}
- MGmStrcpy( command, "pkg_delete -f " );
- MGmStrcat( command, leafPortNamePtr );
- fprintf( stdout, "\nexecuting: %s\n", command );
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = malloc( MAXSTRINGSIZE );
+ cmd[3] = 0;
+
+ MGmStrcpy( cmd[0], "/usr/sbin/pkg_delete" );
+ MGmStrcpy( cmd[1], "-f" );
+ MGmStrcpy( cmd[2], leafPortNamePtr );
+
+ fprintf( stdout, "\nexecuting: %s %s %s\n", cmd[0], cmd[1], cmd[2] );
while( fflush( stdout ) );
- system( command );
- free(command);
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[2] );
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
return( 0 );
}
@@ -274,18 +332,35 @@
int nuke( char* leafPortDir )
{
char id[] = "nuke";
- char* command = NULL;
+ char** cmd;
- command = (char*)calloc( 0xffff, 1 );
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = 0;
+
+ MGmStrcpy( cmd[0], PORTSDIR );
+ MGmStrcat( cmd[0], leafPortDir );
+ if( chdir( cmd[0] ) != 0 )
+ {
+ fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
+ perror( "chroot" );
+ while( fflush( stderr ) );
+ assert( 0 );
+ }
- MGmStrcpy( command, "cd " );
- MGmStrcat( command, PORTSDIR );
- MGmStrcat( command, leafPortDir );
- MGmStrcat( command, "; make distclean" );
- fprintf( stdout, "\nexecuting: %s\n", command );
+ MGmStrcpy( cmd[0], "/usr/bin/make" );
+ MGmStrcpy( cmd[1], "distclean" );
+
+ fprintf( stdout, "\nexecuting: %s %s\n", cmd[0], cmd[1] );
while( fflush( stdout ) );
- system( command );
- free(command);
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
return( 0 );
}

View File

@ -0,0 +1,349 @@
--- libMGPM/src/MGPMrUpdate.c.orig Wed Dec 14 13:23:59 2005
+++ libMGPM/src/MGPMrUpdate.c Fri Dec 8 17:24:30 2006
@@ -60,6 +60,7 @@
char* stopPortDirPtr = NULL;
char* strikePtr = NULL;
char** cmd;
+ char** env;
int answer = 1;
int availableDependenciesDbIDX = 0;
int availableDependenciesDbQTY = 0;
@@ -74,12 +75,6 @@
property->optionsChanged = 0;
- localProperty.environment = malloc( sizeof( char** ) * 4 );
- localProperty.environment[0] = malloc( MAXSTRINGSIZE );
- localProperty.environment[1] = malloc( MAXSTRINGSIZE );
- localProperty.environment[2] = malloc( MAXSTRINGSIZE );
- localProperty.environment[3] = 0;
-
localProperty.CURDIR = calloc( MAXSTRINGSIZE, 1 );
localProperty.afterOptionsFileSize = calloc( MAXSTRINGSIZE, 1 );
localProperty.afterOptionsFileTime = calloc( MAXSTRINGSIZE, 1 );
@@ -122,30 +117,6 @@
return( 0 );
}
- /*
- * setup environment
- */
- MGmStrcpy( localProperty.environment[0], "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin" );
-
- if( getenv( "CCACHE_DIR" ) != NULL )
- {
- MGmStrcpy( localProperty.environment[1], "CCACHE_DIR=" );
- MGmStrcat( localProperty.environment[1], getenv( "CCACHE_DIR" ) );
- }
- else
- {
- localProperty.environment[1][0] = 0;
- }
-
- if( getenv( "CCACHE_PATH" ) != NULL )
- {
- MGmStrcpy( localProperty.environment[2], "CCACHE_PATH=/usr/bin:/usr/local/bin" );
- }
- else
- {
- localProperty.environment[2][0] = 0;
- }
-
/*
* test for bsd.ports.mk patch
*/
@@ -466,25 +437,53 @@
*/
/*
* If here we know OPTIONS is defined, need to run make config
- * if /var/db/ports/{package name}/options exists
+ * if /var/db/ports/{package name}/options does not exist
*/
if( MGrIfFileExist( localProperty.optionsDir ) == 0 )
{
- MGmStrcpy( localProperty.command, "cd " );
- MGmStrcat( localProperty.command, PORTSDIR );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " && make config " );
- if( MGrStrlen( localProperty.options ) > 0 )
+ cmd = malloc( sizeof( char* ) * 3 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = 0;
+
+ env = malloc( sizeof( char* ) * 2 );
+ env[0] = malloc( MAXSTRINGSIZE );
+ env[1] = 0;
+
+ MGmStrcpy( env[0], "TERM=" );
+ MGmStrcat( env[0], getenv( "TERM" ) );
+
+ MGmStrcpy( cmd[0], PORTSDIR );
+ MGmStrcat( cmd[0], oldPortDir );
+
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "config %s \n", cmd[0] );
+ while( fflush( stdout ) );
+
+ if( chdir( cmd[0] ) != 0 )
{
- MGmStrcat( localProperty.command, localProperty.options );
+ fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
+ perror( "chroot" );
+ while( fflush( stderr ) );
+ assert( 0 );
}
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "update %s \n", oldPortName );
- fprintf( stdout, "%s %s command: #2 of 14 %s\n", id, PACKAGE_VERSION, localProperty.command );
- fprintf( stdout, "%s\n", SINGLE_LINES );
+ MGmStrcpy( cmd[0], "/usr/bin/make" );
+ MGmStrcpy( cmd[1], "config" );
+ fprintf( stdout, "%s %s command: #2 of 14 %s %s\n", id, PACKAGE_VERSION, cmd[0], cmd[1] );
while( fflush( stdout ) );
- system(localProperty.command);
+
+ MGmSystem( cmd, env );
+
+ free( env[0] );
+ free( env );
+
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+
}
MGmStrcpy( localProperty.afterOptionsFileTime,
MGrIntToString( (int)MGrFileTime( localProperty.optionsDir ) ) );
@@ -567,17 +566,8 @@
MGmStrcpy( strike, strikePtr );
if( strike[0] == '2' )
{
+ MGPMlogAdd( property, oldPortName, oldPortDir, "make Strike 3, marking port as ignore/looping ", " ", " " );
MGdbAdd( property->ignoreDb, oldPortDir, "looping, 3rd attempt at make", NULL );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \"make Strike 3 " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " marking port as ignore/looping " );
- MGmStrcat( localProperty.command, " \">> /var/log/portmanager.log" );
- system( localProperty.command );
- }
rCleanUp( property, &localProperty );
return( 0 );
}
@@ -593,16 +583,8 @@
property->fieldStrikesIDX,
exact );
property->strikesDb = MGdbDelete( property->strikesDb, MGdbGetRecno( property->strikesDb ) - 1 );
+ MGPMlogAdd( property, oldPortName, oldPortDir, "make Strike 2", " ", " " );
MGdbAdd( property->strikesDb, oldPortDir, "2", NULL );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \"make Strike 2 " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " \">> /var/log/portmanager.log" );
- system( localProperty.command );
- }
/*
* dualOriginCheck( property, oldPortName ); used to be here in old portmanager ver < 0.3.1, seems to be no longer
* needed, keep this note just in case
@@ -797,20 +779,28 @@
MGPMlogAdd( property, "conflicting installed ", localProperty.installedPortName,
" removed from system: conflicted with ", oldPortName, " " );
}
+ cmd = malloc( sizeof( char* ) * 4 );
+ cmd[0] = malloc( MAXSTRINGSIZE );
+ cmd[1] = malloc( MAXSTRINGSIZE );
+ cmd[2] = malloc( MAXSTRINGSIZE );
+ cmd[3] = 0;
+
+ MGmStrcpy( cmd[0], "/usr/sbin/pkg_delete" );
+ MGmStrcpy( cmd[1], "-f" );
+ MGmStrcpy( cmd[2], localProperty.installedPortName );
- MGmStrcpy( localProperty.command, "pkg_delete -f " );
- MGmStrcat( localProperty.command, localProperty.installedPortName );
- fprintf( stdout, "executing: %s\n", localProperty.command );
+ fprintf( stdout, "\nexecuting: %s %s %s\n", cmd[0], cmd[1], cmd[2] );
while( fflush( stdout ) );
- errorCode = system( localProperty.command );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \"removed conflicting port " );
- MGmStrcat( localProperty.command, localProperty.installedPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, " \">> /var/log/portmanager.log" );
- system( localProperty.command );
- }
+
+ MGmSystem( cmd, NULL );
+
+ free( cmd[2] );
+ free( cmd[1] );
+ free( cmd[0] );
+ free( cmd );
+
+ MGPMlogAdd( property, "removed conflicting port", localProperty.installedPortName,
+ " ", " ", " " );
}
installedPortsDbIDX++;
}
@@ -848,15 +838,7 @@
fprintf( stderr, "marking %s as ignored\n", oldPortName );
fprintf( stdout, "%s\n", DOUBLE_LINES );
while( fflush( stderr ) );
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \" " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " conflicts with another installed port so marked ignore\" >> /var/log/portmanager.log" );
- system( localProperty.command );
- }
+ MGPMlogAdd( property, oldPortName, oldPortDir, "conflicts with another installed port so marked ignore", " ", " " );
MGdbAdd( property->ignoreDb, oldPortDir, "conflicts with another installed port", NULL );
rCleanUp( property, &localProperty );
return( 0 );
@@ -986,15 +968,7 @@
while( fflush( stdout ) );
if( ( errorCode = system(localProperty.command) ) )
{
- if( property->log )
- {
- MGmStrcpy( localProperty.command, "echo \" " );
- MGmStrcat( localProperty.command, oldPortName );
- MGmStrcat( localProperty.command, " " );
- MGmStrcat( localProperty.command, oldPortDir );
- MGmStrcat( localProperty.command, " failed to fetch\" >> /var/log/portmanager.log" );
- system( localProperty.command );
- }
+ MGPMlogAdd( property, oldPortName, oldPortDir, "failed to fetch, adding to ignore.db", " ", " " );
fprintf( stdout, "%s %s error: make fetch returned an error, adding %s to ignore.db\n", id, PACKAGE_VERSION, oldPortDir );
while( fflush( stdout ) );
MGdbAdd( property->ignoreDb, oldPortDir, "failed during make fetch", NULL );
@@ -1005,70 +979,29 @@
/************************************************************************/
/* Command "9" " make" */
/************************************************************************/
+ MGmStrcpy( localProperty.command, "cd " );
+ MGmStrcat( localProperty.command, PORTSDIR );
+ MGmStrcat( localProperty.command, oldPortDir );
+ MGmStrcat( localProperty.command, " && make " );
if( MGrStrlen( localProperty.options ) > 0 )
{
- cmd = malloc( sizeof( char** ) * 3 );
- cmd[0] = malloc( MAXSTRINGSIZE );
- cmd[1] = malloc( MAXBUFFERSIZE );
- cmd[2] = 0;
- MGmStrcpy( cmd[0], PORTSDIR );
- MGmStrcat( cmd[0], oldPortDir );
- if( chdir( cmd[0] ) != 0 )
- {
- fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
- perror( "chroot" );
- while( fflush( stderr ) );
- assert( 0 );
- }
- MGmStrcpy( cmd[0], "/usr/bin/make" );
- MGmBuffercpy( cmd[1], localProperty.options, MAXBUFFERSIZE );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "update %s \n", oldPortName );
- fprintf( stdout, "%s %s command: #9 of 14 %s\nOPTIONS-=>%s\n", id, PACKAGE_VERSION, cmd[0], cmd[1] );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- while( fflush( stdout ) );
- MGmSystem( cmd, localProperty.environment );
- free( cmd[0] );
- free( cmd[1] );
- free( cmd );
- }
- else
- {
- cmd = malloc( sizeof( char** ) * 2 );
- cmd[0] = malloc( MAXSTRINGSIZE );
- cmd[1] = 0;
- MGmStrcpy( cmd[0], PORTSDIR );
- MGmStrcat( cmd[0], oldPortDir );
- if( chdir( cmd[0] ) != 0 )
- {
- fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] );
- perror( "chroot" );
- while( fflush( stderr ) );
- assert( 0 );
- }
- MGmStrcpy( cmd[0], "/usr/bin/make" );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- fprintf( stdout, "update %s \n", oldPortName );
- fprintf( stdout, "%s %s command: #9 of 14 %s\n", id, PACKAGE_VERSION, cmd[0] );
- fprintf( stdout, "%s\n", SINGLE_LINES );
- while( fflush( stdout ) );
- MGmSystem( cmd, localProperty.environment );
- free( cmd[0] );
- free( cmd );
+ MGmStrcat( localProperty.command, localProperty.options );
}
- if( MGrIfDirEntry( localProperty.workFullPath, ".build_done" ) == 0 )
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+ fprintf( stdout, "update %s \n", oldPortName );
+ fprintf( stdout, "%s %s command: #9 of 14 %s\n", id, PACKAGE_VERSION, localProperty.command );
+ fprintf( stdout, "%s\n", SINGLE_LINES );
+ while( fflush( stdout ) );
+ if( ( errorCode = system(localProperty.command) ) )
{
- fprintf( stderr, "%s\n", SINGLE_LINES );
- fprintf( stderr, "%s error: %s %s failed during make, adding to ignore.db\n", id, oldPortName, oldPortDir );
- fprintf( stderr, "%s\n", SINGLE_LINES );
- while( fflush( stderr ) );
- MGPMlogAdd( property, oldPortName, oldPortDir, "port failed to build during make, adding to ignore.db", " ", " " );
- MGdbAdd( property->ignoreDb, oldPortDir, "port failed to build during make\n", NULL );
+ MGPMlogAdd( property, oldPortName, oldPortDir, "failed during make, adding to ignore.db", " ", " " );
+ fprintf( stdout, "%s %s error: make returned an error, adding %s to ignore.db\n", id, PACKAGE_VERSION, oldPortDir );
+ while( fflush( stdout ) );
+ MGdbAdd( property->ignoreDb, oldPortDir, "failed during make", NULL );
rCleanUp( property, &localProperty );
return(0);
}
-
/************************************************************************/
/* Command "10" pkg_create -b */
/************************************************************************/
@@ -1266,7 +1199,7 @@
MGmStrcat(localProperty.command, TEMPDIR);
MGmStrcat(localProperty.command, "/");
MGmStrcat(localProperty.command, oldPortName);
- MGmStrcat(localProperty.command, ".tgz");
+ MGmStrcat(localProperty.command, ".t[bg]z");
fprintf( stdout, "%s\n", SINGLE_LINES );
fprintf( stderr, "restoring original port from backup \n" );
fprintf( stderr, "%s %s command: #12 of 14!! ***Emergancy restore*** %s\n", id, PACKAGE_VERSION, localProperty.command );
@@ -1330,7 +1263,7 @@
MGmStrcat( localProperty.command, TEMPDIR);
MGmStrcat( localProperty.command, "; rm -f ");
MGmStrcat( localProperty.command, oldPortName);
- MGmStrcat( localProperty.command, ".tgz" );
+ MGmStrcat( localProperty.command, ".t[bg]z" );
fprintf( stdout, "%s\n", SINGLE_LINES );
fprintf( stderr, "deleting backup copy, installation of updated %s successful\n", oldPortDir );
fprintf( stdout, "%s %s localProperty.command: #12 of 14 %s\n", id, PACKAGE_VERSION, localProperty.command );
@@ -1555,12 +1488,6 @@
MGdbDestroy( property->ignoreDb );
MGdbDestroy( property->installedPortsDb );
MGdbDestroy( property->strikesDb );
-
-
- free( localProperty->environment[0] );
- free( localProperty->environment[1] );
- free( localProperty->environment[2] );
- free( localProperty->environment );
free( localProperty->CURDIR );
free( localProperty->afterOptionsFileSize );

View File

@ -0,0 +1,10 @@
--- ./libMGPM/src/libMGPM.h.orig Tue Dec 13 17:23:14 2005
+++ ./libMGPM/src/libMGPM.h Fri Dec 8 17:13:00 2006
@@ -118,7 +118,6 @@
char* workDir;
char* workFullPath;
char* xtermTitle;
- char** environment;
int bufferSize;
int optionsBufferSize;
} structLocalProperty;

View File

@ -0,0 +1,30 @@
--- ./libMG/src/MGdbAdd.c.orig Mon Dec 12 15:32:34 2005
+++ ./libMG/src/MGdbAdd.c Fri Dec 8 17:13:00 2006
@@ -39,7 +39,9 @@
int idx = 0;
va_list paramList;
- /* check if we have a valid object */
+ /*
+ * check if we have a valid object
+ */
if( db->parent.type != CLASS_TYPE_DB )
{
fprintf( stderr, "%s error: invalid object type\n", id);
@@ -71,6 +73,8 @@
*/
if( MGrBufferlen( paramPtr, MAXBUFFERSIZE ) < 1 )
{
+ fprintf( stderr, "%s error: attempt to place null data into record halted\n", id );
+ while( fflush( stderr ) );
assert(0);
}
fprintf( dbFileStream, "%s%c", paramPtr, 0 );
@@ -85,6 +89,7 @@
{
fprintf( stderr, "%s error: fields added (%d) exceed field quantity (%d)\n did you forget to terminate MGdbAdd with a NULL field?\n",
id, idx, db->fieldQty );
+ while( fflush( stderr ) );
assert(0);
}
}

View File

@ -0,0 +1,18 @@
--- ./libMG/src/MGdbRead.c.orig Mon Dec 12 15:32:34 2005
+++ ./libMG/src/MGdbRead.c Fri Dec 8 17:13:00 2006
@@ -58,6 +58,7 @@
fprintf( stderr, "%s error: unable to allocate %d bytes memory for db->dataBuffer\n",
id, dataBufferSize );
perror( "system message" );
+ while( fflush( stderr ) );
assert(0);
}
/*zzzzzzzzzzzzzz*/
@@ -70,6 +71,7 @@
{
fprintf( stderr, "%s error: reading file %s into db->dataBuffer\n", id, db->parent.path );
perror( "system message" ); \
+ while( fflush( stderr ) );
assert(0);
}

View File

@ -0,0 +1,11 @@
--- ./libMG/src/Makefile.am.orig Tue Dec 13 13:57:20 2005
+++ ./libMG/src/Makefile.am Fri Dec 8 17:13:00 2006
@@ -32,7 +32,7 @@
MGrStrlen.c \
MGxTermBarCreate.c \
MGxTermBarDestroy.c \
- MGxTermBarUpdate.c
+ MGxTermBarUpdate.c
include_HEADERS = libMG.h

View File

@ -0,0 +1,44 @@
--- ./libMG/src/libMG.h.orig Tue Dec 13 13:56:16 2005
+++ ./libMG/src/libMG.h Fri Dec 8 17:13:00 2006
@@ -57,6 +57,7 @@
#define KEY_a 97
#define CLASS_TYPE_DB 1
#define CLASS_TYPE_DIR 2
+#define CLASS_TYPE_MEM 3
#define CR 13
#define DEBUG_MGdb 0
#define DEBUG_MGdir 0
@@ -77,15 +78,15 @@
#define SINGLE_LINES "------------------------------------------------------------------------"
#define DOUBLE_LINES "========================================================================"
- char** MGm__command;
- int MGm__forkStatus;
- pid_t MGm__pid;
-struct stat fstatBuf;
-struct stat lstatBuf;
-typedef struct classDb classDb;
-typedef struct classDir classDir;
-unsigned int MGm__bufferSize;
-unsigned int MGm__stringSize;
+ char** MGm__command;
+ int MGm__forkStatus;
+ pid_t MGm__pid;
+ struct stat fstatBuf;
+ struct stat lstatBuf;
+ unsigned int MGm__bufferSize;
+ unsigned int MGm__stringSize;
+typedef struct classDb classDb;
+typedef struct classDir classDir;
#define MAXSTRINGSIZE 0x1ff
#define MAXBUFFERSIZE 0xffff
@@ -270,7 +271,7 @@
int MGrInStringSwap( char* originalString, char* oldString, char* newString );
int MGrStripComment( char*, char );
unsigned int MGrBufferlen( char* buffer, unsigned int maxBufferSize );
-unsigned int MGrStrlen( char* string );
+unsigned int MGrStrlen( char* String );
unsigned long int MGrFileTime( char* );
#endif

View File

@ -1,5 +1,5 @@
--- ./portmanager/patch-bsd.port.mk-0.3.6.orig Sat Nov 4 13:20:22 2006
+++ ./portmanager/patch-bsd.port.mk-0.3.6 Sat Nov 4 13:20:47 2006
--- ./portmanager/patch-bsd.port.mk-0.3.6.orig Mon Dec 12 15:32:34 2005
+++ ./portmanager/patch-bsd.port.mk-0.3.6 Fri Dec 8 17:13:00 2006
@@ -5,7 +5,7 @@
.endif
.if !defined(PKG_ARGS)

View File

@ -1,5 +1,5 @@
--- portmanager/portmanager.c.orig Tue Dec 13 00:20:58 2005
+++ portmanager/portmanager.c Sat May 27 18:08:32 2006
--- ./portmanager/portmanager.c.orig Mon Dec 12 19:20:58 2005
+++ ./portmanager/portmanager.c Fri Dec 8 17:13:00 2006
@@ -34,7 +34,13 @@
int main( int argc, char** argv, char** argp)
{