1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

Update to 0.3.4_1

* Fixed seg fault in -slid on 6.0 machines
* Fixed segfault when cvsup not set to delete and an installed port
is removed from the ports tree

PR:		88888
Submitted by:	Michael C. Shultz <ringworm01@gmail.com> (maintainer)
This commit is contained in:
Marcus Alves Grando 2005-11-12 19:27:27 +00:00
parent 4b5645b355
commit 3a78b7196d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=148054
4 changed files with 1662 additions and 0 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= portmanager
PORTVERSION= 0.3.4
PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= http://portmanager.sunsite.dk/distfiles/ \
${MASTER_SITE_SOURCEFORGE}

View File

@ -0,0 +1,830 @@
diff -ruN ../0.3.4/externVars.h.in ./externVars.h.in
--- ../0.3.4/externVars.h.in Fri Nov 11 06:31:14 2005
+++ ./externVars.h.in Fri Nov 11 19:38:50 2005
@@ -78,13 +78,13 @@
#define PACKAGE_NAME "portmanager"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "portmanager 0.3.4"
+#define PACKAGE_STRING "portmanager 0.3.5"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "portmanager"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.3.4"
+#define PACKAGE_VERSION "0.3.5"
/* location of ports registry, default is /var/db/pkg */
#define PKGDBDIR "@PKGDBDIR@"
diff -ruN ../0.3.4/libMG/src/MGdbAdd.c ./libMG/src/MGdbAdd.c
--- ../0.3.4/libMG/src/MGdbAdd.c Mon Nov 7 16:46:00 2005
+++ ./libMG/src/MGdbAdd.c Fri Nov 11 17:23:26 2005
@@ -58,6 +58,14 @@
{
break;
}
+
+ /*
+ * prevent null data from being placed into record fields
+ */
+ if( strlen( paramPtr ) < 1 )
+ {
+ assert(0);
+ }
fprintf( dbFileStream, "%s%c", paramPtr, 0 );
/*
diff -ruN ../0.3.4/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c
--- ../0.3.4/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Thu Nov 10 16:12:52 2005
+++ ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Fri Nov 11 19:30:42 2005
@@ -32,7 +32,6 @@
int rrDependencyParse( structProperty* property, char* buffer, char* availablePortName, char* availablePortDir, char* dependType, int* counterPtr );
int rrFillDependencies( structProperty* property, char* availablePortName, char* availablePortDir, int* counterPtr );
int rrFindDepends( structProperty* property, char* availablePortDir, char* availablePortName, int* counterPtr );
-int rrGetPortName( structProperty* property, char* portDir, char* portName );
int rrParse( structProperty* property, char* availablePortName, char* availablePortDir, char* dependType, char* buffer, int* counterPtr );
int MGPMrCreateAllUpdateStatusDb( structProperty* property )
@@ -116,7 +115,7 @@
strcpy( availablePortDir, installedPortsDbPortDirPtr );
if( ( errorCode = rrFindDepends( property, availablePortDir, availablePortName, counterPtr ) ) == 100 )
{
- MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
+ property->installedPortsDb = MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
installedPortsDbQTY--;
}
installedPortsDbIDX++;
@@ -137,10 +136,10 @@
int errorCode = 0;
int availablePortsDbQTY = 0;
- if( ( errorCode = rrGetPortName( property, availablePortDir, availablePortName ) ) )
+ if( ( errorCode = MGPMrGetPortName( property, availablePortDir, availablePortName ) ) )
{
/*
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "rrGetPortName", errorCode );
+ fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrGetPortName", errorCode );
*/
return( 100 );
}
@@ -174,12 +173,12 @@
return( 0 );
}
-int rrGetPortName( structProperty* property, char* portDir, char* portName )
+int MGPMrGetPortName( structProperty* property, char* portDir, char* portName )
{
- DIR* dirStream = NULL;
+ FILE* fileStream = NULL;
FILE* makeStream = NULL;
char exact[] = "exact";
- char id[] = "rrGetPortName";
+ char id[] = "MGPMrGetPortName";
char* availablePortsDbPortNamePtr = NULL;
char* charPtr = NULL;
char* command = NULL;
@@ -195,22 +194,27 @@
if( availablePortsDbPortNamePtr == NULL )
{
- /*
- * see if this port has anything special in configDb
- */
- MGdbGoTop( property->configDb );
- optionsPtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, portDir, property->fieldConfigDbValue, exact );
+ MGdbGoTop( property->installedPortsDb );
+ if( MGdbSeek( property->installedPortsDb,
+ property->fieldInstalledPortsDbPortDir,
+ portDir,
+ property->fieldInstalledPortsDbPortName,
+ exact ) )
+ {
+ strcpy( portName, MGdbGet( property->installedPortsDb,
+ MGdbGetRecno( property->installedPortsDb ) - 1,
+ property->fieldInstalledPortsDbPortName ) );
+ }
+ else
+ {
+ portName[0] = 0;
+ }
strcpy( command, PORTSDIR );
strcat( command, portDir );
- dirStream = opendir( command );
- if( dirStream == 0 ) /* bad dir */
+ strcat( command, "/Makefile" );
+ fileStream = fopen( command, "r" );
+ if( fileStream == NULL || ( MGrFileSize( command ) < 10 ) ) /* no or empty Makefile */
{
- MGdbGoTop( property->installedPortsDb );
- strcpy( portName, MGdbSeek( property->installedPortsDb,
- property->fieldInstalledPortsDbPortDir,
- portDir,
- property->fieldInstalledPortsDbPortName,
- exact ) );
fprintf( stdout,"%s\n", SINGLE_LINES );
fprintf( stdout,
"%s %s is no longer in the ports collection, see /usr/ports/MOVED\nthis port must be removed for portmanager to continue\nis it OK to remove %s from your system? (yes/no/auto yes to all) [y/n/a] [y]\n",
@@ -275,16 +279,30 @@
strcpy( command, "pkg_delete -f " );
strcat( command, portName );
fprintf( stdout,"%s\n", command );
- fprintf( stdout,"%s\n", SINGLE_LINES );
while( fflush( stdout ) );
system( command );
+
+ strcpy( command, "rm -r " );
+ strcat( command, PORTSDIR );
+ strcat( command, portDir );
+ fprintf( stdout, "executing: %s\n", command );
+ while( fflush( stdout ) );
+ system( command );
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+
free( command );
return( 100 );
}
else
{
- closedir( dirStream );
+ fclose( fileStream );
}
+
+ /*
+ * see if this port has anything special in configDb
+ */
+ MGdbGoTop( property->configDb );
+ optionsPtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, portDir, property->fieldConfigDbValue, exact );
strcpy( command, "cd " );
strcat( command, PORTSDIR );
strcat( command, portDir );
@@ -493,7 +511,7 @@
{
assert(0);
}
- rrGetPortName( property, dependencyPortDir, dependencyPortName );
+ MGPMrGetPortName( property, dependencyPortDir, dependencyPortName );
/*
* add dependency to availableDependenciesDb may contain dupes
*/
diff -ruN ../0.3.4/libMGPM/src/MGPMrMakeDescribe.c ./libMGPM/src/MGPMrMakeDescribe.c
--- ../0.3.4/libMGPM/src/MGPMrMakeDescribe.c Mon Nov 7 16:46:00 2005
+++ ./libMGPM/src/MGPMrMakeDescribe.c Fri Nov 11 19:36:11 2005
@@ -90,11 +90,7 @@
if( MGdbSeek( property->cacheDb, property->fieldCacheDbPortDir, installedPortDir, property->fieldCacheDbPortDir, exact ) )
{
cacheIdx = MGdbGetRecno( property->cacheDb ) - 1;
- if( ( errorCode = MGdbDelete( property->cacheDb, cacheIdx ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- return( 1 );
- }
+ property->cacheDb = MGdbDelete( property->cacheDb, cacheIdx );
MGdbDestroy( property->cacheDb );
free( strMakeFile );
free( strMakeFileSize );
@@ -135,11 +131,7 @@
else
{
/* if here then Makefile time is wrong so delete the cache db record */
- if( ( errorCode = MGdbDelete( property->cacheDb, cacheIdx ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- return( 1 );
- }
+ property->cacheDb = MGdbDelete( property->cacheDb, cacheIdx );
cacheIdx = cacheQty;
break;
}
@@ -147,11 +139,7 @@
else
{
/* if here then Makefile size is wrong so delete the record */
- if( ( errorCode = MGdbDelete( property->cacheDb, cacheIdx ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- return( 1 );
- }
+ property->cacheDb = MGdbDelete( property->cacheDb, cacheIdx );
cacheIdx = cacheQty;
break;
}
diff -ruN ../0.3.4/libMGPM/src/MGPMrShowLeavesDelete.c ./libMGPM/src/MGPMrShowLeavesDelete.c
--- ../0.3.4/libMGPM/src/MGPMrShowLeavesDelete.c Thu Nov 10 19:38:55 2005
+++ ./libMGPM/src/MGPMrShowLeavesDelete.c Fri Nov 11 19:18:14 2005
@@ -31,7 +31,7 @@
#include <sgtty.h>
int nuke( char* leafPortDir );
-int rebuildDb( structProperty* property, int* installedPortsDbQTY );
+int rebuildDb( structProperty* property );
int removePort( structProperty* property, char* leafPortName, int installedPortsDbIDX );
int MGPMrShowLeavesDelete( structProperty* property )
@@ -42,8 +42,6 @@
char* leafPortDir = NULL;
char* leafPortName = NULL;
char* pkgDescFile = NULL;
- char* portDirPtr = NULL;
- char* portTypePtr = NULL;
int bufferSize = 0xffff;
int installedPortsDbIDX = 0;
int installedPortsDbQTY = 0;
@@ -68,13 +66,6 @@
return( 1 );
}
- if( ( property->dependencyPortsDb = MGdbOpen( property->dependencyPortsDbFileName ) ) == NULL )
- {
- fprintf( stdout, "%s %s error: failed to open %s\n", id, PACKAGE_VERSION, property->dependencyPortsDbFileName );
- perror( "system" );
- return( 1 );
- }
-
if( ( property->availableDependenciesDb = MGdbOpen( property->availableDependenciesDbFileName ) ) == NULL )
{
fprintf( stdout, "%s %s error: failed to open %s\n", id, PACKAGE_VERSION, property->availableDependenciesDbFileName );
@@ -104,145 +95,124 @@
}
/*
- * check for no run depends
+ * check for no dependencies
*/
- MGdbGoTop( property->dependencyPortsDb );
- portDirPtr = MGdbSeek( property->dependencyPortsDb,
- property->fieldDependencyDbDependencyPortDir,
- leafPortDir,
- property->fieldDependencyDbDependencyPortDir,
- exact );
-
- /*
- * check for no build depends
- */
- if( !portDirPtr )
+ MGdbGoTop( property->availableDependenciesDb );
+ if( MGdbSeek( property->availableDependenciesDb,
+ property->fieldAvailableDependenciesDbDependencyDir,
+ leafPortDir,
+ property->fieldAvailableDependenciesDbDependencyDir,
+ exact ) )
+ {
+ installedPortsDbIDX++;
+ continue;
+ }
+ if( key != KEY_ENTER )
{
- MGdbGoTop( property->availableDependenciesDb );
- portTypePtr = MGdbSeek( property->availableDependenciesDb,
- property->fieldAvailableDependenciesDbDependencyDir,
- leafPortDir,
- property->fieldAvailableDependenciesDbDependType,
- exact );
-
- while( portTypePtr && strcmp( portTypePtr, "BUILD_DEPENDS" ) )
- {
- portTypePtr = MGdbSeek( property->availableDependenciesDb,
- property->fieldAvailableDependenciesDbDependencyDir,
- leafPortDir,
- property->fieldAvailableDependenciesDbDependType,
- exact );
+ 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, "%s dir -=> %s\n\n", leafPortName, leafPortDir );
+ while( fflush( stdout ) );
+
+ strcpy( pkgDescFile, PORTSDIR );
+ strcat( pkgDescFile, leafPortDir );
+ strcat( pkgDescFile, "/pkg-descr" );
+
+ if( MGrIfFileExist( pkgDescFile ) )
+ {
+ strcpy( command, "cat " );
+ strcat( command, pkgDescFile );
+ system( command );
+ fprintf( stdout, "\n" );
+ }
+ else
+ {
+ strcpy( command, "grep COMMENT " );
+ strcat( command, PORTSDIR );
+ strcat( command, leafPortDir );
+ strcat( command, "/Makefile" );
+ system( command );
}
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "\n<SPACE><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( !portTypePtr && !portDirPtr )
+ key = getc( stdin );
+ switch( key )
{
- if( key != KEY_ENTER )
+ case KEY_ENTER:
+ {
+ continue;
+ }
+ case KEY_SPACE:
+ {
+ MGdbAdd( property->ignoreDb, leafPortDir, "-slid <SPACE> skipped", NULL );
+ fprintf( stdout, "<SPACE> Skipping %s\n\n", leafPortName );
+ break;
+ }
+ case KEY_n:
+ {
+ /* nuke() */
+ fprintf( stdout, "<n> Nuking %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
+ nuke( leafPortDir );
+ rebuildDb( property );
+ installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
+ installedPortsDbIDX = 1;
+ break;
+ }
+ case KEY_N:
+ {
+ /* nuke() */
+ fprintf( stdout, "<N> Nuking %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
+ nuke( leafPortDir );
+ rebuildDb( property );
+ installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
+ installedPortsDbIDX = 1;
+ break;
+ }
+ case KEY_x:
+ {
+ /* delete() */
+ fprintf( stdout, "<x> Removing %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
+ rebuildDb( property );
+ installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
+ installedPortsDbIDX = 1;
+ break;
+ }
+ case KEY_X:
{
- 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, "%s dir -=> %s\n\n", leafPortName, leafPortDir );
- while( fflush( stdout ) );
-
- strcpy( pkgDescFile, PORTSDIR );
- strcat( pkgDescFile, leafPortDir );
- strcat( pkgDescFile, "/pkg-descr" );
-
- if( MGrIfFileExist( pkgDescFile ) )
- {
- strcpy( command, "cat " );
- strcat( command, pkgDescFile );
- system( command );
- fprintf( stdout, "\n" );
- }
- else
- {
- strcpy( command, "grep COMMENT " );
- strcat( command, PORTSDIR );
- strcat( command, leafPortDir );
- strcat( command, "/Makefile" );
- system( command );
- }
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "\n<SPACE><ENTER> to skip\n<X><ENTER> removes port\n<N><ENTER> *Nuke it*, removes distribution files\n\n" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
+ /* delete() */
+ fprintf( stdout, "<X> Removing %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
+ rebuildDb( property );
+ installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
+ installedPortsDbIDX = 1;
+ break;
}
- key = getc( stdin );
- switch( key )
+ default:
{
- case KEY_ENTER:
- {
- continue;
- }
- case KEY_SPACE:
- {
- MGdbAdd( property->ignoreDb, leafPortDir, "-slid <SPACE> skipped", NULL );
- fprintf( stdout, "<SPACE> Skipping %s\n\n", leafPortName );
- break;
- }
- case KEY_n:
- {
- /* nuke() */
- fprintf( stdout, "<n> Nuking %s\n\n", leafPortName );
- removePort( property, leafPortName, installedPortsDbIDX );
- nuke( leafPortDir );
- rebuildDb( property, &installedPortsDbQTY );
- break;
- }
- case KEY_N:
- {
- /* nuke() */
- fprintf( stdout, "<N> Nuking %s\n\n", leafPortName );
- removePort( property, leafPortName, installedPortsDbIDX );
- nuke( leafPortDir );
- rebuildDb( property, &installedPortsDbQTY );
- installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
- installedPortsDbIDX = 1;
- break;
- }
- case KEY_x:
- {
- /* delete() */
- fprintf( stdout, "<x> Removing %s\n\n", leafPortName );
- removePort( property, leafPortName, installedPortsDbIDX );
- rebuildDb( property, &installedPortsDbQTY );
- installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
- installedPortsDbIDX = 1;
- break;
- }
- case KEY_X:
- {
- /* delete() */
- fprintf( stdout, "<X> Removing %s\n\n", leafPortName );
- removePort( property, leafPortName, installedPortsDbIDX );
- rebuildDb( property, &installedPortsDbQTY );
- installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
- installedPortsDbIDX = 1;
- break;
- }
- default:
- {
- MGdbAdd( property->ignoreDb, leafPortDir, "-slid <DEFAULT> skipped", NULL );
- fprintf( stdout, "Skipping %s\n\n", leafPortName );
- break;
- }
+ MGdbAdd( property->ignoreDb, leafPortDir, "-slid <DEFAULT> skipped", NULL );
+ fprintf( stdout, "Skipping %s\n\n", leafPortName );
+ break;
}
- fprintf( stdout, "\n" );
}
+ fprintf( stdout, "\n" );
installedPortsDbIDX++;
}
MGdbDestroy( property->availableDependenciesDb );
- MGdbDestroy( property->dependencyPortsDb );
MGdbDestroy( property->ignoreDb );
MGdbDestroy( property->installedPortsDb );
free( command );
@@ -260,18 +230,7 @@
command = (char*)calloc( 0xffff, 1 );
- MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
-
- MGdbGoTop( property->dependencyPortsDb );
- while( MGdbSeek( property->dependencyPortsDb,
- property->fieldDependencyDbPortName,
- leafPortNamePtr,
- property->fieldDependencyDbPortName,
- exact ) )
- {
- MGdbDelete( property->dependencyPortsDb, MGdbGetRecno( property->dependencyPortsDb ) - 1 );
- MGdbGoTop( property->dependencyPortsDb );
- }
+ property->installedPortsDb = MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
MGdbGoTop( property->availableDependenciesDb );
while( MGdbSeek( property->availableDependenciesDb,
@@ -280,7 +239,8 @@
property->fieldAvailableDependenciesDbPortName,
exact ) )
{
- MGdbDelete( property->availableDependenciesDb, MGdbGetRecno( property->availableDependenciesDb ) - 1 );
+ property->availableDependenciesDb = MGdbDelete( property->availableDependenciesDb,
+ MGdbGetRecno( property->availableDependenciesDb ) - 1 );
MGdbGoTop( property->availableDependenciesDb );
}
@@ -312,7 +272,7 @@
}
/***********************************************************************/
-int rebuildDb( structProperty* property, int* installedPortsDbQTY )
+int rebuildDb( structProperty* property )
{
char id[] = "rebuildDb";
@@ -321,7 +281,6 @@
fprintf( stdout,"%s\n", SINGLE_LINES );
while( fflush( stdout ) );
- MGdbDestroy( property->dependencyPortsDb );
MGdbDestroy( property->installedPortsDb );
if( MGPMrCreateInstalledDb( property ) )
{
@@ -335,12 +294,5 @@
return( 1 );
}
- if( ( property->dependencyPortsDb = MGdbOpen( property->dependencyPortsDbFileName ) ) == NULL )
- {
- fprintf( stdout, "%s %s error: failed to open %s\n", id, PACKAGE_VERSION, property->dependencyPortsDbFileName );
- perror( "system" );
- return( 1 );
- }
- *installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
return( 0 );
}
diff -ruN ../0.3.4/libMGPM/src/MGPMrSinglePortCreateStatusDb.c ./libMGPM/src/MGPMrSinglePortCreateStatusDb.c
--- ../0.3.4/libMGPM/src/MGPMrSinglePortCreateStatusDb.c Thu Nov 10 16:13:20 2005
+++ ./libMGPM/src/MGPMrSinglePortCreateStatusDb.c Fri Nov 11 18:28:43 2005
@@ -32,7 +32,7 @@
int rSinglePortUpgrade( structProperty* property, int forced );
int rDependencyParse( structProperty* property, char* buffer, char* availablePortName, char* availablePortDir, char* dependType, int* counterPtr );
int rFillDependencies( structProperty* property, char* availablePortName, char* availablePortDir, int* counterPtr );
-int rGetPortName( structProperty* property, char* portDir, char* portName );
+int MGPMrGetPortName( structProperty* property, char* portDir, char* portName );
int rParse( structProperty* property, char* availablePortName, char* availablePortDir, char* dependType, char* buffer, int* counterPtr );
int MGPMrSinglePortCreateStatusDb( structProperty* property, char* portDir )
@@ -100,11 +100,12 @@
property->availableDependenciesDb = MGdbOpen( property->availableDependenciesDbFileName );
property->configDb = MGdbOpen( property->configDbFileName );
+ property->installedPortsDb = MGdbOpen( property->installedPortsDbFileName );
}
- if( ( errorCode = rGetPortName( property, availablePortDir, availablePortName ) ) )
+ if( ( errorCode = MGPMrGetPortName( property, availablePortDir, availablePortName ) ) )
{
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "rGetPortName", errorCode );
+ fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrGetPortName", errorCode );
return( 1 );
}
@@ -148,6 +149,7 @@
}
if( property->optionsChanged == 0 ) /* set by MGPMrUpdate for example to indicate a ports's options just changed */
{
+ MGdbDestroy( property->installedPortsDb );
MGdbDestroy( property->availablePortsDb );
MGdbDestroy( property->availableDependenciesDb );
MGdbDestroy( property->configDb );
@@ -157,76 +159,6 @@
return( 0 );
}
-int rGetPortName( structProperty* property, char* portDir, char* portName )
-{
- FILE* makeStream = NULL;
- char exact[] = "exact";
- char id[] = "rGetPortName";
- char* availablePortsDbPortNamePtr = NULL;
- char* charPtr = NULL;
- char* command = NULL;
- char* optionsPtr = NULL;
- int bufferSize = 0xffff;
-
- command = (char*)calloc( bufferSize, 1 );
-
- MGdbGoTop( property->availablePortsDb );
- availablePortsDbPortNamePtr = MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, portDir,
- property->fieldAvailablePortsDbPortName, exact );
-
- if( availablePortsDbPortNamePtr == NULL )
- {
- /*
- * see if this port has anything special in configDb
- */
- MGdbGoTop( property->configDb );
- optionsPtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, portDir, property->fieldConfigDbValue, exact );
- strcpy( command, "cd " );
- strcat( command, PORTSDIR );
- strcat( command, portDir );
- strcat( command, "; make " );
- strcat( command, " -V PKGNAME " );
- if( optionsPtr )
- {
- strcat( command, optionsPtr );
- }
- makeStream = popen( command, "r" );
- if( makeStream == 0 )
- {
- fprintf( stdout, "%s error: reading make -V PKGNAME into availablePortName\n", id );
- perror( "system message" );
- return( 1 );
- }
- portName[0] = 0;
- fread( portName, bufferSize-1, 1, makeStream );
- if( portName == NULL )
- {
- fprintf( stdout, "%s error: reading make -V PKGNAME into availablePortName\n", id );
- perror( "system message" );
- return( 1 );
- }
- charPtr = portName;
- while( charPtr < portName + (bufferSize-1) )
- {
- if( charPtr[0] == SPACE || charPtr[0] == TAB || charPtr[0] == LINEFEED || charPtr[0] == ':' )
- {
- charPtr[0] = 0;
- break;
- }
- charPtr++;
- }
- pclose( makeStream );
- }
- else
- {
- MGdbGoTop( property->availablePortsDb );
- strcpy( portName, MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, portDir,
- property->fieldAvailablePortsDbPortName, exact ) );
- }
- free( command );
- return( 0 );
-}
-
int rFillDependencies( structProperty* property, char* availablePortName, char* availablePortDir, int* counterPtr )
{
char BUILD_DEPENDS[] = "BUILD_DEPENDS";
@@ -382,7 +314,7 @@
{
assert(0);
}
- rGetPortName( property, dependencyPortDir, dependencyPortName );
+ MGPMrGetPortName( property, dependencyPortDir, dependencyPortName );
/*
* add dependency to availableDependenciesDb may contain dupes
*/
diff -ruN ../0.3.4/libMGPM/src/MGPMrStatus.c ./libMGPM/src/MGPMrStatus.c
--- ../0.3.4/libMGPM/src/MGPMrStatus.c Mon Nov 7 16:46:00 2005
+++ ./libMGPM/src/MGPMrStatus.c Fri Nov 11 19:37:57 2005
@@ -110,12 +110,7 @@
/*
* since installedPortName is no longer in ports collection need to delete record and restart
*/
- if( ( errorCode = MGdbDelete( property->installedPortsDb, installedPortsDbIDX ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- return( 1 );
- }
-
+ property->installedPortsDb = MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
installedPortsDbIDX = 1;
while( fflush( stdout ) );
diff -ruN ../0.3.4/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c
--- ../0.3.4/libMGPM/src/MGPMrUpdate.c Thu Nov 10 18:58:41 2005
+++ ./libMGPM/src/MGPMrUpdate.c Fri Nov 11 19:34:03 2005
@@ -461,7 +461,8 @@
MGdbGetRecno( property->availableDependenciesDb ) - 1,
property->fieldAvailableDependenciesDbDependencyName ) );
while( fflush( stdout ) );
- MGdbDelete( property->availableDependenciesDb, MGdbGetRecno( property->availableDependenciesDb ) - 1 );
+ property->availableDependenciesDb = MGdbDelete( property->availableDependenciesDb,
+ MGdbGetRecno( property->availableDependenciesDb ) - 1 );
MGdbGoTop( property->availableDependenciesDb );
}
/*
@@ -1521,7 +1522,7 @@
strcat( curDir, "; make -V .CURDIR" );
buffer[0] = 0;
pHandle = popen( curDir, "r" );
- fread( buffer, 255, 1, pHandle );
+ fread( buffer, bufferSize, 1, pHandle );
pclose( pHandle );
idx = 0;
while( idx < 255 )
@@ -1535,18 +1536,21 @@
}
strcpy( curDir, buffer );
- strcpy( command, "rm -r " );
+ strcpy( command, "/bin/rm -r " );
strcat( command, workDir );
strcat( command, curDir );
+
+ strcat( command, "/work 2>&1" );
/*
- strcat( command, "/work >/dev/null 2>&1" );
+ strcat( command, "/work" );
*/
-strcat( command, "/work" );
fprintf( stdout, "===> Cleaning for %s\n", portDir );
-fprintf( stdout, " %s\n", command );
while( fflush( stdout ) );
- system( command );
+ buffer[0] = 0;
+ pHandle = popen( command, "r" );
+ fread( buffer, bufferSize, 1, pHandle );
+ pclose( pHandle );
free( buffer );
free( command );
free( curDir );
diff -ruN ../0.3.4/libMGPM/src/libMGPM.h ./libMGPM/src/libMGPM.h
--- ../0.3.4/libMGPM/src/libMGPM.h Thu Nov 10 15:19:26 2005
+++ ./libMGPM/src/libMGPM.h Fri Nov 11 18:01:02 2005
@@ -181,6 +181,7 @@
} structProperty;
+int MGPMrGetPortName( structProperty* property, char* portDir, char* portName ); /* located in MGPMrCreateAllUpdateStatusDb.c */
int MGPMrBestOldPort( structProperty* property, char* oldPortDir, char* oldPortName );
int MGPMrCleanUp( structProperty* property );
int MGPMrCommandLine( int argc, char** argv );
diff -ruN ../0.3.4/portmanager/pkgtools-to-portmanager.rb ./portmanager/pkgtools-to-portmanager.rb
--- ../0.3.4/portmanager/pkgtools-to-portmanager.rb Wed Dec 31 16:00:00 1969
+++ ./portmanager/pkgtools-to-portmanager.rb Fri Nov 11 20:54:26 2005
@@ -0,0 +1,59 @@
+#!/usr/local/bin/ruby
+
+require "pkgtools"
+
+puts "CATEGORY/PORT|OPTION=| # do not delete this line!"
+
+load_config
+
+
+# held packages
+
+puts ""
+puts "# Ignored packages from HOLD_PKGS"
+puts ""
+
+config_value(:HOLD_PKGS).each do |pkg|
+
+ puts "IGNORE|" + pkg + "|"
+
+end
+
+
+# beforebuild becomes stop
+
+puts ""
+puts "# STOP entries come from BEFOREBUILD"
+puts ""
+
+config_value(:BEFOREBUILD).each do |pkg|
+
+ puts "STOP|/" + pkg[0] + " " + pkg[1] + "|"
+
+end
+
+# afterinstall becomes start
+
+puts ""
+puts "# START entries come from AFTERINSTALL"
+puts ""
+
+config_value(:AFTERINSTALL).each do |pkg|
+
+ puts "START|/" + pkg[0] + " " + pkg[1] + "|"
+
+end
+
+# package options.
+
+
+puts ""
+puts "# Package options from MAKE_ARGS"
+puts "# Note: pkgtools.conf will use the UNION of all matching lines"
+puts ""
+
+config_value(:MAKE_ARGS).each do |pkg|
+
+ puts pkg[0] + "|" + pkg[1] + "|"
+
+end
diff -ruN ../0.3.4/programmer-notes.txt ./programmer-notes.txt
--- ../0.3.4/programmer-notes.txt Fri Nov 11 05:41:28 2005
+++ ./programmer-notes.txt Fri Nov 11 20:56:23 2005
@@ -2,6 +2,8 @@
TODO list
+ add pkgtools-to-portmanager.rb to tarball
+ move MGPMrGetPortName from MGPMrCreateAllUpdateStatusDb.c next new tarball to its own file
move database files to /var/db/portmanager
test in 6.0
use signal to abort only current build?

View File

@ -7,6 +7,7 @@
PORTNAME= portmanager
PORTVERSION= 0.3.4
PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= http://portmanager.sunsite.dk/distfiles/ \
${MASTER_SITE_SOURCEFORGE}

View File

@ -0,0 +1,830 @@
diff -ruN ../0.3.4/externVars.h.in ./externVars.h.in
--- ../0.3.4/externVars.h.in Fri Nov 11 06:31:14 2005
+++ ./externVars.h.in Fri Nov 11 19:38:50 2005
@@ -78,13 +78,13 @@
#define PACKAGE_NAME "portmanager"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "portmanager 0.3.4"
+#define PACKAGE_STRING "portmanager 0.3.5"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "portmanager"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.3.4"
+#define PACKAGE_VERSION "0.3.5"
/* location of ports registry, default is /var/db/pkg */
#define PKGDBDIR "@PKGDBDIR@"
diff -ruN ../0.3.4/libMG/src/MGdbAdd.c ./libMG/src/MGdbAdd.c
--- ../0.3.4/libMG/src/MGdbAdd.c Mon Nov 7 16:46:00 2005
+++ ./libMG/src/MGdbAdd.c Fri Nov 11 17:23:26 2005
@@ -58,6 +58,14 @@
{
break;
}
+
+ /*
+ * prevent null data from being placed into record fields
+ */
+ if( strlen( paramPtr ) < 1 )
+ {
+ assert(0);
+ }
fprintf( dbFileStream, "%s%c", paramPtr, 0 );
/*
diff -ruN ../0.3.4/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c
--- ../0.3.4/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Thu Nov 10 16:12:52 2005
+++ ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Fri Nov 11 19:30:42 2005
@@ -32,7 +32,6 @@
int rrDependencyParse( structProperty* property, char* buffer, char* availablePortName, char* availablePortDir, char* dependType, int* counterPtr );
int rrFillDependencies( structProperty* property, char* availablePortName, char* availablePortDir, int* counterPtr );
int rrFindDepends( structProperty* property, char* availablePortDir, char* availablePortName, int* counterPtr );
-int rrGetPortName( structProperty* property, char* portDir, char* portName );
int rrParse( structProperty* property, char* availablePortName, char* availablePortDir, char* dependType, char* buffer, int* counterPtr );
int MGPMrCreateAllUpdateStatusDb( structProperty* property )
@@ -116,7 +115,7 @@
strcpy( availablePortDir, installedPortsDbPortDirPtr );
if( ( errorCode = rrFindDepends( property, availablePortDir, availablePortName, counterPtr ) ) == 100 )
{
- MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
+ property->installedPortsDb = MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
installedPortsDbQTY--;
}
installedPortsDbIDX++;
@@ -137,10 +136,10 @@
int errorCode = 0;
int availablePortsDbQTY = 0;
- if( ( errorCode = rrGetPortName( property, availablePortDir, availablePortName ) ) )
+ if( ( errorCode = MGPMrGetPortName( property, availablePortDir, availablePortName ) ) )
{
/*
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "rrGetPortName", errorCode );
+ fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrGetPortName", errorCode );
*/
return( 100 );
}
@@ -174,12 +173,12 @@
return( 0 );
}
-int rrGetPortName( structProperty* property, char* portDir, char* portName )
+int MGPMrGetPortName( structProperty* property, char* portDir, char* portName )
{
- DIR* dirStream = NULL;
+ FILE* fileStream = NULL;
FILE* makeStream = NULL;
char exact[] = "exact";
- char id[] = "rrGetPortName";
+ char id[] = "MGPMrGetPortName";
char* availablePortsDbPortNamePtr = NULL;
char* charPtr = NULL;
char* command = NULL;
@@ -195,22 +194,27 @@
if( availablePortsDbPortNamePtr == NULL )
{
- /*
- * see if this port has anything special in configDb
- */
- MGdbGoTop( property->configDb );
- optionsPtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, portDir, property->fieldConfigDbValue, exact );
+ MGdbGoTop( property->installedPortsDb );
+ if( MGdbSeek( property->installedPortsDb,
+ property->fieldInstalledPortsDbPortDir,
+ portDir,
+ property->fieldInstalledPortsDbPortName,
+ exact ) )
+ {
+ strcpy( portName, MGdbGet( property->installedPortsDb,
+ MGdbGetRecno( property->installedPortsDb ) - 1,
+ property->fieldInstalledPortsDbPortName ) );
+ }
+ else
+ {
+ portName[0] = 0;
+ }
strcpy( command, PORTSDIR );
strcat( command, portDir );
- dirStream = opendir( command );
- if( dirStream == 0 ) /* bad dir */
+ strcat( command, "/Makefile" );
+ fileStream = fopen( command, "r" );
+ if( fileStream == NULL || ( MGrFileSize( command ) < 10 ) ) /* no or empty Makefile */
{
- MGdbGoTop( property->installedPortsDb );
- strcpy( portName, MGdbSeek( property->installedPortsDb,
- property->fieldInstalledPortsDbPortDir,
- portDir,
- property->fieldInstalledPortsDbPortName,
- exact ) );
fprintf( stdout,"%s\n", SINGLE_LINES );
fprintf( stdout,
"%s %s is no longer in the ports collection, see /usr/ports/MOVED\nthis port must be removed for portmanager to continue\nis it OK to remove %s from your system? (yes/no/auto yes to all) [y/n/a] [y]\n",
@@ -275,16 +279,30 @@
strcpy( command, "pkg_delete -f " );
strcat( command, portName );
fprintf( stdout,"%s\n", command );
- fprintf( stdout,"%s\n", SINGLE_LINES );
while( fflush( stdout ) );
system( command );
+
+ strcpy( command, "rm -r " );
+ strcat( command, PORTSDIR );
+ strcat( command, portDir );
+ fprintf( stdout, "executing: %s\n", command );
+ while( fflush( stdout ) );
+ system( command );
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+
free( command );
return( 100 );
}
else
{
- closedir( dirStream );
+ fclose( fileStream );
}
+
+ /*
+ * see if this port has anything special in configDb
+ */
+ MGdbGoTop( property->configDb );
+ optionsPtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, portDir, property->fieldConfigDbValue, exact );
strcpy( command, "cd " );
strcat( command, PORTSDIR );
strcat( command, portDir );
@@ -493,7 +511,7 @@
{
assert(0);
}
- rrGetPortName( property, dependencyPortDir, dependencyPortName );
+ MGPMrGetPortName( property, dependencyPortDir, dependencyPortName );
/*
* add dependency to availableDependenciesDb may contain dupes
*/
diff -ruN ../0.3.4/libMGPM/src/MGPMrMakeDescribe.c ./libMGPM/src/MGPMrMakeDescribe.c
--- ../0.3.4/libMGPM/src/MGPMrMakeDescribe.c Mon Nov 7 16:46:00 2005
+++ ./libMGPM/src/MGPMrMakeDescribe.c Fri Nov 11 19:36:11 2005
@@ -90,11 +90,7 @@
if( MGdbSeek( property->cacheDb, property->fieldCacheDbPortDir, installedPortDir, property->fieldCacheDbPortDir, exact ) )
{
cacheIdx = MGdbGetRecno( property->cacheDb ) - 1;
- if( ( errorCode = MGdbDelete( property->cacheDb, cacheIdx ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- return( 1 );
- }
+ property->cacheDb = MGdbDelete( property->cacheDb, cacheIdx );
MGdbDestroy( property->cacheDb );
free( strMakeFile );
free( strMakeFileSize );
@@ -135,11 +131,7 @@
else
{
/* if here then Makefile time is wrong so delete the cache db record */
- if( ( errorCode = MGdbDelete( property->cacheDb, cacheIdx ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- return( 1 );
- }
+ property->cacheDb = MGdbDelete( property->cacheDb, cacheIdx );
cacheIdx = cacheQty;
break;
}
@@ -147,11 +139,7 @@
else
{
/* if here then Makefile size is wrong so delete the record */
- if( ( errorCode = MGdbDelete( property->cacheDb, cacheIdx ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- return( 1 );
- }
+ property->cacheDb = MGdbDelete( property->cacheDb, cacheIdx );
cacheIdx = cacheQty;
break;
}
diff -ruN ../0.3.4/libMGPM/src/MGPMrShowLeavesDelete.c ./libMGPM/src/MGPMrShowLeavesDelete.c
--- ../0.3.4/libMGPM/src/MGPMrShowLeavesDelete.c Thu Nov 10 19:38:55 2005
+++ ./libMGPM/src/MGPMrShowLeavesDelete.c Fri Nov 11 19:18:14 2005
@@ -31,7 +31,7 @@
#include <sgtty.h>
int nuke( char* leafPortDir );
-int rebuildDb( structProperty* property, int* installedPortsDbQTY );
+int rebuildDb( structProperty* property );
int removePort( structProperty* property, char* leafPortName, int installedPortsDbIDX );
int MGPMrShowLeavesDelete( structProperty* property )
@@ -42,8 +42,6 @@
char* leafPortDir = NULL;
char* leafPortName = NULL;
char* pkgDescFile = NULL;
- char* portDirPtr = NULL;
- char* portTypePtr = NULL;
int bufferSize = 0xffff;
int installedPortsDbIDX = 0;
int installedPortsDbQTY = 0;
@@ -68,13 +66,6 @@
return( 1 );
}
- if( ( property->dependencyPortsDb = MGdbOpen( property->dependencyPortsDbFileName ) ) == NULL )
- {
- fprintf( stdout, "%s %s error: failed to open %s\n", id, PACKAGE_VERSION, property->dependencyPortsDbFileName );
- perror( "system" );
- return( 1 );
- }
-
if( ( property->availableDependenciesDb = MGdbOpen( property->availableDependenciesDbFileName ) ) == NULL )
{
fprintf( stdout, "%s %s error: failed to open %s\n", id, PACKAGE_VERSION, property->availableDependenciesDbFileName );
@@ -104,145 +95,124 @@
}
/*
- * check for no run depends
+ * check for no dependencies
*/
- MGdbGoTop( property->dependencyPortsDb );
- portDirPtr = MGdbSeek( property->dependencyPortsDb,
- property->fieldDependencyDbDependencyPortDir,
- leafPortDir,
- property->fieldDependencyDbDependencyPortDir,
- exact );
-
- /*
- * check for no build depends
- */
- if( !portDirPtr )
+ MGdbGoTop( property->availableDependenciesDb );
+ if( MGdbSeek( property->availableDependenciesDb,
+ property->fieldAvailableDependenciesDbDependencyDir,
+ leafPortDir,
+ property->fieldAvailableDependenciesDbDependencyDir,
+ exact ) )
+ {
+ installedPortsDbIDX++;
+ continue;
+ }
+ if( key != KEY_ENTER )
{
- MGdbGoTop( property->availableDependenciesDb );
- portTypePtr = MGdbSeek( property->availableDependenciesDb,
- property->fieldAvailableDependenciesDbDependencyDir,
- leafPortDir,
- property->fieldAvailableDependenciesDbDependType,
- exact );
-
- while( portTypePtr && strcmp( portTypePtr, "BUILD_DEPENDS" ) )
- {
- portTypePtr = MGdbSeek( property->availableDependenciesDb,
- property->fieldAvailableDependenciesDbDependencyDir,
- leafPortDir,
- property->fieldAvailableDependenciesDbDependType,
- exact );
+ 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, "%s dir -=> %s\n\n", leafPortName, leafPortDir );
+ while( fflush( stdout ) );
+
+ strcpy( pkgDescFile, PORTSDIR );
+ strcat( pkgDescFile, leafPortDir );
+ strcat( pkgDescFile, "/pkg-descr" );
+
+ if( MGrIfFileExist( pkgDescFile ) )
+ {
+ strcpy( command, "cat " );
+ strcat( command, pkgDescFile );
+ system( command );
+ fprintf( stdout, "\n" );
+ }
+ else
+ {
+ strcpy( command, "grep COMMENT " );
+ strcat( command, PORTSDIR );
+ strcat( command, leafPortDir );
+ strcat( command, "/Makefile" );
+ system( command );
}
+ fprintf( stdout,"%s\n", SINGLE_LINES );
+ fprintf( stdout, "\n<SPACE><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( !portTypePtr && !portDirPtr )
+ key = getc( stdin );
+ switch( key )
{
- if( key != KEY_ENTER )
+ case KEY_ENTER:
+ {
+ continue;
+ }
+ case KEY_SPACE:
+ {
+ MGdbAdd( property->ignoreDb, leafPortDir, "-slid <SPACE> skipped", NULL );
+ fprintf( stdout, "<SPACE> Skipping %s\n\n", leafPortName );
+ break;
+ }
+ case KEY_n:
+ {
+ /* nuke() */
+ fprintf( stdout, "<n> Nuking %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
+ nuke( leafPortDir );
+ rebuildDb( property );
+ installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
+ installedPortsDbIDX = 1;
+ break;
+ }
+ case KEY_N:
+ {
+ /* nuke() */
+ fprintf( stdout, "<N> Nuking %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
+ nuke( leafPortDir );
+ rebuildDb( property );
+ installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
+ installedPortsDbIDX = 1;
+ break;
+ }
+ case KEY_x:
+ {
+ /* delete() */
+ fprintf( stdout, "<x> Removing %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
+ rebuildDb( property );
+ installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
+ installedPortsDbIDX = 1;
+ break;
+ }
+ case KEY_X:
{
- 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, "%s dir -=> %s\n\n", leafPortName, leafPortDir );
- while( fflush( stdout ) );
-
- strcpy( pkgDescFile, PORTSDIR );
- strcat( pkgDescFile, leafPortDir );
- strcat( pkgDescFile, "/pkg-descr" );
-
- if( MGrIfFileExist( pkgDescFile ) )
- {
- strcpy( command, "cat " );
- strcat( command, pkgDescFile );
- system( command );
- fprintf( stdout, "\n" );
- }
- else
- {
- strcpy( command, "grep COMMENT " );
- strcat( command, PORTSDIR );
- strcat( command, leafPortDir );
- strcat( command, "/Makefile" );
- system( command );
- }
- fprintf( stdout,"%s\n", SINGLE_LINES );
- fprintf( stdout, "\n<SPACE><ENTER> to skip\n<X><ENTER> removes port\n<N><ENTER> *Nuke it*, removes distribution files\n\n" );
- fprintf( stdout,"%s\n", SINGLE_LINES );
+ /* delete() */
+ fprintf( stdout, "<X> Removing %s\n\n", leafPortName );
+ removePort( property, leafPortName, installedPortsDbIDX );
+ rebuildDb( property );
+ installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
+ installedPortsDbIDX = 1;
+ break;
}
- key = getc( stdin );
- switch( key )
+ default:
{
- case KEY_ENTER:
- {
- continue;
- }
- case KEY_SPACE:
- {
- MGdbAdd( property->ignoreDb, leafPortDir, "-slid <SPACE> skipped", NULL );
- fprintf( stdout, "<SPACE> Skipping %s\n\n", leafPortName );
- break;
- }
- case KEY_n:
- {
- /* nuke() */
- fprintf( stdout, "<n> Nuking %s\n\n", leafPortName );
- removePort( property, leafPortName, installedPortsDbIDX );
- nuke( leafPortDir );
- rebuildDb( property, &installedPortsDbQTY );
- break;
- }
- case KEY_N:
- {
- /* nuke() */
- fprintf( stdout, "<N> Nuking %s\n\n", leafPortName );
- removePort( property, leafPortName, installedPortsDbIDX );
- nuke( leafPortDir );
- rebuildDb( property, &installedPortsDbQTY );
- installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
- installedPortsDbIDX = 1;
- break;
- }
- case KEY_x:
- {
- /* delete() */
- fprintf( stdout, "<x> Removing %s\n\n", leafPortName );
- removePort( property, leafPortName, installedPortsDbIDX );
- rebuildDb( property, &installedPortsDbQTY );
- installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
- installedPortsDbIDX = 1;
- break;
- }
- case KEY_X:
- {
- /* delete() */
- fprintf( stdout, "<X> Removing %s\n\n", leafPortName );
- removePort( property, leafPortName, installedPortsDbIDX );
- rebuildDb( property, &installedPortsDbQTY );
- installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
- installedPortsDbIDX = 1;
- break;
- }
- default:
- {
- MGdbAdd( property->ignoreDb, leafPortDir, "-slid <DEFAULT> skipped", NULL );
- fprintf( stdout, "Skipping %s\n\n", leafPortName );
- break;
- }
+ MGdbAdd( property->ignoreDb, leafPortDir, "-slid <DEFAULT> skipped", NULL );
+ fprintf( stdout, "Skipping %s\n\n", leafPortName );
+ break;
}
- fprintf( stdout, "\n" );
}
+ fprintf( stdout, "\n" );
installedPortsDbIDX++;
}
MGdbDestroy( property->availableDependenciesDb );
- MGdbDestroy( property->dependencyPortsDb );
MGdbDestroy( property->ignoreDb );
MGdbDestroy( property->installedPortsDb );
free( command );
@@ -260,18 +230,7 @@
command = (char*)calloc( 0xffff, 1 );
- MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
-
- MGdbGoTop( property->dependencyPortsDb );
- while( MGdbSeek( property->dependencyPortsDb,
- property->fieldDependencyDbPortName,
- leafPortNamePtr,
- property->fieldDependencyDbPortName,
- exact ) )
- {
- MGdbDelete( property->dependencyPortsDb, MGdbGetRecno( property->dependencyPortsDb ) - 1 );
- MGdbGoTop( property->dependencyPortsDb );
- }
+ property->installedPortsDb = MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
MGdbGoTop( property->availableDependenciesDb );
while( MGdbSeek( property->availableDependenciesDb,
@@ -280,7 +239,8 @@
property->fieldAvailableDependenciesDbPortName,
exact ) )
{
- MGdbDelete( property->availableDependenciesDb, MGdbGetRecno( property->availableDependenciesDb ) - 1 );
+ property->availableDependenciesDb = MGdbDelete( property->availableDependenciesDb,
+ MGdbGetRecno( property->availableDependenciesDb ) - 1 );
MGdbGoTop( property->availableDependenciesDb );
}
@@ -312,7 +272,7 @@
}
/***********************************************************************/
-int rebuildDb( structProperty* property, int* installedPortsDbQTY )
+int rebuildDb( structProperty* property )
{
char id[] = "rebuildDb";
@@ -321,7 +281,6 @@
fprintf( stdout,"%s\n", SINGLE_LINES );
while( fflush( stdout ) );
- MGdbDestroy( property->dependencyPortsDb );
MGdbDestroy( property->installedPortsDb );
if( MGPMrCreateInstalledDb( property ) )
{
@@ -335,12 +294,5 @@
return( 1 );
}
- if( ( property->dependencyPortsDb = MGdbOpen( property->dependencyPortsDbFileName ) ) == NULL )
- {
- fprintf( stdout, "%s %s error: failed to open %s\n", id, PACKAGE_VERSION, property->dependencyPortsDbFileName );
- perror( "system" );
- return( 1 );
- }
- *installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
return( 0 );
}
diff -ruN ../0.3.4/libMGPM/src/MGPMrSinglePortCreateStatusDb.c ./libMGPM/src/MGPMrSinglePortCreateStatusDb.c
--- ../0.3.4/libMGPM/src/MGPMrSinglePortCreateStatusDb.c Thu Nov 10 16:13:20 2005
+++ ./libMGPM/src/MGPMrSinglePortCreateStatusDb.c Fri Nov 11 18:28:43 2005
@@ -32,7 +32,7 @@
int rSinglePortUpgrade( structProperty* property, int forced );
int rDependencyParse( structProperty* property, char* buffer, char* availablePortName, char* availablePortDir, char* dependType, int* counterPtr );
int rFillDependencies( structProperty* property, char* availablePortName, char* availablePortDir, int* counterPtr );
-int rGetPortName( structProperty* property, char* portDir, char* portName );
+int MGPMrGetPortName( structProperty* property, char* portDir, char* portName );
int rParse( structProperty* property, char* availablePortName, char* availablePortDir, char* dependType, char* buffer, int* counterPtr );
int MGPMrSinglePortCreateStatusDb( structProperty* property, char* portDir )
@@ -100,11 +100,12 @@
property->availableDependenciesDb = MGdbOpen( property->availableDependenciesDbFileName );
property->configDb = MGdbOpen( property->configDbFileName );
+ property->installedPortsDb = MGdbOpen( property->installedPortsDbFileName );
}
- if( ( errorCode = rGetPortName( property, availablePortDir, availablePortName ) ) )
+ if( ( errorCode = MGPMrGetPortName( property, availablePortDir, availablePortName ) ) )
{
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "rGetPortName", errorCode );
+ fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrGetPortName", errorCode );
return( 1 );
}
@@ -148,6 +149,7 @@
}
if( property->optionsChanged == 0 ) /* set by MGPMrUpdate for example to indicate a ports's options just changed */
{
+ MGdbDestroy( property->installedPortsDb );
MGdbDestroy( property->availablePortsDb );
MGdbDestroy( property->availableDependenciesDb );
MGdbDestroy( property->configDb );
@@ -157,76 +159,6 @@
return( 0 );
}
-int rGetPortName( structProperty* property, char* portDir, char* portName )
-{
- FILE* makeStream = NULL;
- char exact[] = "exact";
- char id[] = "rGetPortName";
- char* availablePortsDbPortNamePtr = NULL;
- char* charPtr = NULL;
- char* command = NULL;
- char* optionsPtr = NULL;
- int bufferSize = 0xffff;
-
- command = (char*)calloc( bufferSize, 1 );
-
- MGdbGoTop( property->availablePortsDb );
- availablePortsDbPortNamePtr = MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, portDir,
- property->fieldAvailablePortsDbPortName, exact );
-
- if( availablePortsDbPortNamePtr == NULL )
- {
- /*
- * see if this port has anything special in configDb
- */
- MGdbGoTop( property->configDb );
- optionsPtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, portDir, property->fieldConfigDbValue, exact );
- strcpy( command, "cd " );
- strcat( command, PORTSDIR );
- strcat( command, portDir );
- strcat( command, "; make " );
- strcat( command, " -V PKGNAME " );
- if( optionsPtr )
- {
- strcat( command, optionsPtr );
- }
- makeStream = popen( command, "r" );
- if( makeStream == 0 )
- {
- fprintf( stdout, "%s error: reading make -V PKGNAME into availablePortName\n", id );
- perror( "system message" );
- return( 1 );
- }
- portName[0] = 0;
- fread( portName, bufferSize-1, 1, makeStream );
- if( portName == NULL )
- {
- fprintf( stdout, "%s error: reading make -V PKGNAME into availablePortName\n", id );
- perror( "system message" );
- return( 1 );
- }
- charPtr = portName;
- while( charPtr < portName + (bufferSize-1) )
- {
- if( charPtr[0] == SPACE || charPtr[0] == TAB || charPtr[0] == LINEFEED || charPtr[0] == ':' )
- {
- charPtr[0] = 0;
- break;
- }
- charPtr++;
- }
- pclose( makeStream );
- }
- else
- {
- MGdbGoTop( property->availablePortsDb );
- strcpy( portName, MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, portDir,
- property->fieldAvailablePortsDbPortName, exact ) );
- }
- free( command );
- return( 0 );
-}
-
int rFillDependencies( structProperty* property, char* availablePortName, char* availablePortDir, int* counterPtr )
{
char BUILD_DEPENDS[] = "BUILD_DEPENDS";
@@ -382,7 +314,7 @@
{
assert(0);
}
- rGetPortName( property, dependencyPortDir, dependencyPortName );
+ MGPMrGetPortName( property, dependencyPortDir, dependencyPortName );
/*
* add dependency to availableDependenciesDb may contain dupes
*/
diff -ruN ../0.3.4/libMGPM/src/MGPMrStatus.c ./libMGPM/src/MGPMrStatus.c
--- ../0.3.4/libMGPM/src/MGPMrStatus.c Mon Nov 7 16:46:00 2005
+++ ./libMGPM/src/MGPMrStatus.c Fri Nov 11 19:37:57 2005
@@ -110,12 +110,7 @@
/*
* since installedPortName is no longer in ports collection need to delete record and restart
*/
- if( ( errorCode = MGdbDelete( property->installedPortsDb, installedPortsDbIDX ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode );
- return( 1 );
- }
-
+ property->installedPortsDb = MGdbDelete( property->installedPortsDb, installedPortsDbIDX );
installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb );
installedPortsDbIDX = 1;
while( fflush( stdout ) );
diff -ruN ../0.3.4/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c
--- ../0.3.4/libMGPM/src/MGPMrUpdate.c Thu Nov 10 18:58:41 2005
+++ ./libMGPM/src/MGPMrUpdate.c Fri Nov 11 19:34:03 2005
@@ -461,7 +461,8 @@
MGdbGetRecno( property->availableDependenciesDb ) - 1,
property->fieldAvailableDependenciesDbDependencyName ) );
while( fflush( stdout ) );
- MGdbDelete( property->availableDependenciesDb, MGdbGetRecno( property->availableDependenciesDb ) - 1 );
+ property->availableDependenciesDb = MGdbDelete( property->availableDependenciesDb,
+ MGdbGetRecno( property->availableDependenciesDb ) - 1 );
MGdbGoTop( property->availableDependenciesDb );
}
/*
@@ -1521,7 +1522,7 @@
strcat( curDir, "; make -V .CURDIR" );
buffer[0] = 0;
pHandle = popen( curDir, "r" );
- fread( buffer, 255, 1, pHandle );
+ fread( buffer, bufferSize, 1, pHandle );
pclose( pHandle );
idx = 0;
while( idx < 255 )
@@ -1535,18 +1536,21 @@
}
strcpy( curDir, buffer );
- strcpy( command, "rm -r " );
+ strcpy( command, "/bin/rm -r " );
strcat( command, workDir );
strcat( command, curDir );
+
+ strcat( command, "/work 2>&1" );
/*
- strcat( command, "/work >/dev/null 2>&1" );
+ strcat( command, "/work" );
*/
-strcat( command, "/work" );
fprintf( stdout, "===> Cleaning for %s\n", portDir );
-fprintf( stdout, " %s\n", command );
while( fflush( stdout ) );
- system( command );
+ buffer[0] = 0;
+ pHandle = popen( command, "r" );
+ fread( buffer, bufferSize, 1, pHandle );
+ pclose( pHandle );
free( buffer );
free( command );
free( curDir );
diff -ruN ../0.3.4/libMGPM/src/libMGPM.h ./libMGPM/src/libMGPM.h
--- ../0.3.4/libMGPM/src/libMGPM.h Thu Nov 10 15:19:26 2005
+++ ./libMGPM/src/libMGPM.h Fri Nov 11 18:01:02 2005
@@ -181,6 +181,7 @@
} structProperty;
+int MGPMrGetPortName( structProperty* property, char* portDir, char* portName ); /* located in MGPMrCreateAllUpdateStatusDb.c */
int MGPMrBestOldPort( structProperty* property, char* oldPortDir, char* oldPortName );
int MGPMrCleanUp( structProperty* property );
int MGPMrCommandLine( int argc, char** argv );
diff -ruN ../0.3.4/portmanager/pkgtools-to-portmanager.rb ./portmanager/pkgtools-to-portmanager.rb
--- ../0.3.4/portmanager/pkgtools-to-portmanager.rb Wed Dec 31 16:00:00 1969
+++ ./portmanager/pkgtools-to-portmanager.rb Fri Nov 11 20:54:26 2005
@@ -0,0 +1,59 @@
+#!/usr/local/bin/ruby
+
+require "pkgtools"
+
+puts "CATEGORY/PORT|OPTION=| # do not delete this line!"
+
+load_config
+
+
+# held packages
+
+puts ""
+puts "# Ignored packages from HOLD_PKGS"
+puts ""
+
+config_value(:HOLD_PKGS).each do |pkg|
+
+ puts "IGNORE|" + pkg + "|"
+
+end
+
+
+# beforebuild becomes stop
+
+puts ""
+puts "# STOP entries come from BEFOREBUILD"
+puts ""
+
+config_value(:BEFOREBUILD).each do |pkg|
+
+ puts "STOP|/" + pkg[0] + " " + pkg[1] + "|"
+
+end
+
+# afterinstall becomes start
+
+puts ""
+puts "# START entries come from AFTERINSTALL"
+puts ""
+
+config_value(:AFTERINSTALL).each do |pkg|
+
+ puts "START|/" + pkg[0] + " " + pkg[1] + "|"
+
+end
+
+# package options.
+
+
+puts ""
+puts "# Package options from MAKE_ARGS"
+puts "# Note: pkgtools.conf will use the UNION of all matching lines"
+puts ""
+
+config_value(:MAKE_ARGS).each do |pkg|
+
+ puts pkg[0] + "|" + pkg[1] + "|"
+
+end
diff -ruN ../0.3.4/programmer-notes.txt ./programmer-notes.txt
--- ../0.3.4/programmer-notes.txt Fri Nov 11 05:41:28 2005
+++ ./programmer-notes.txt Fri Nov 11 20:56:23 2005
@@ -2,6 +2,8 @@
TODO list
+ add pkgtools-to-portmanager.rb to tarball
+ move MGPMrGetPortName from MGPMrCreateAllUpdateStatusDb.c next new tarball to its own file
move database files to /var/db/portmanager
test in 6.0
use signal to abort only current build?