forked from Lainports/freebsd-ports
- Update to 0.2.9_9.
PR: ports/87349 Submitted by: Michael C. Shultz <ringworm01@gmail.com>
This commit is contained in:
parent
76e32cfb5a
commit
bd4007ea04
4 changed files with 1540 additions and 2 deletions
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
PORTNAME= portmanager
|
||||
PORTVERSION= 0.2.9
|
||||
PORTREVISION= 8
|
||||
PORTREVISION= 9
|
||||
#-----------------------------------------
|
||||
#for local use, remove before submitting PR
|
||||
CATEGORIES= sysutils
|
||||
|
|
|
|||
769
ports-mgmt/portmanager/files/patch-0.2.9_9
Normal file
769
ports-mgmt/portmanager/files/patch-0.2.9_9
Normal file
|
|
@ -0,0 +1,769 @@
|
|||
diff -ruN ./libPMGR/src/PMGRrInitialize.c ../0.2.9_9/libPMGR/src/PMGRrInitialize.c
|
||||
--- ./libPMGR/src/PMGRrInitialize.c Sun Sep 18 17:08:18 2005
|
||||
+++ ../0.2.9_9/libPMGR/src/PMGRrInitialize.c Wed Oct 12 15:44:43 2005
|
||||
@@ -36,6 +36,298 @@
|
||||
|
||||
#include <libPMGR.h>
|
||||
|
||||
+#define OFF -2
|
||||
+#define HELP 0
|
||||
+#define VER 2
|
||||
+#define PMSTATUS 3
|
||||
+#define PMUPGRADE 4
|
||||
+#define SHOWLEAVES 5
|
||||
+#define SHOWLEAVESDELETE 6
|
||||
+
|
||||
+int rPkgAdd( char* port );
|
||||
+
|
||||
+
|
||||
+int portmanager( int argc, char** argv )
|
||||
+{
|
||||
+ FILE* handle = NULL;
|
||||
+ char id[] = "portmanager";
|
||||
+ char ignorePortDir[80];
|
||||
+ char s[] = "-s";
|
||||
+ char showLeaves[] = "--show-leaves";
|
||||
+ char sl[] = "-sl";
|
||||
+ char slidDelete[] = "--show-leaves-interactive-delete";
|
||||
+ char slid[] = "-slid";
|
||||
+ char status[] = "--status";
|
||||
+ char u[] = "-u";
|
||||
+ char upgrade[] = "--upgrade";
|
||||
+ char ui[] = "-ui";
|
||||
+ char upgradeInteractive[] = "--upgrade-interactive";
|
||||
+ char v[] = "-v";
|
||||
+ char version[] = "--version";
|
||||
+ char* buffer = NULL;
|
||||
+ char* command = NULL;
|
||||
+ char* xtermTitle = NULL;
|
||||
+ int bufferSize = 0;
|
||||
+ int errorCode = 0;
|
||||
+ int idx = 0;
|
||||
+ int selection = 0;
|
||||
+ int stringSize = 0;
|
||||
+ structProperty property;
|
||||
+ char* bufferIdx = NULL;
|
||||
+
|
||||
+ /*
|
||||
+ * Insure only one instance of portmanager is running as there is no locking of
|
||||
+ * data bases yet implemented.
|
||||
+ *
|
||||
+ * In debug mode gdb causes extra pids to be reported by ps so instance checking
|
||||
+ * has to be disabled.
|
||||
+ *
|
||||
+ */
|
||||
+#ifndef DEBUG
|
||||
+ stringSize = strlen( "ps au | grep 'portmanager'" ) + 1;
|
||||
+
|
||||
+ command = (char*)malloc( stringSize );
|
||||
+ command[0] = 0;
|
||||
+ strcpy( command, "ps au | grep 'portmanager'" );
|
||||
+ buffer = (char*)malloc( 16000 );
|
||||
+ handle = popen( command, "r" );
|
||||
+ free( command );
|
||||
+
|
||||
+ fread( buffer, 16000, 1, handle );
|
||||
+ pclose( handle );
|
||||
+
|
||||
+ bufferIdx = strstr( buffer, "portmanager" );
|
||||
+ if( bufferIdx )
|
||||
+ {
|
||||
+ bufferIdx++;
|
||||
+ bufferIdx = strstr( bufferIdx, "portmanager" );
|
||||
+ if( bufferIdx )
|
||||
+ {
|
||||
+ bufferIdx++;
|
||||
+ bufferIdx = strstr( bufferIdx, "portmanager" );
|
||||
+ if( bufferIdx )
|
||||
+ {
|
||||
+ bufferIdx++;
|
||||
+ bufferIdx = strstr( bufferIdx, "portmanager" );
|
||||
+ if( bufferIdx )
|
||||
+ {
|
||||
+ fprintf( stderr, "there is already one instance of portmanager running:\n%s\n",
|
||||
+ buffer );
|
||||
+ exit(0);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ free( buffer );
|
||||
+#else
|
||||
+ fprintf( stdout, "%s\n", DOUBLE_LINES );
|
||||
+ fprintf( stdout, "%s %s is running in DEBUG mode ", id, VERSION );
|
||||
+ fprintf( stdout, "multiple instances of\n" );
|
||||
+ fprintf( stdout, "portmanager is now possible, " );
|
||||
+ fprintf( stdout, "a second instance will damage data bases so\n" );
|
||||
+ fprintf( stdout, "use caution\n" );
|
||||
+ fprintf( stdout, "%s\n", DOUBLE_LINES );
|
||||
+ while( fflush( stdout ) );
|
||||
+#endif
|
||||
+
|
||||
+ /*
|
||||
+ * set xterm title
|
||||
+ */
|
||||
+ if( getenv("TERM") )
|
||||
+ {
|
||||
+ if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
|
||||
+ {
|
||||
+ stringSize = strlen( id )
|
||||
+ + 1
|
||||
+ + strlen( VERSION )
|
||||
+ + 1;
|
||||
+ xtermTitle = malloc( stringSize );
|
||||
+ xtermTitle[0] = 0;
|
||||
+ strcat( xtermTitle, id );
|
||||
+ strcat( xtermTitle, " " );
|
||||
+ strcat( xtermTitle, VERSION );
|
||||
+ printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
|
||||
+ free( xtermTitle );
|
||||
+ }
|
||||
+ }
|
||||
+ /*
|
||||
+ * set initial values
|
||||
+ */
|
||||
+ bufferIdx = 0; /* to stop bufferIdx not used warning */
|
||||
+ PMGRrInitialize( &property, argc, (char**)argv );
|
||||
+
|
||||
+ /*
|
||||
+ * help menu
|
||||
+ */
|
||||
+ if( argc > 1 && ( !strcmp( argv[1], "-h" ) || !strcmp( argv[1],
|
||||
+ "--help" ) ) )
|
||||
+ {
|
||||
+ bufferSize = MGrFileSize( property.helpFile ) + 1;
|
||||
+ buffer = (char*)malloc( bufferSize );
|
||||
+ handle = fopen( property.helpFile, "r" );
|
||||
+ if( !handle )
|
||||
+ {
|
||||
+ fprintf( stderr, "error: help file is missing!\n" );
|
||||
+ exit( 1 );
|
||||
+ }
|
||||
+ fread( buffer, bufferSize, 1, handle );
|
||||
+ fprintf( stdout, buffer );
|
||||
+ free( buffer );
|
||||
+ fclose( handle );
|
||||
+ exit( 0 );
|
||||
+ }
|
||||
+
|
||||
+ property.ignoreDb = MGdbCreate( property.ignoreDbFileName, property.fieldIgnorePortDir, property.fieldIgnoreReason, NULL );
|
||||
+ property.strikesDb = MGdbCreate( property.strikesDbFileName, property.field3strikesPortDir, property.fieldStrikes, NULL );
|
||||
+
|
||||
+ /*
|
||||
+ * convert pm-020.conf to config.db
|
||||
+ */
|
||||
+ PMGRrReadConfigure( &property );
|
||||
+ property.configDb = MGdbOpen( property.configDbFileName );
|
||||
+
|
||||
+ idx = 1;
|
||||
+ while( idx < argc )
|
||||
+ {
|
||||
+ if( !strcmp(argv[idx], "-ip") )
|
||||
+ {
|
||||
+ idx++;
|
||||
+ fprintf( stdout, "%s\n", SINGLE_LINES );
|
||||
+ while( idx < argc && argv[idx][0] != '-' )
|
||||
+ {
|
||||
+ if( argv[idx][0] != '/' )
|
||||
+ {
|
||||
+ ignorePortDir[0] = '/';
|
||||
+ ignorePortDir[1] = 0;
|
||||
+ strcat( ignorePortDir, argv[idx] );
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ ignorePortDir[0] = 0;
|
||||
+ strcat( ignorePortDir, argv[idx] );
|
||||
+ }
|
||||
+
|
||||
+ fprintf( stdout, "%s %s info: adding %s to ignore.db reason: command line option -ip\n",
|
||||
+ id, VERSION, ignorePortDir );
|
||||
+
|
||||
+ MGdbAdd( property.ignoreDb, ignorePortDir, "command line option -ip", NULL );
|
||||
+ idx++;
|
||||
+ }
|
||||
+ idx--;
|
||||
+ }
|
||||
+ idx++;
|
||||
+ }
|
||||
+ idx = 0;
|
||||
+
|
||||
+ while( idx < argc )
|
||||
+ {
|
||||
+ if( !strcmp( argv[idx], showLeaves ) || !strcmp( argv[idx], sl ) )
|
||||
+ {
|
||||
+ selection = SHOWLEAVES;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if( !strcmp( argv[idx], slidDelete ) || !strcmp( argv[idx], slid ) )
|
||||
+ {
|
||||
+ selection = SHOWLEAVESDELETE;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if( !strcmp( argv[idx], status ) || !strcmp( argv[idx], s ) )
|
||||
+ {
|
||||
+ selection = PMSTATUS;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if( !strcmp( argv[idx], upgrade ) || !strcmp( argv[idx], u ) )
|
||||
+ {
|
||||
+ stringSize = strlen( "rm -f " )
|
||||
+ + strlen( property.cacheDbFileName ) + 1;
|
||||
+ command = malloc( stringSize );
|
||||
+ command[0] = 0;
|
||||
+ strcat( command, "rm -f " );
|
||||
+ strcat( command, property.cacheDbFileName );
|
||||
+ fprintf( stdout, "%s %s info: executing %s\n", id, VERSION, command );
|
||||
+ while( fflush( stdout ) );
|
||||
+ system( command );
|
||||
+ free( command );
|
||||
+
|
||||
+ property.interactive = 0;
|
||||
+
|
||||
+ selection = PMUPGRADE;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if( !strcmp( argv[idx], upgradeInteractive ) || !strcmp( argv[idx], ui ) )
|
||||
+ {
|
||||
+
|
||||
+ stringSize = strlen( "rm -f " )
|
||||
+ + strlen( property.cacheDbFileName ) + 1;
|
||||
+ command = malloc( stringSize );
|
||||
+ command[0] = 0;
|
||||
+ strcat( command, "rm -f " );
|
||||
+ strcat( command, property.cacheDbFileName );
|
||||
+ fprintf( stdout, "%s %s info: executing %s\n", id, VERSION, command );
|
||||
+ while( fflush( stdout ) );
|
||||
+ system( command );
|
||||
+ free( command );
|
||||
+
|
||||
+ property.interactive = 1;
|
||||
+
|
||||
+ selection = PMUPGRADE;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if( !strcmp( argv[idx], version ) || !strcmp( argv[idx], v ) )
|
||||
+ {
|
||||
+ selection = VER;
|
||||
+ break;
|
||||
+ }
|
||||
+ idx++;
|
||||
+ }
|
||||
+
|
||||
+ switch( selection )
|
||||
+ {
|
||||
+ case VER:
|
||||
+ {
|
||||
+ fprintf( stdout, "\n%s %s VERSION info:\n", id, VERSION );
|
||||
+ break;
|
||||
+ }
|
||||
+ case PMSTATUS:
|
||||
+ {
|
||||
+ errorCode = PMGRrStatus(&property);
|
||||
+ if(errorCode)
|
||||
+ {
|
||||
+ fprintf(stderr, "%s %s error: %s returned errorCode %d\n", id, VERSION, "PMGRrStatus", errorCode);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ case PMUPGRADE:
|
||||
+ {
|
||||
+ errorCode = PMGRrUpgrade(&property);
|
||||
+ if(errorCode)
|
||||
+ {
|
||||
+ fprintf(stderr, "%s %s error: %s returned errorCode %d\n", id, VERSION, "PMGRrUpGrade", errorCode);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ case SHOWLEAVES:
|
||||
+ {
|
||||
+ PMGRrShowLeaves(&property);
|
||||
+ break;
|
||||
+ }
|
||||
+ case SHOWLEAVESDELETE:
|
||||
+ {
|
||||
+ PMGRrShowLeavesDelete(&property);
|
||||
+ break;
|
||||
+ }
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ exit(0);
|
||||
+}
|
||||
+
|
||||
+
|
||||
int PMGRrInitialize( structProperty* property, int argc, char** argv )
|
||||
{
|
||||
char id[] = "PMGRrInitialize";
|
||||
diff -ruN ./libPMGR/src/PMGRrStatus.c ../0.2.9_9/libPMGR/src/PMGRrStatus.c
|
||||
--- ./libPMGR/src/PMGRrStatus.c Sun Sep 18 17:20:06 2005
|
||||
+++ ../0.2.9_9/libPMGR/src/PMGRrStatus.c Tue Sep 20 02:32:22 2005
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
/*.............................................................*/
|
||||
fprintf( stdout,"%s\n", SINGLE_LINES );
|
||||
- fprintf( stdout,"%s %s info: Creating inital data bases\n", id, VERSION );
|
||||
+ fprintf( stdout,"%s %s info: Creating initial data bases\n", id, VERSION );
|
||||
fprintf( stdout,"%s\n", SINGLE_LINES );
|
||||
while( fflush( stdout ) );
|
||||
|
||||
diff -ruN ./libPMGR/src/PMGRrUpgrade.c ../0.2.9_9/libPMGR/src/PMGRrUpgrade.c
|
||||
--- ./libPMGR/src/PMGRrUpgrade.c Sun Sep 18 17:23:05 2005
|
||||
+++ ../0.2.9_9/libPMGR/src/PMGRrUpgrade.c Wed Oct 12 15:26:08 2005
|
||||
@@ -86,58 +86,60 @@
|
||||
fprintf( stdout, "percentDone-=>%d = 100 - ( 100 * ( QTY_outOfDatePortsDb-=>%d / TOTAL_outOfDatePortsDb-=>%d ) ) \n",
|
||||
(int)percentDone, QTY_outOfDatePortsDb-1, TOTAL_outOfDatePortsDb );
|
||||
while( fflush( stdout ) );
|
||||
-/*
|
||||
-pr 81481
|
||||
-To fix the modification of xterm title, even when redirecting, one can
|
||||
-test isatty(fileno(stdout)) before printing the escape sequence.
|
||||
-*/
|
||||
- if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
|
||||
+ if( getenv("TERM") ) /* test for empty in case being run from cron */
|
||||
{
|
||||
- stringSize = strlen( id )
|
||||
- + strlen( " done:%" )
|
||||
- + 5;
|
||||
-
|
||||
- xtermTitle = malloc( stringSize );
|
||||
- xtermTitle[0] = 0;
|
||||
- strcat( xtermTitle, id );
|
||||
- strcat( xtermTitle, " " );
|
||||
- strcat( xtermTitle, " done:%" );
|
||||
- strcat( xtermTitle, MGrIntToString( (long)percentDone ) );
|
||||
- printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
|
||||
- free( xtermTitle );
|
||||
- }
|
||||
-
|
||||
- if( QTY_outOfDatePortsDb < 2 )
|
||||
- {
|
||||
-
|
||||
/*
|
||||
- * Set xterm title bar indicator
|
||||
- */
|
||||
-
|
||||
-/*
|
||||
-pr 81481
|
||||
-To fix the modification of xterm title, even when redirecting, one can
|
||||
-test isatty(fileno(stdout)) before printing the escape sequence.
|
||||
-*/
|
||||
+ pr 81481
|
||||
+ To fix the modification of xterm title, even when redirecting, one can
|
||||
+ test isatty(fileno(stdout)) before printing the escape sequence.
|
||||
+ */
|
||||
if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
|
||||
{
|
||||
- stringSize = strlen( id )
|
||||
- + strlen( " finished" )
|
||||
- + 5;
|
||||
- xtermTitle = malloc( stringSize );
|
||||
- xtermTitle[0] = 0;
|
||||
- strcat( xtermTitle, id );
|
||||
- strcat( xtermTitle, " " );
|
||||
- strcat( xtermTitle, " finished" );
|
||||
- printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
|
||||
- free( xtermTitle );
|
||||
+ stringSize = strlen( id )
|
||||
+ + strlen( " done:%" )
|
||||
+ + 5;
|
||||
+
|
||||
+ xtermTitle = malloc( stringSize );
|
||||
+ xtermTitle[0] = 0;
|
||||
+ strcat( xtermTitle, id );
|
||||
+ strcat( xtermTitle, " " );
|
||||
+ strcat( xtermTitle, " done:%" );
|
||||
+ strcat( xtermTitle, MGrIntToString( (long)percentDone ) );
|
||||
+ printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
|
||||
+ free( xtermTitle );
|
||||
}
|
||||
|
||||
- fprintf( stdout, "%s %s INFO: all ports are up to date\n", id, VERSION );
|
||||
- while( fflush( stdout ) );
|
||||
- return(0);
|
||||
- }
|
||||
+ if( QTY_outOfDatePortsDb < 2 )
|
||||
+ {
|
||||
+
|
||||
+ /*
|
||||
+ * Set xterm title bar indicator
|
||||
+ */
|
||||
+
|
||||
+ /*
|
||||
+ pr 81481
|
||||
+ To fix the modification of xterm title, even when redirecting, one can
|
||||
+ test isatty(fileno(stdout)) before printing the escape sequence.
|
||||
+ */
|
||||
+ if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
|
||||
+ {
|
||||
+ stringSize = strlen( id )
|
||||
+ + strlen( " finished" )
|
||||
+ + 5;
|
||||
+ xtermTitle = malloc( stringSize );
|
||||
+ xtermTitle[0] = 0;
|
||||
+ strcat( xtermTitle, id );
|
||||
+ strcat( xtermTitle, " " );
|
||||
+ strcat( xtermTitle, " finished" );
|
||||
+ printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
|
||||
+ free( xtermTitle );
|
||||
+ }
|
||||
|
||||
+ fprintf( stdout, "%s %s INFO: all ports are up to date\n", id, VERSION );
|
||||
+ while( fflush( stdout ) );
|
||||
+ return(0);
|
||||
+ }
|
||||
+ }
|
||||
errorCode = upgrade( property );
|
||||
|
||||
if(errorCode)
|
||||
diff -ruN ./portmanager/portmanager.1 ../0.2.9_9/portmanager/portmanager.1
|
||||
--- ./portmanager/portmanager.1 Sun Sep 18 17:08:18 2005
|
||||
+++ ../0.2.9_9/portmanager/portmanager.1 Sun Sep 18 21:24:48 2005
|
||||
@@ -245,13 +245,29 @@
|
||||
\&.endif
|
||||
#
|
||||
\&.if ${\&.CURDIR:M*/multimedia/mplayer}
|
||||
- WITH_OPTIMIZED_CFLAGS=yes WITHOUT_RUNTIME_CPUDETECTION=yes \\
|
||||
- WITH_GTK1=yes WITH_RTC=yes WITH_LIBUNGIF=yes WITH_ARTS=yes \\
|
||||
- WITH_FRIBIDI=yes WITH_CDPARANOIA=yes WITH_LIBDV=yes \\
|
||||
- WITH_MAD=yes WITH_SVGALIB=yes WITH_AALIB=yes WITH_THEORA=yes \\
|
||||
- WITH_SDL=yes WITH_ESOUND=yes WITH_VORBIS=yes WITH_XANIM=yes \\
|
||||
- WITH_LIVEMEDIA=yes WITH_MATROSKA=yes WITH_XVID=yes WITH_LZO=yes \\
|
||||
- WITH_XMMS=yes WITH_LANG=en
|
||||
+ WITH_OPTIMIZED_CFLAGS=yes
|
||||
+ WITHOUT_RUNTIME_CPUDETECTION=yes
|
||||
+ WITH_GTK1=yes
|
||||
+ WITH_RTC=yes
|
||||
+ WITH_LIBUNGIF=yes
|
||||
+ WITH_ARTS=yes
|
||||
+ WITH_FRIBIDI=yes
|
||||
+ WITH_CDPARANOIA=yes
|
||||
+ WITH_LIBDV=yes
|
||||
+ WITH_MAD=yes
|
||||
+ WITH_SVGALIB=yes
|
||||
+ WITH_AALIB=yes
|
||||
+ WITH_THEORA=yes
|
||||
+ WITH_SDL=yes
|
||||
+ WITH_ESOUND=yes
|
||||
+ WITH_VORBIS=yes
|
||||
+ WITH_XANIM=yes
|
||||
+ WITH_LIVEMEDIA=yes
|
||||
+ WITH_MATROSKA=yes
|
||||
+ WITH_XVID=yes
|
||||
+ WITH_LZO=yes
|
||||
+ WITH_XMMS=yes
|
||||
+ WITH_LANG=en
|
||||
.endif
|
||||
.\"=======================================================================
|
||||
.Sh BUGS
|
||||
diff -ruN ./portmanager/portmanager.c ../0.2.9_9/portmanager/portmanager.c
|
||||
--- ./portmanager/portmanager.c Sun Sep 18 17:25:45 2005
|
||||
+++ ../0.2.9_9/portmanager/portmanager.c Wed Oct 12 14:55:52 2005
|
||||
@@ -28,15 +28,6 @@
|
||||
*/
|
||||
#include <libPMGR.h>
|
||||
|
||||
-#define OFF -2
|
||||
-#define HELP 0
|
||||
-#define VER 2
|
||||
-#define PMSTATUS 3
|
||||
-#define PMUPGRADE 4
|
||||
-#define SHOWLEAVES 5
|
||||
-#define SHOWLEAVESDELETE 6
|
||||
-
|
||||
-int rPkgAdd( char* port );
|
||||
int portmanager( int argc, char** argv );
|
||||
|
||||
/*
|
||||
@@ -44,284 +35,8 @@
|
||||
*/
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
- portmanager( argc, (char**)argv );
|
||||
+ /* located in PMGRrInitialize.c */
|
||||
+ portmanager( argc, (char**)argv );
|
||||
exit(0);
|
||||
}
|
||||
|
||||
-int portmanager( int argc, char** argv )
|
||||
-{
|
||||
- FILE* handle = NULL;
|
||||
- char id[] = "portmanager";
|
||||
- char ignorePortDir[80];
|
||||
- char s[] = "-s";
|
||||
- char showLeaves[] = "--show-leaves";
|
||||
- char sl[] = "-sl";
|
||||
- char slidDelete[] = "--show-leaves-interactive-delete";
|
||||
- char slid[] = "-slid";
|
||||
- char status[] = "--status";
|
||||
- char u[] = "-u";
|
||||
- char upgrade[] = "--upgrade";
|
||||
- char ui[] = "-ui";
|
||||
- char upgradeInteractive[] = "--upgrade-interactive";
|
||||
- char v[] = "-v";
|
||||
- char version[] = "--version";
|
||||
- char* buffer = NULL;
|
||||
- char* command = NULL;
|
||||
- char* xtermTitle = NULL;
|
||||
- int bufferSize = 0;
|
||||
- int errorCode = 0;
|
||||
- int idx = 0;
|
||||
- int selection = 0;
|
||||
- int stringSize = 0;
|
||||
- structProperty property;
|
||||
- char* bufferIdx = NULL;
|
||||
-
|
||||
- /*
|
||||
- * Insure only one instance of portmanager is running as there is no locking of
|
||||
- * data bases yet implemented.
|
||||
- *
|
||||
- * In debug mode gdb causes extra pids to be reported by ps so instance checking
|
||||
- * has to be disabled.
|
||||
- *
|
||||
- */
|
||||
-#ifndef DEBUG
|
||||
- stringSize = strlen( "ps au | grep 'portmanager'" ) + 1;
|
||||
-
|
||||
- command = (char*)malloc( stringSize );
|
||||
- command[0] = 0;
|
||||
- strcpy( command, "ps au | grep 'portmanager'" );
|
||||
- buffer = (char*)malloc( 16000 );
|
||||
- handle = popen( command, "r" );
|
||||
- free( command );
|
||||
-
|
||||
- fread( buffer, 16000, 1, handle );
|
||||
- pclose( handle );
|
||||
-
|
||||
- bufferIdx = strstr( buffer, "portmanager" );
|
||||
- if( bufferIdx )
|
||||
- {
|
||||
- bufferIdx++;
|
||||
- bufferIdx = strstr( bufferIdx, "portmanager" );
|
||||
- if( bufferIdx )
|
||||
- {
|
||||
- bufferIdx++;
|
||||
- bufferIdx = strstr( bufferIdx, "portmanager" );
|
||||
- if( bufferIdx )
|
||||
- {
|
||||
- bufferIdx++;
|
||||
- bufferIdx = strstr( bufferIdx, "portmanager" );
|
||||
- if( bufferIdx )
|
||||
- {
|
||||
- fprintf( stderr, "there is already one instance of portmanager running:\n%s\n",
|
||||
- buffer );
|
||||
- exit(0);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- free( buffer );
|
||||
-#else
|
||||
- fprintf( stdout, "%s\n", DOUBLE_LINES );
|
||||
- fprintf( stdout, "%s %s is running in DEBUG mode ", id, VERSION );
|
||||
- fprintf( stdout, "multiple instances of\n" );
|
||||
- fprintf( stdout, "portmanager is now possible, " );
|
||||
- fprintf( stdout, "a second instance will damage data bases so\n" );
|
||||
- fprintf( stdout, "use caution\n" );
|
||||
- fprintf( stdout, "%s\n", DOUBLE_LINES );
|
||||
- while( fflush( stdout ) );
|
||||
-#endif
|
||||
-
|
||||
- /*
|
||||
- * set xterm title
|
||||
- */
|
||||
- if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
|
||||
- {
|
||||
- stringSize = strlen( id )
|
||||
- + 1
|
||||
- + strlen( VERSION )
|
||||
- + 1;
|
||||
- xtermTitle = malloc( stringSize );
|
||||
- xtermTitle[0] = 0;
|
||||
- strcat( xtermTitle, id );
|
||||
- strcat( xtermTitle, " " );
|
||||
- strcat( xtermTitle, VERSION );
|
||||
- printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
|
||||
- free( xtermTitle );
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * set initial values
|
||||
- */
|
||||
- bufferIdx = 0; /* to stop bufferIdx not used warning */
|
||||
- PMGRrInitialize( &property, argc, (char**)argv );
|
||||
-
|
||||
- /*
|
||||
- * help menu
|
||||
- */
|
||||
- if( argc > 1 && ( !strcmp( argv[1], "-h" ) || !strcmp( argv[1],
|
||||
- "--help" ) ) )
|
||||
- {
|
||||
- bufferSize = MGrFileSize( property.helpFile ) + 1;
|
||||
- buffer = (char*)malloc( bufferSize );
|
||||
- handle = fopen( property.helpFile, "r" );
|
||||
- if( !handle )
|
||||
- {
|
||||
- fprintf( stderr, "error: help file is missing!\n" );
|
||||
- exit( 1 );
|
||||
- }
|
||||
- fread( buffer, bufferSize, 1, handle );
|
||||
- fprintf( stdout, buffer );
|
||||
- free( buffer );
|
||||
- fclose( handle );
|
||||
- exit( 0 );
|
||||
- }
|
||||
-
|
||||
- property.ignoreDb = MGdbCreate( property.ignoreDbFileName, property.fieldIgnorePortDir, property.fieldIgnoreReason, NULL );
|
||||
- property.strikesDb = MGdbCreate( property.strikesDbFileName, property.field3strikesPortDir, property.fieldStrikes, NULL );
|
||||
-
|
||||
- /*
|
||||
- * convert pm-020.conf to config.db
|
||||
- */
|
||||
- PMGRrReadConfigure( &property );
|
||||
- property.configDb = MGdbOpen( property.configDbFileName );
|
||||
-
|
||||
- idx = 1;
|
||||
- while( idx < argc )
|
||||
- {
|
||||
- if( !strcmp(argv[idx], "-ip") )
|
||||
- {
|
||||
- idx++;
|
||||
- fprintf( stdout, "%s\n", SINGLE_LINES );
|
||||
- while( idx < argc && argv[idx][0] != '-' )
|
||||
- {
|
||||
- if( argv[idx][0] != '/' )
|
||||
- {
|
||||
- ignorePortDir[0] = '/';
|
||||
- ignorePortDir[1] = 0;
|
||||
- strcat( ignorePortDir, argv[idx] );
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- ignorePortDir[0] = 0;
|
||||
- strcat( ignorePortDir, argv[idx] );
|
||||
- }
|
||||
-
|
||||
- fprintf( stdout, "%s %s info: adding %s to ignore.db reason: command line option -ip\n",
|
||||
- id, VERSION, ignorePortDir );
|
||||
-
|
||||
- MGdbAdd( property.ignoreDb, ignorePortDir, "command line option -ip", NULL );
|
||||
- idx++;
|
||||
- }
|
||||
- idx--;
|
||||
- }
|
||||
- idx++;
|
||||
- }
|
||||
- idx = 0;
|
||||
-
|
||||
- while( idx < argc )
|
||||
- {
|
||||
- if( !strcmp( argv[idx], showLeaves ) || !strcmp( argv[idx], sl ) )
|
||||
- {
|
||||
- selection = SHOWLEAVES;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if( !strcmp( argv[idx], slidDelete ) || !strcmp( argv[idx], slid ) )
|
||||
- {
|
||||
- selection = SHOWLEAVESDELETE;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if( !strcmp( argv[idx], status ) || !strcmp( argv[idx], s ) )
|
||||
- {
|
||||
- selection = PMSTATUS;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if( !strcmp( argv[idx], upgrade ) || !strcmp( argv[idx], u ) )
|
||||
- {
|
||||
- stringSize = strlen( "rm -f " )
|
||||
- + strlen( property.cacheDbFileName ) + 1;
|
||||
- command = malloc( stringSize );
|
||||
- command[0] = 0;
|
||||
- strcat( command, "rm -f " );
|
||||
- strcat( command, property.cacheDbFileName );
|
||||
- fprintf( stdout, "%s %s info: executing %s\n", id, VERSION, command );
|
||||
- while( fflush( stdout ) );
|
||||
- system( command );
|
||||
- free( command );
|
||||
-
|
||||
- property.interactive = 0;
|
||||
-
|
||||
- selection = PMUPGRADE;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if( !strcmp( argv[idx], upgradeInteractive ) || !strcmp( argv[idx], ui ) )
|
||||
- {
|
||||
-
|
||||
- stringSize = strlen( "rm -f " )
|
||||
- + strlen( property.cacheDbFileName ) + 1;
|
||||
- command = malloc( stringSize );
|
||||
- command[0] = 0;
|
||||
- strcat( command, "rm -f " );
|
||||
- strcat( command, property.cacheDbFileName );
|
||||
- fprintf( stdout, "%s %s info: executing %s\n", id, VERSION, command );
|
||||
- while( fflush( stdout ) );
|
||||
- system( command );
|
||||
- free( command );
|
||||
-
|
||||
- property.interactive = 1;
|
||||
-
|
||||
- selection = PMUPGRADE;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if( !strcmp( argv[idx], version ) || !strcmp( argv[idx], v ) )
|
||||
- {
|
||||
- selection = VER;
|
||||
- break;
|
||||
- }
|
||||
- idx++;
|
||||
- }
|
||||
-
|
||||
- switch( selection )
|
||||
- {
|
||||
- case VER:
|
||||
- {
|
||||
- fprintf( stdout, "\n%s %s VERSION info:\n", id, VERSION );
|
||||
- break;
|
||||
- }
|
||||
- case PMSTATUS:
|
||||
- {
|
||||
- errorCode = PMGRrStatus(&property);
|
||||
- if(errorCode)
|
||||
- {
|
||||
- fprintf(stderr, "%s %s error: %s returned errorCode %d\n", id, VERSION, "PMGRrStatus", errorCode);
|
||||
- }
|
||||
- break;
|
||||
- }
|
||||
- case PMUPGRADE:
|
||||
- {
|
||||
- errorCode = PMGRrUpgrade(&property);
|
||||
- if(errorCode)
|
||||
- {
|
||||
- fprintf(stderr, "%s %s error: %s returned errorCode %d\n", id, VERSION, "PMGRrUpGrade", errorCode);
|
||||
- }
|
||||
- break;
|
||||
- }
|
||||
- case SHOWLEAVES:
|
||||
- {
|
||||
- PMGRrShowLeaves(&property);
|
||||
- break;
|
||||
- }
|
||||
- case SHOWLEAVESDELETE:
|
||||
- {
|
||||
- PMGRrShowLeavesDelete(&property);
|
||||
- break;
|
||||
- }
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
- exit(0);
|
||||
-}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
PORTNAME= portmanager
|
||||
PORTVERSION= 0.2.9
|
||||
PORTREVISION= 8
|
||||
PORTREVISION= 9
|
||||
#-----------------------------------------
|
||||
#for local use, remove before submitting PR
|
||||
CATEGORIES= sysutils
|
||||
|
|
|
|||
769
sysutils/portmanager/files/patch-0.2.9_9
Normal file
769
sysutils/portmanager/files/patch-0.2.9_9
Normal file
|
|
@ -0,0 +1,769 @@
|
|||
diff -ruN ./libPMGR/src/PMGRrInitialize.c ../0.2.9_9/libPMGR/src/PMGRrInitialize.c
|
||||
--- ./libPMGR/src/PMGRrInitialize.c Sun Sep 18 17:08:18 2005
|
||||
+++ ../0.2.9_9/libPMGR/src/PMGRrInitialize.c Wed Oct 12 15:44:43 2005
|
||||
@@ -36,6 +36,298 @@
|
||||
|
||||
#include <libPMGR.h>
|
||||
|
||||
+#define OFF -2
|
||||
+#define HELP 0
|
||||
+#define VER 2
|
||||
+#define PMSTATUS 3
|
||||
+#define PMUPGRADE 4
|
||||
+#define SHOWLEAVES 5
|
||||
+#define SHOWLEAVESDELETE 6
|
||||
+
|
||||
+int rPkgAdd( char* port );
|
||||
+
|
||||
+
|
||||
+int portmanager( int argc, char** argv )
|
||||
+{
|
||||
+ FILE* handle = NULL;
|
||||
+ char id[] = "portmanager";
|
||||
+ char ignorePortDir[80];
|
||||
+ char s[] = "-s";
|
||||
+ char showLeaves[] = "--show-leaves";
|
||||
+ char sl[] = "-sl";
|
||||
+ char slidDelete[] = "--show-leaves-interactive-delete";
|
||||
+ char slid[] = "-slid";
|
||||
+ char status[] = "--status";
|
||||
+ char u[] = "-u";
|
||||
+ char upgrade[] = "--upgrade";
|
||||
+ char ui[] = "-ui";
|
||||
+ char upgradeInteractive[] = "--upgrade-interactive";
|
||||
+ char v[] = "-v";
|
||||
+ char version[] = "--version";
|
||||
+ char* buffer = NULL;
|
||||
+ char* command = NULL;
|
||||
+ char* xtermTitle = NULL;
|
||||
+ int bufferSize = 0;
|
||||
+ int errorCode = 0;
|
||||
+ int idx = 0;
|
||||
+ int selection = 0;
|
||||
+ int stringSize = 0;
|
||||
+ structProperty property;
|
||||
+ char* bufferIdx = NULL;
|
||||
+
|
||||
+ /*
|
||||
+ * Insure only one instance of portmanager is running as there is no locking of
|
||||
+ * data bases yet implemented.
|
||||
+ *
|
||||
+ * In debug mode gdb causes extra pids to be reported by ps so instance checking
|
||||
+ * has to be disabled.
|
||||
+ *
|
||||
+ */
|
||||
+#ifndef DEBUG
|
||||
+ stringSize = strlen( "ps au | grep 'portmanager'" ) + 1;
|
||||
+
|
||||
+ command = (char*)malloc( stringSize );
|
||||
+ command[0] = 0;
|
||||
+ strcpy( command, "ps au | grep 'portmanager'" );
|
||||
+ buffer = (char*)malloc( 16000 );
|
||||
+ handle = popen( command, "r" );
|
||||
+ free( command );
|
||||
+
|
||||
+ fread( buffer, 16000, 1, handle );
|
||||
+ pclose( handle );
|
||||
+
|
||||
+ bufferIdx = strstr( buffer, "portmanager" );
|
||||
+ if( bufferIdx )
|
||||
+ {
|
||||
+ bufferIdx++;
|
||||
+ bufferIdx = strstr( bufferIdx, "portmanager" );
|
||||
+ if( bufferIdx )
|
||||
+ {
|
||||
+ bufferIdx++;
|
||||
+ bufferIdx = strstr( bufferIdx, "portmanager" );
|
||||
+ if( bufferIdx )
|
||||
+ {
|
||||
+ bufferIdx++;
|
||||
+ bufferIdx = strstr( bufferIdx, "portmanager" );
|
||||
+ if( bufferIdx )
|
||||
+ {
|
||||
+ fprintf( stderr, "there is already one instance of portmanager running:\n%s\n",
|
||||
+ buffer );
|
||||
+ exit(0);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ free( buffer );
|
||||
+#else
|
||||
+ fprintf( stdout, "%s\n", DOUBLE_LINES );
|
||||
+ fprintf( stdout, "%s %s is running in DEBUG mode ", id, VERSION );
|
||||
+ fprintf( stdout, "multiple instances of\n" );
|
||||
+ fprintf( stdout, "portmanager is now possible, " );
|
||||
+ fprintf( stdout, "a second instance will damage data bases so\n" );
|
||||
+ fprintf( stdout, "use caution\n" );
|
||||
+ fprintf( stdout, "%s\n", DOUBLE_LINES );
|
||||
+ while( fflush( stdout ) );
|
||||
+#endif
|
||||
+
|
||||
+ /*
|
||||
+ * set xterm title
|
||||
+ */
|
||||
+ if( getenv("TERM") )
|
||||
+ {
|
||||
+ if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
|
||||
+ {
|
||||
+ stringSize = strlen( id )
|
||||
+ + 1
|
||||
+ + strlen( VERSION )
|
||||
+ + 1;
|
||||
+ xtermTitle = malloc( stringSize );
|
||||
+ xtermTitle[0] = 0;
|
||||
+ strcat( xtermTitle, id );
|
||||
+ strcat( xtermTitle, " " );
|
||||
+ strcat( xtermTitle, VERSION );
|
||||
+ printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
|
||||
+ free( xtermTitle );
|
||||
+ }
|
||||
+ }
|
||||
+ /*
|
||||
+ * set initial values
|
||||
+ */
|
||||
+ bufferIdx = 0; /* to stop bufferIdx not used warning */
|
||||
+ PMGRrInitialize( &property, argc, (char**)argv );
|
||||
+
|
||||
+ /*
|
||||
+ * help menu
|
||||
+ */
|
||||
+ if( argc > 1 && ( !strcmp( argv[1], "-h" ) || !strcmp( argv[1],
|
||||
+ "--help" ) ) )
|
||||
+ {
|
||||
+ bufferSize = MGrFileSize( property.helpFile ) + 1;
|
||||
+ buffer = (char*)malloc( bufferSize );
|
||||
+ handle = fopen( property.helpFile, "r" );
|
||||
+ if( !handle )
|
||||
+ {
|
||||
+ fprintf( stderr, "error: help file is missing!\n" );
|
||||
+ exit( 1 );
|
||||
+ }
|
||||
+ fread( buffer, bufferSize, 1, handle );
|
||||
+ fprintf( stdout, buffer );
|
||||
+ free( buffer );
|
||||
+ fclose( handle );
|
||||
+ exit( 0 );
|
||||
+ }
|
||||
+
|
||||
+ property.ignoreDb = MGdbCreate( property.ignoreDbFileName, property.fieldIgnorePortDir, property.fieldIgnoreReason, NULL );
|
||||
+ property.strikesDb = MGdbCreate( property.strikesDbFileName, property.field3strikesPortDir, property.fieldStrikes, NULL );
|
||||
+
|
||||
+ /*
|
||||
+ * convert pm-020.conf to config.db
|
||||
+ */
|
||||
+ PMGRrReadConfigure( &property );
|
||||
+ property.configDb = MGdbOpen( property.configDbFileName );
|
||||
+
|
||||
+ idx = 1;
|
||||
+ while( idx < argc )
|
||||
+ {
|
||||
+ if( !strcmp(argv[idx], "-ip") )
|
||||
+ {
|
||||
+ idx++;
|
||||
+ fprintf( stdout, "%s\n", SINGLE_LINES );
|
||||
+ while( idx < argc && argv[idx][0] != '-' )
|
||||
+ {
|
||||
+ if( argv[idx][0] != '/' )
|
||||
+ {
|
||||
+ ignorePortDir[0] = '/';
|
||||
+ ignorePortDir[1] = 0;
|
||||
+ strcat( ignorePortDir, argv[idx] );
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ ignorePortDir[0] = 0;
|
||||
+ strcat( ignorePortDir, argv[idx] );
|
||||
+ }
|
||||
+
|
||||
+ fprintf( stdout, "%s %s info: adding %s to ignore.db reason: command line option -ip\n",
|
||||
+ id, VERSION, ignorePortDir );
|
||||
+
|
||||
+ MGdbAdd( property.ignoreDb, ignorePortDir, "command line option -ip", NULL );
|
||||
+ idx++;
|
||||
+ }
|
||||
+ idx--;
|
||||
+ }
|
||||
+ idx++;
|
||||
+ }
|
||||
+ idx = 0;
|
||||
+
|
||||
+ while( idx < argc )
|
||||
+ {
|
||||
+ if( !strcmp( argv[idx], showLeaves ) || !strcmp( argv[idx], sl ) )
|
||||
+ {
|
||||
+ selection = SHOWLEAVES;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if( !strcmp( argv[idx], slidDelete ) || !strcmp( argv[idx], slid ) )
|
||||
+ {
|
||||
+ selection = SHOWLEAVESDELETE;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if( !strcmp( argv[idx], status ) || !strcmp( argv[idx], s ) )
|
||||
+ {
|
||||
+ selection = PMSTATUS;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if( !strcmp( argv[idx], upgrade ) || !strcmp( argv[idx], u ) )
|
||||
+ {
|
||||
+ stringSize = strlen( "rm -f " )
|
||||
+ + strlen( property.cacheDbFileName ) + 1;
|
||||
+ command = malloc( stringSize );
|
||||
+ command[0] = 0;
|
||||
+ strcat( command, "rm -f " );
|
||||
+ strcat( command, property.cacheDbFileName );
|
||||
+ fprintf( stdout, "%s %s info: executing %s\n", id, VERSION, command );
|
||||
+ while( fflush( stdout ) );
|
||||
+ system( command );
|
||||
+ free( command );
|
||||
+
|
||||
+ property.interactive = 0;
|
||||
+
|
||||
+ selection = PMUPGRADE;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if( !strcmp( argv[idx], upgradeInteractive ) || !strcmp( argv[idx], ui ) )
|
||||
+ {
|
||||
+
|
||||
+ stringSize = strlen( "rm -f " )
|
||||
+ + strlen( property.cacheDbFileName ) + 1;
|
||||
+ command = malloc( stringSize );
|
||||
+ command[0] = 0;
|
||||
+ strcat( command, "rm -f " );
|
||||
+ strcat( command, property.cacheDbFileName );
|
||||
+ fprintf( stdout, "%s %s info: executing %s\n", id, VERSION, command );
|
||||
+ while( fflush( stdout ) );
|
||||
+ system( command );
|
||||
+ free( command );
|
||||
+
|
||||
+ property.interactive = 1;
|
||||
+
|
||||
+ selection = PMUPGRADE;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if( !strcmp( argv[idx], version ) || !strcmp( argv[idx], v ) )
|
||||
+ {
|
||||
+ selection = VER;
|
||||
+ break;
|
||||
+ }
|
||||
+ idx++;
|
||||
+ }
|
||||
+
|
||||
+ switch( selection )
|
||||
+ {
|
||||
+ case VER:
|
||||
+ {
|
||||
+ fprintf( stdout, "\n%s %s VERSION info:\n", id, VERSION );
|
||||
+ break;
|
||||
+ }
|
||||
+ case PMSTATUS:
|
||||
+ {
|
||||
+ errorCode = PMGRrStatus(&property);
|
||||
+ if(errorCode)
|
||||
+ {
|
||||
+ fprintf(stderr, "%s %s error: %s returned errorCode %d\n", id, VERSION, "PMGRrStatus", errorCode);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ case PMUPGRADE:
|
||||
+ {
|
||||
+ errorCode = PMGRrUpgrade(&property);
|
||||
+ if(errorCode)
|
||||
+ {
|
||||
+ fprintf(stderr, "%s %s error: %s returned errorCode %d\n", id, VERSION, "PMGRrUpGrade", errorCode);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ case SHOWLEAVES:
|
||||
+ {
|
||||
+ PMGRrShowLeaves(&property);
|
||||
+ break;
|
||||
+ }
|
||||
+ case SHOWLEAVESDELETE:
|
||||
+ {
|
||||
+ PMGRrShowLeavesDelete(&property);
|
||||
+ break;
|
||||
+ }
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ exit(0);
|
||||
+}
|
||||
+
|
||||
+
|
||||
int PMGRrInitialize( structProperty* property, int argc, char** argv )
|
||||
{
|
||||
char id[] = "PMGRrInitialize";
|
||||
diff -ruN ./libPMGR/src/PMGRrStatus.c ../0.2.9_9/libPMGR/src/PMGRrStatus.c
|
||||
--- ./libPMGR/src/PMGRrStatus.c Sun Sep 18 17:20:06 2005
|
||||
+++ ../0.2.9_9/libPMGR/src/PMGRrStatus.c Tue Sep 20 02:32:22 2005
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
/*.............................................................*/
|
||||
fprintf( stdout,"%s\n", SINGLE_LINES );
|
||||
- fprintf( stdout,"%s %s info: Creating inital data bases\n", id, VERSION );
|
||||
+ fprintf( stdout,"%s %s info: Creating initial data bases\n", id, VERSION );
|
||||
fprintf( stdout,"%s\n", SINGLE_LINES );
|
||||
while( fflush( stdout ) );
|
||||
|
||||
diff -ruN ./libPMGR/src/PMGRrUpgrade.c ../0.2.9_9/libPMGR/src/PMGRrUpgrade.c
|
||||
--- ./libPMGR/src/PMGRrUpgrade.c Sun Sep 18 17:23:05 2005
|
||||
+++ ../0.2.9_9/libPMGR/src/PMGRrUpgrade.c Wed Oct 12 15:26:08 2005
|
||||
@@ -86,58 +86,60 @@
|
||||
fprintf( stdout, "percentDone-=>%d = 100 - ( 100 * ( QTY_outOfDatePortsDb-=>%d / TOTAL_outOfDatePortsDb-=>%d ) ) \n",
|
||||
(int)percentDone, QTY_outOfDatePortsDb-1, TOTAL_outOfDatePortsDb );
|
||||
while( fflush( stdout ) );
|
||||
-/*
|
||||
-pr 81481
|
||||
-To fix the modification of xterm title, even when redirecting, one can
|
||||
-test isatty(fileno(stdout)) before printing the escape sequence.
|
||||
-*/
|
||||
- if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
|
||||
+ if( getenv("TERM") ) /* test for empty in case being run from cron */
|
||||
{
|
||||
- stringSize = strlen( id )
|
||||
- + strlen( " done:%" )
|
||||
- + 5;
|
||||
-
|
||||
- xtermTitle = malloc( stringSize );
|
||||
- xtermTitle[0] = 0;
|
||||
- strcat( xtermTitle, id );
|
||||
- strcat( xtermTitle, " " );
|
||||
- strcat( xtermTitle, " done:%" );
|
||||
- strcat( xtermTitle, MGrIntToString( (long)percentDone ) );
|
||||
- printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
|
||||
- free( xtermTitle );
|
||||
- }
|
||||
-
|
||||
- if( QTY_outOfDatePortsDb < 2 )
|
||||
- {
|
||||
-
|
||||
/*
|
||||
- * Set xterm title bar indicator
|
||||
- */
|
||||
-
|
||||
-/*
|
||||
-pr 81481
|
||||
-To fix the modification of xterm title, even when redirecting, one can
|
||||
-test isatty(fileno(stdout)) before printing the escape sequence.
|
||||
-*/
|
||||
+ pr 81481
|
||||
+ To fix the modification of xterm title, even when redirecting, one can
|
||||
+ test isatty(fileno(stdout)) before printing the escape sequence.
|
||||
+ */
|
||||
if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
|
||||
{
|
||||
- stringSize = strlen( id )
|
||||
- + strlen( " finished" )
|
||||
- + 5;
|
||||
- xtermTitle = malloc( stringSize );
|
||||
- xtermTitle[0] = 0;
|
||||
- strcat( xtermTitle, id );
|
||||
- strcat( xtermTitle, " " );
|
||||
- strcat( xtermTitle, " finished" );
|
||||
- printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
|
||||
- free( xtermTitle );
|
||||
+ stringSize = strlen( id )
|
||||
+ + strlen( " done:%" )
|
||||
+ + 5;
|
||||
+
|
||||
+ xtermTitle = malloc( stringSize );
|
||||
+ xtermTitle[0] = 0;
|
||||
+ strcat( xtermTitle, id );
|
||||
+ strcat( xtermTitle, " " );
|
||||
+ strcat( xtermTitle, " done:%" );
|
||||
+ strcat( xtermTitle, MGrIntToString( (long)percentDone ) );
|
||||
+ printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
|
||||
+ free( xtermTitle );
|
||||
}
|
||||
|
||||
- fprintf( stdout, "%s %s INFO: all ports are up to date\n", id, VERSION );
|
||||
- while( fflush( stdout ) );
|
||||
- return(0);
|
||||
- }
|
||||
+ if( QTY_outOfDatePortsDb < 2 )
|
||||
+ {
|
||||
+
|
||||
+ /*
|
||||
+ * Set xterm title bar indicator
|
||||
+ */
|
||||
+
|
||||
+ /*
|
||||
+ pr 81481
|
||||
+ To fix the modification of xterm title, even when redirecting, one can
|
||||
+ test isatty(fileno(stdout)) before printing the escape sequence.
|
||||
+ */
|
||||
+ if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
|
||||
+ {
|
||||
+ stringSize = strlen( id )
|
||||
+ + strlen( " finished" )
|
||||
+ + 5;
|
||||
+ xtermTitle = malloc( stringSize );
|
||||
+ xtermTitle[0] = 0;
|
||||
+ strcat( xtermTitle, id );
|
||||
+ strcat( xtermTitle, " " );
|
||||
+ strcat( xtermTitle, " finished" );
|
||||
+ printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
|
||||
+ free( xtermTitle );
|
||||
+ }
|
||||
|
||||
+ fprintf( stdout, "%s %s INFO: all ports are up to date\n", id, VERSION );
|
||||
+ while( fflush( stdout ) );
|
||||
+ return(0);
|
||||
+ }
|
||||
+ }
|
||||
errorCode = upgrade( property );
|
||||
|
||||
if(errorCode)
|
||||
diff -ruN ./portmanager/portmanager.1 ../0.2.9_9/portmanager/portmanager.1
|
||||
--- ./portmanager/portmanager.1 Sun Sep 18 17:08:18 2005
|
||||
+++ ../0.2.9_9/portmanager/portmanager.1 Sun Sep 18 21:24:48 2005
|
||||
@@ -245,13 +245,29 @@
|
||||
\&.endif
|
||||
#
|
||||
\&.if ${\&.CURDIR:M*/multimedia/mplayer}
|
||||
- WITH_OPTIMIZED_CFLAGS=yes WITHOUT_RUNTIME_CPUDETECTION=yes \\
|
||||
- WITH_GTK1=yes WITH_RTC=yes WITH_LIBUNGIF=yes WITH_ARTS=yes \\
|
||||
- WITH_FRIBIDI=yes WITH_CDPARANOIA=yes WITH_LIBDV=yes \\
|
||||
- WITH_MAD=yes WITH_SVGALIB=yes WITH_AALIB=yes WITH_THEORA=yes \\
|
||||
- WITH_SDL=yes WITH_ESOUND=yes WITH_VORBIS=yes WITH_XANIM=yes \\
|
||||
- WITH_LIVEMEDIA=yes WITH_MATROSKA=yes WITH_XVID=yes WITH_LZO=yes \\
|
||||
- WITH_XMMS=yes WITH_LANG=en
|
||||
+ WITH_OPTIMIZED_CFLAGS=yes
|
||||
+ WITHOUT_RUNTIME_CPUDETECTION=yes
|
||||
+ WITH_GTK1=yes
|
||||
+ WITH_RTC=yes
|
||||
+ WITH_LIBUNGIF=yes
|
||||
+ WITH_ARTS=yes
|
||||
+ WITH_FRIBIDI=yes
|
||||
+ WITH_CDPARANOIA=yes
|
||||
+ WITH_LIBDV=yes
|
||||
+ WITH_MAD=yes
|
||||
+ WITH_SVGALIB=yes
|
||||
+ WITH_AALIB=yes
|
||||
+ WITH_THEORA=yes
|
||||
+ WITH_SDL=yes
|
||||
+ WITH_ESOUND=yes
|
||||
+ WITH_VORBIS=yes
|
||||
+ WITH_XANIM=yes
|
||||
+ WITH_LIVEMEDIA=yes
|
||||
+ WITH_MATROSKA=yes
|
||||
+ WITH_XVID=yes
|
||||
+ WITH_LZO=yes
|
||||
+ WITH_XMMS=yes
|
||||
+ WITH_LANG=en
|
||||
.endif
|
||||
.\"=======================================================================
|
||||
.Sh BUGS
|
||||
diff -ruN ./portmanager/portmanager.c ../0.2.9_9/portmanager/portmanager.c
|
||||
--- ./portmanager/portmanager.c Sun Sep 18 17:25:45 2005
|
||||
+++ ../0.2.9_9/portmanager/portmanager.c Wed Oct 12 14:55:52 2005
|
||||
@@ -28,15 +28,6 @@
|
||||
*/
|
||||
#include <libPMGR.h>
|
||||
|
||||
-#define OFF -2
|
||||
-#define HELP 0
|
||||
-#define VER 2
|
||||
-#define PMSTATUS 3
|
||||
-#define PMUPGRADE 4
|
||||
-#define SHOWLEAVES 5
|
||||
-#define SHOWLEAVESDELETE 6
|
||||
-
|
||||
-int rPkgAdd( char* port );
|
||||
int portmanager( int argc, char** argv );
|
||||
|
||||
/*
|
||||
@@ -44,284 +35,8 @@
|
||||
*/
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
- portmanager( argc, (char**)argv );
|
||||
+ /* located in PMGRrInitialize.c */
|
||||
+ portmanager( argc, (char**)argv );
|
||||
exit(0);
|
||||
}
|
||||
|
||||
-int portmanager( int argc, char** argv )
|
||||
-{
|
||||
- FILE* handle = NULL;
|
||||
- char id[] = "portmanager";
|
||||
- char ignorePortDir[80];
|
||||
- char s[] = "-s";
|
||||
- char showLeaves[] = "--show-leaves";
|
||||
- char sl[] = "-sl";
|
||||
- char slidDelete[] = "--show-leaves-interactive-delete";
|
||||
- char slid[] = "-slid";
|
||||
- char status[] = "--status";
|
||||
- char u[] = "-u";
|
||||
- char upgrade[] = "--upgrade";
|
||||
- char ui[] = "-ui";
|
||||
- char upgradeInteractive[] = "--upgrade-interactive";
|
||||
- char v[] = "-v";
|
||||
- char version[] = "--version";
|
||||
- char* buffer = NULL;
|
||||
- char* command = NULL;
|
||||
- char* xtermTitle = NULL;
|
||||
- int bufferSize = 0;
|
||||
- int errorCode = 0;
|
||||
- int idx = 0;
|
||||
- int selection = 0;
|
||||
- int stringSize = 0;
|
||||
- structProperty property;
|
||||
- char* bufferIdx = NULL;
|
||||
-
|
||||
- /*
|
||||
- * Insure only one instance of portmanager is running as there is no locking of
|
||||
- * data bases yet implemented.
|
||||
- *
|
||||
- * In debug mode gdb causes extra pids to be reported by ps so instance checking
|
||||
- * has to be disabled.
|
||||
- *
|
||||
- */
|
||||
-#ifndef DEBUG
|
||||
- stringSize = strlen( "ps au | grep 'portmanager'" ) + 1;
|
||||
-
|
||||
- command = (char*)malloc( stringSize );
|
||||
- command[0] = 0;
|
||||
- strcpy( command, "ps au | grep 'portmanager'" );
|
||||
- buffer = (char*)malloc( 16000 );
|
||||
- handle = popen( command, "r" );
|
||||
- free( command );
|
||||
-
|
||||
- fread( buffer, 16000, 1, handle );
|
||||
- pclose( handle );
|
||||
-
|
||||
- bufferIdx = strstr( buffer, "portmanager" );
|
||||
- if( bufferIdx )
|
||||
- {
|
||||
- bufferIdx++;
|
||||
- bufferIdx = strstr( bufferIdx, "portmanager" );
|
||||
- if( bufferIdx )
|
||||
- {
|
||||
- bufferIdx++;
|
||||
- bufferIdx = strstr( bufferIdx, "portmanager" );
|
||||
- if( bufferIdx )
|
||||
- {
|
||||
- bufferIdx++;
|
||||
- bufferIdx = strstr( bufferIdx, "portmanager" );
|
||||
- if( bufferIdx )
|
||||
- {
|
||||
- fprintf( stderr, "there is already one instance of portmanager running:\n%s\n",
|
||||
- buffer );
|
||||
- exit(0);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- free( buffer );
|
||||
-#else
|
||||
- fprintf( stdout, "%s\n", DOUBLE_LINES );
|
||||
- fprintf( stdout, "%s %s is running in DEBUG mode ", id, VERSION );
|
||||
- fprintf( stdout, "multiple instances of\n" );
|
||||
- fprintf( stdout, "portmanager is now possible, " );
|
||||
- fprintf( stdout, "a second instance will damage data bases so\n" );
|
||||
- fprintf( stdout, "use caution\n" );
|
||||
- fprintf( stdout, "%s\n", DOUBLE_LINES );
|
||||
- while( fflush( stdout ) );
|
||||
-#endif
|
||||
-
|
||||
- /*
|
||||
- * set xterm title
|
||||
- */
|
||||
- if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
|
||||
- {
|
||||
- stringSize = strlen( id )
|
||||
- + 1
|
||||
- + strlen( VERSION )
|
||||
- + 1;
|
||||
- xtermTitle = malloc( stringSize );
|
||||
- xtermTitle[0] = 0;
|
||||
- strcat( xtermTitle, id );
|
||||
- strcat( xtermTitle, " " );
|
||||
- strcat( xtermTitle, VERSION );
|
||||
- printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
|
||||
- free( xtermTitle );
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * set initial values
|
||||
- */
|
||||
- bufferIdx = 0; /* to stop bufferIdx not used warning */
|
||||
- PMGRrInitialize( &property, argc, (char**)argv );
|
||||
-
|
||||
- /*
|
||||
- * help menu
|
||||
- */
|
||||
- if( argc > 1 && ( !strcmp( argv[1], "-h" ) || !strcmp( argv[1],
|
||||
- "--help" ) ) )
|
||||
- {
|
||||
- bufferSize = MGrFileSize( property.helpFile ) + 1;
|
||||
- buffer = (char*)malloc( bufferSize );
|
||||
- handle = fopen( property.helpFile, "r" );
|
||||
- if( !handle )
|
||||
- {
|
||||
- fprintf( stderr, "error: help file is missing!\n" );
|
||||
- exit( 1 );
|
||||
- }
|
||||
- fread( buffer, bufferSize, 1, handle );
|
||||
- fprintf( stdout, buffer );
|
||||
- free( buffer );
|
||||
- fclose( handle );
|
||||
- exit( 0 );
|
||||
- }
|
||||
-
|
||||
- property.ignoreDb = MGdbCreate( property.ignoreDbFileName, property.fieldIgnorePortDir, property.fieldIgnoreReason, NULL );
|
||||
- property.strikesDb = MGdbCreate( property.strikesDbFileName, property.field3strikesPortDir, property.fieldStrikes, NULL );
|
||||
-
|
||||
- /*
|
||||
- * convert pm-020.conf to config.db
|
||||
- */
|
||||
- PMGRrReadConfigure( &property );
|
||||
- property.configDb = MGdbOpen( property.configDbFileName );
|
||||
-
|
||||
- idx = 1;
|
||||
- while( idx < argc )
|
||||
- {
|
||||
- if( !strcmp(argv[idx], "-ip") )
|
||||
- {
|
||||
- idx++;
|
||||
- fprintf( stdout, "%s\n", SINGLE_LINES );
|
||||
- while( idx < argc && argv[idx][0] != '-' )
|
||||
- {
|
||||
- if( argv[idx][0] != '/' )
|
||||
- {
|
||||
- ignorePortDir[0] = '/';
|
||||
- ignorePortDir[1] = 0;
|
||||
- strcat( ignorePortDir, argv[idx] );
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- ignorePortDir[0] = 0;
|
||||
- strcat( ignorePortDir, argv[idx] );
|
||||
- }
|
||||
-
|
||||
- fprintf( stdout, "%s %s info: adding %s to ignore.db reason: command line option -ip\n",
|
||||
- id, VERSION, ignorePortDir );
|
||||
-
|
||||
- MGdbAdd( property.ignoreDb, ignorePortDir, "command line option -ip", NULL );
|
||||
- idx++;
|
||||
- }
|
||||
- idx--;
|
||||
- }
|
||||
- idx++;
|
||||
- }
|
||||
- idx = 0;
|
||||
-
|
||||
- while( idx < argc )
|
||||
- {
|
||||
- if( !strcmp( argv[idx], showLeaves ) || !strcmp( argv[idx], sl ) )
|
||||
- {
|
||||
- selection = SHOWLEAVES;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if( !strcmp( argv[idx], slidDelete ) || !strcmp( argv[idx], slid ) )
|
||||
- {
|
||||
- selection = SHOWLEAVESDELETE;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if( !strcmp( argv[idx], status ) || !strcmp( argv[idx], s ) )
|
||||
- {
|
||||
- selection = PMSTATUS;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if( !strcmp( argv[idx], upgrade ) || !strcmp( argv[idx], u ) )
|
||||
- {
|
||||
- stringSize = strlen( "rm -f " )
|
||||
- + strlen( property.cacheDbFileName ) + 1;
|
||||
- command = malloc( stringSize );
|
||||
- command[0] = 0;
|
||||
- strcat( command, "rm -f " );
|
||||
- strcat( command, property.cacheDbFileName );
|
||||
- fprintf( stdout, "%s %s info: executing %s\n", id, VERSION, command );
|
||||
- while( fflush( stdout ) );
|
||||
- system( command );
|
||||
- free( command );
|
||||
-
|
||||
- property.interactive = 0;
|
||||
-
|
||||
- selection = PMUPGRADE;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if( !strcmp( argv[idx], upgradeInteractive ) || !strcmp( argv[idx], ui ) )
|
||||
- {
|
||||
-
|
||||
- stringSize = strlen( "rm -f " )
|
||||
- + strlen( property.cacheDbFileName ) + 1;
|
||||
- command = malloc( stringSize );
|
||||
- command[0] = 0;
|
||||
- strcat( command, "rm -f " );
|
||||
- strcat( command, property.cacheDbFileName );
|
||||
- fprintf( stdout, "%s %s info: executing %s\n", id, VERSION, command );
|
||||
- while( fflush( stdout ) );
|
||||
- system( command );
|
||||
- free( command );
|
||||
-
|
||||
- property.interactive = 1;
|
||||
-
|
||||
- selection = PMUPGRADE;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if( !strcmp( argv[idx], version ) || !strcmp( argv[idx], v ) )
|
||||
- {
|
||||
- selection = VER;
|
||||
- break;
|
||||
- }
|
||||
- idx++;
|
||||
- }
|
||||
-
|
||||
- switch( selection )
|
||||
- {
|
||||
- case VER:
|
||||
- {
|
||||
- fprintf( stdout, "\n%s %s VERSION info:\n", id, VERSION );
|
||||
- break;
|
||||
- }
|
||||
- case PMSTATUS:
|
||||
- {
|
||||
- errorCode = PMGRrStatus(&property);
|
||||
- if(errorCode)
|
||||
- {
|
||||
- fprintf(stderr, "%s %s error: %s returned errorCode %d\n", id, VERSION, "PMGRrStatus", errorCode);
|
||||
- }
|
||||
- break;
|
||||
- }
|
||||
- case PMUPGRADE:
|
||||
- {
|
||||
- errorCode = PMGRrUpgrade(&property);
|
||||
- if(errorCode)
|
||||
- {
|
||||
- fprintf(stderr, "%s %s error: %s returned errorCode %d\n", id, VERSION, "PMGRrUpGrade", errorCode);
|
||||
- }
|
||||
- break;
|
||||
- }
|
||||
- case SHOWLEAVES:
|
||||
- {
|
||||
- PMGRrShowLeaves(&property);
|
||||
- break;
|
||||
- }
|
||||
- case SHOWLEAVESDELETE:
|
||||
- {
|
||||
- PMGRrShowLeavesDelete(&property);
|
||||
- break;
|
||||
- }
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
- exit(0);
|
||||
-}
|
||||
Loading…
Add table
Reference in a new issue