From a476bf2a13a925f8a2c39fe225ee8ed65cd159f7 Mon Sep 17 00:00:00 2001 From: Pav Lucistnik Date: Sat, 12 Feb 2005 21:20:29 +0000 Subject: - Update to 0.2.6_4: * Finally found and fixed the bug haunting portmanager for the past few revisions. Portmanager now "flushes" after droping new records into it's data bases :) * Improvement of database code to handle wider variety of strings/character codes merged from another project that uses libMG. PR: ports/77409 Submitted by: Michael C. Shultz (maintainer) --- ports-mgmt/portmanager/Makefile | 2 +- ports-mgmt/portmanager/files/patch-0.2.6_4 | 310 +++++++++++++++++++++++++++++ 2 files changed, 311 insertions(+), 1 deletion(-) create mode 100644 ports-mgmt/portmanager/files/patch-0.2.6_4 (limited to 'ports-mgmt') diff --git a/ports-mgmt/portmanager/Makefile b/ports-mgmt/portmanager/Makefile index 37ad3e0b3f98..48584ddb6dcd 100644 --- a/ports-mgmt/portmanager/Makefile +++ b/ports-mgmt/portmanager/Makefile @@ -7,7 +7,7 @@ PORTNAME= portmanager PORTVERSION= 0.2.6 -PORTREVISION= 3 +PORTREVISION= 4 #----------------------------------------- #for local use, remove before submitting PR CATEGORIES= sysutils diff --git a/ports-mgmt/portmanager/files/patch-0.2.6_4 b/ports-mgmt/portmanager/files/patch-0.2.6_4 new file mode 100644 index 000000000000..57145dc6cece --- /dev/null +++ b/ports-mgmt/portmanager/files/patch-0.2.6_4 @@ -0,0 +1,310 @@ +diff -bBdruN --exclude=.svn --exclude=.private --exclude=PRIVATE --exclude=HTML --exclude=Makefile --exclude=Makefile.in --exclude=Makefile.am --exclude=STABLE-sysutils::Makefile --exclude=aclocal.m4 --exclude=configure --exclude=configure.ac /usr/home/mike/work/portmanager/tags/0.2.6_3/libMG/src/MGdbAdd.c libMG/src/MGdbAdd.c +--- /usr/home/mike/work/portmanager/tags/0.2.6_3/libMG/src/MGdbAdd.c Tue Feb 8 21:40:10 2005 ++++ libMG/src/MGdbAdd.c Fri Feb 11 12:20:13 2005 +@@ -59,6 +59,12 @@ + break; + } + fprintf( dbFileStream, "%s%c", paramPtr, 0 ); ++ ++ /* ++ * prevents random LINEFEEDS!!! ++ */ ++ while( fflush( dbFileStream ) ); ++ + idx++; + if(idx > db->fieldQty) + { +diff -bBdruN --exclude=.svn --exclude=.private --exclude=PRIVATE --exclude=HTML --exclude=Makefile --exclude=Makefile.in --exclude=Makefile.am --exclude=STABLE-sysutils::Makefile --exclude=aclocal.m4 --exclude=configure --exclude=configure.ac /usr/home/mike/work/portmanager/tags/0.2.6_3/libMG/src/MGdbRead.c libMG/src/MGdbRead.c +--- /usr/home/mike/work/portmanager/tags/0.2.6_3/libMG/src/MGdbRead.c Tue Feb 8 21:40:10 2005 ++++ libMG/src/MGdbRead.c Fri Feb 11 01:10:15 2005 +@@ -73,14 +73,14 @@ + assert(0); + } + +- /***************************************************************/ +- /* set db->fieldQty */ +- /***************************************************************/ ++ /* ++ * set db->fieldQty ++ */ + dataBufferIdx = 0; +- db->fieldQty = 0; +- while( db->dataBuffer[dataBufferIdx] != LINEFEED ) ++ db->fieldQty = 1; ++ while( db->dataBuffer[dataBufferIdx] != 0 || db->dataBuffer[dataBufferIdx+1] != LINEFEED ) + { +- if( !db->dataBuffer[dataBufferIdx] ) ++ if( db->dataBuffer[dataBufferIdx] == 0 ) + { + db->fieldQty++; + } +@@ -95,23 +95,22 @@ + db->parent.recordQty = 0; + while( dataBufferIdx < dataBufferSize ) + { +- while( db->dataBuffer[dataBufferIdx] != LINEFEED ) +- { +- if( !db->dataBuffer[dataBufferIdx] ) ++ if( db->dataBuffer[dataBufferIdx] == 0 ) + { + db->fieldIdx++; +- } +- dataBufferIdx++; +- } ++ if( db->dataBuffer[dataBufferIdx+1] == LINEFEED ) ++ { ++ db->parent.recordQty++; + if( db->fieldIdx != db->fieldQty ) + { + fprintf( stderr, "%s error: inconsitant field count at record %d. field count is %d and should be %d\n", + id, db->parent.recordQty, db->fieldIdx, db->fieldQty ); + assert(0); + } +- dataBufferIdx++; +- db->parent.recordQty++; + db->fieldIdx = 0; ++ } ++ } ++ dataBufferIdx++; + } + + /***************************************************************/ +diff -bBdruN --exclude=.svn --exclude=.private --exclude=PRIVATE --exclude=HTML --exclude=Makefile --exclude=Makefile.in --exclude=Makefile.am --exclude=STABLE-sysutils::Makefile --exclude=aclocal.m4 --exclude=configure --exclude=configure.ac /usr/home/mike/work/portmanager/tags/0.2.6_3/libMG/src/MGdbSeek.c libMG/src/MGdbSeek.c +--- /usr/home/mike/work/portmanager/tags/0.2.6_3/libMG/src/MGdbSeek.c Tue Feb 8 21:40:10 2005 ++++ libMG/src/MGdbSeek.c Fri Feb 11 02:37:16 2005 +@@ -59,15 +59,23 @@ + assert(0); + } + ++ if( !db->record[0][0] ) ++ { ++ fprintf( stderr, "%s error: record 0 field 0 contains nothing!\n", ++ id ); ++ fprintf( stderr, "fieldName = %s\ndb->parent.recordQty = %d\ndb->fieldQty = %d\n", ++ fieldName, db->parent.recordQty, db->fieldQty ); ++ assert(0); ++ } ++ + db->fieldIdx = 0; + while( strcmp( fieldName, db->record[0][db->fieldIdx] ) ) + { + db->fieldIdx++; +- if(db->fieldIdx == db->fieldQty) ++ if( db->fieldIdx >= db->fieldQty ) + { + fprintf( stderr, "%s error: field \"%s\" not found in %s\n", + id, fieldName, db->parent.path ); +- fflush(stderr); + assert(0); + } + } +diff -bBdruN --exclude=.svn --exclude=.private --exclude=PRIVATE --exclude=HTML --exclude=Makefile --exclude=Makefile.in --exclude=Makefile.am --exclude=STABLE-sysutils::Makefile --exclude=aclocal.m4 --exclude=configure --exclude=configure.ac /usr/home/mike/work/portmanager/tags/0.2.6_3/libPMGR/src/PMGRrAddDependencies.c ./libPMGR/src/PMGRrAddDependencies.c +--- /usr/home/mike/work/portmanager/tags/0.2.6_3/libPMGR/src/PMGRrAddDependencies.c Tue Feb 8 21:40:10 2005 ++++ ./libPMGR/src/PMGRrAddDependencies.c Fri Feb 11 12:19:17 2005 +@@ -112,6 +112,17 @@ + + portDependencyDir--; + portDependencyDir[0] = '/'; ++/* ++ * ++ * Just a note: Turns out that I had to run while( fflush( dbFileStream ) ) in MGdbAdd to prevent ++ * random LINEFEEDS from being placed into the data base, that may pop up again somewhere so I'll ++ * leave this comment here in the hope it saves some aggravation in the future ++ * ++ */ ++/* ++printf( "%s %s DEBUG:\nportName-=>%s\nportDependency-=>%s\nportDependencyDir-=>%s\n%s\n", ++id, VERSION, portName, portDependency, portDependencyDir, "marker" ); ++*/ + MGdbAdd( property->dependencyPortsDb, portName, portDependency, portDependencyDir, NULL ); + } + +diff -bBdruN --exclude=.svn --exclude=.private --exclude=PRIVATE --exclude=HTML --exclude=Makefile --exclude=Makefile.in --exclude=Makefile.am --exclude=STABLE-sysutils::Makefile --exclude=aclocal.m4 --exclude=configure --exclude=configure.ac /usr/home/mike/work/portmanager/tags/0.2.6_3/libPMGR/src/PMGRrDbCreate.c ./libPMGR/src/PMGRrDbCreate.c +--- /usr/home/mike/work/portmanager/tags/0.2.6_3/libPMGR/src/PMGRrDbCreate.c Tue Feb 8 21:40:10 2005 ++++ ./libPMGR/src/PMGRrDbCreate.c Fri Feb 11 03:34:14 2005 +@@ -41,15 +41,6 @@ + property->objIdx = 0; + + /***************************************************************/ +- /* convert pm-020.conf to config.db */ +- /***************************************************************/ +- PMGRrReadConfigure( property ); +- +- /*zzzzzzzzzzzzzz*/ +- property->objIdx++; +- property->configDb = MGdbOpen( property->configDbFileName ); +- /*zzzzzzzzzzzzzz*/ +- /***************************************************************/ + /* add any ignored ports in config.db to ignore.db */ + /***************************************************************/ + IDX_configDb = 1; +diff -bBdruN --exclude=.svn --exclude=.private --exclude=PRIVATE --exclude=HTML --exclude=Makefile --exclude=Makefile.in --exclude=Makefile.am --exclude=STABLE-sysutils::Makefile --exclude=aclocal.m4 --exclude=configure --exclude=configure.ac /usr/home/mike/work/portmanager/tags/0.2.6_3/libPMGR/src/PMGRrDbDestroy.c ./libPMGR/src/PMGRrDbDestroy.c +--- /usr/home/mike/work/portmanager/tags/0.2.6_3/libPMGR/src/PMGRrDbDestroy.c Tue Feb 8 21:40:10 2005 ++++ ./libPMGR/src/PMGRrDbDestroy.c Fri Feb 11 03:36:08 2005 +@@ -27,9 +27,6 @@ + char id[] = "PMGRrDbDestroy"; + + property->objIdx--; +- MGdbDestroy( property->configDb ); +- +- property->objIdx--; + MGdbDestroy( property->installedPortsDb ); + + property->objIdx--; +diff -bBdruN --exclude=.svn --exclude=.private --exclude=PRIVATE --exclude=HTML --exclude=Makefile --exclude=Makefile.in --exclude=Makefile.am --exclude=STABLE-sysutils::Makefile --exclude=aclocal.m4 --exclude=configure --exclude=configure.ac /usr/home/mike/work/portmanager/tags/0.2.6_3/libPMGR/src/PMGRrShowLeavesDelete.c ./libPMGR/src/PMGRrShowLeavesDelete.c +--- /usr/home/mike/work/portmanager/tags/0.2.6_3/libPMGR/src/PMGRrShowLeavesDelete.c Tue Feb 8 21:40:10 2005 ++++ ./libPMGR/src/PMGRrShowLeavesDelete.c Fri Feb 11 04:09:26 2005 +@@ -22,6 +22,11 @@ + /************************************************************************/ + #include + #include ++ ++int nuke( char* leafPortDir, char* leafPortName ); ++int rebuildDb( structProperty* property, int* idx ); ++int removePort( char* leafPortName ); ++ + int PMGRrShowLeavesDelete( structProperty* property ) + { + char id[] = "PMGRrShowLeavesDelete"; +@@ -147,7 +152,7 @@ + { + /* nuke() */ + fprintf( stdout, " Nuking %s\n\n", leafPortName ); +- removePort( leafPortDir, leafPortName ); ++ removePort( leafPortName ); + nuke( leafPortDir, leafPortName ); + rebuildDb( property, &idx ); + break; +@@ -156,7 +161,7 @@ + { + /* nuke() */ + fprintf( stdout, " Nuking %s\n\n", leafPortName ); +- removePort( leafPortDir, leafPortName ); ++ removePort( leafPortName ); + nuke( leafPortDir, leafPortName ); + rebuildDb( property, &idx ); + break; +@@ -165,7 +170,7 @@ + { + /* delete() */ + fprintf( stdout, " Removing %s\n\n", leafPortName ); +- removePort( leafPortDir, leafPortName ); ++ removePort( leafPortName ); + rebuildDb( property, &idx ); + break; + } +@@ -173,7 +178,7 @@ + { + /* delete() */ + fprintf( stdout, " Removing %s\n\n", leafPortName ); +- removePort( leafPortDir, leafPortName ); ++ removePort( leafPortName ); + rebuildDb( property, &idx ); + break; + } +@@ -199,7 +204,7 @@ + } + + /***********************************************************************/ +-int removePort( char* leafPortDir, char* leafPortName ) ++int removePort( char* leafPortName ) + { + char* command = NULL; + int stringSize = 0; +@@ -240,6 +245,7 @@ + return( 0 ); + } + ++/***********************************************************************/ + int rebuildDb( structProperty* property, int* idx ) + { + int errorCode = 0; +diff -bBdruN --exclude=.svn --exclude=.private --exclude=PRIVATE --exclude=HTML --exclude=Makefile --exclude=Makefile.in --exclude=Makefile.am --exclude=STABLE-sysutils::Makefile --exclude=aclocal.m4 --exclude=configure --exclude=configure.ac /usr/home/mike/work/portmanager/tags/0.2.6_3/libPMGR/src/PMGRrUpgrade.c ./libPMGR/src/PMGRrUpgrade.c +--- /usr/home/mike/work/portmanager/tags/0.2.6_3/libPMGR/src/PMGRrUpgrade.c Wed Feb 9 07:27:45 2005 ++++ ./libPMGR/src/PMGRrUpgrade.c Fri Feb 11 03:44:54 2005 +@@ -56,11 +56,6 @@ + + /*zzzzzzzzzzzzzzzzz*/ + property->objIdx++; +- property->configDb = MGdbOpen( property->configDbFileName ); +- /*zzzzzzzzzzzzzzzzz*/ +- +- /*zzzzzzzzzzzzzzzzz*/ +- property->objIdx++; + property->installedPortsDb = MGdbOpen( property->installedPortsDbFileName ); + /*zzzzzzzzzzzzzzzzz*/ + +@@ -324,12 +319,16 @@ + property->fieldInstalledPortName, + dependencyPortName, + property->fieldInstalledPortDir ); ++ /* ++ * if !origDir then likely the dependency port has ++ * been updated????? Going to just skip this one... ++ */ + if( !origDir ) + { + fprintf( stderr, + "%s is not located in property->installedPortsDb!\n", + dependencyPortName ); +- assert(0); ++ continue; + } + fprintf( stdout, "\tin %s/+CONTENTS ORIG dir = %s \n\n", + dependencyPortName, origDir ); +diff -bBdruN --exclude=.svn --exclude=.private --exclude=PRIVATE --exclude=HTML --exclude=Makefile --exclude=Makefile.in --exclude=Makefile.am --exclude=STABLE-sysutils::Makefile --exclude=aclocal.m4 --exclude=configure --exclude=configure.ac /usr/home/mike/work/portmanager/tags/0.2.6_3/portmanager/portmanager.1 ./portmanager/portmanager.1 +--- /usr/home/mike/work/portmanager/tags/0.2.6_3/portmanager/portmanager.1 Tue Feb 8 21:40:08 2005 ++++ ./portmanager/portmanager.1 Wed Feb 9 21:00:11 2005 +@@ -61,6 +61,29 @@ + .It + \fB\&-v\fR portmanager version + .El ++.sp ++ \fBWeb site\fR ++.sp ++http://portmanager.sunsite.dk/ ++.sp ++ \fBMail lists\fR ++.sp ++portmanager-questions@sunsite.dk ++.sp ++To subscribe send an empty message to: ++ portmanager-questions-subscribe@sunsite.dk ++.sp ++ archive: http://www.mail-archive.com/portmanager-questions%40sunsite.dk/ ++.sp ++.sp ++If you would like to joint portmanager's developement team let us know at: ++portmanager-devel@sunsite.dk ++.sp ++To subscribe send an empty message to: ++ portmanager-devel-subscribe@sunsite.dk ++.sp ++ archive: http://www.mail-archive.com/portmanager-devel%40sunsite.dk/ ++.sp + .\"======================================================================= + .\".Sh IMPLEMENTATION NOTES + .\"======================================================================= +diff -bBdruN --exclude=.svn --exclude=.private --exclude=PRIVATE --exclude=HTML --exclude=Makefile --exclude=Makefile.in --exclude=Makefile.am --exclude=STABLE-sysutils::Makefile --exclude=aclocal.m4 --exclude=configure --exclude=configure.ac /usr/home/mike/work/portmanager/tags/0.2.6_3/portmanager/portmanager.c ./portmanager/portmanager.c +--- /usr/home/mike/work/portmanager/tags/0.2.6_3/portmanager/portmanager.c Tue Feb 8 21:40:08 2005 ++++ ./portmanager/portmanager.c Fri Feb 11 04:06:15 2005 +@@ -34,7 +34,6 @@ + void rHelp( char* id ); + int main( int argc, char** argv ) + { +- FILE* handle = NULL; + char h[] = "-h"; + char help[] = "--help"; + char id[] = "portmanager"; +@@ -113,6 +112,11 @@ + property.field3strikesPortDir, + property.fieldStrikes, + NULL ); ++ /* ++ * convert pm-020.conf to config.db ++ */ ++ PMGRrReadConfigure( &property ); ++ property.configDb = MGdbOpen( property.configDbFileName ); + + idx = 1; + while( idx < argc ) -- cgit v1.2.3