ports/89164: [PATCH] /var/db/pkg/{portname}/+CONTENTS files sometimes contain wrong data
Michael C. Shultz
ringworm01 at gmail.com
Wed Nov 16 18:20:18 UTC 2005
>Number: 89164
>Category: ports
>Synopsis: [PATCH] /var/db/pkg/{portname}/+CONTENTS files sometimes contain wrong data
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Wed Nov 16 18:20:16 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Michael C. Shultz
>Release: FreeBSD 5.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD ringworm.mechee.com 5.4-STABLE FreeBSD 5.4-STABLE #0: Fri Nov 4 06:35:37 PST 2005 root at ringworm.mechee.com:/usr5/obj/usr5/src/sys/RINGWORM5 i386
>Description:
Dependency information in /var/db/pkg/{portname}/+CONTENTS is sometimes
inaccurate, and packing lists for packages made with "make package" are
affected the same way, in the How to repeat section is a way to demonstrate
how this happens.
I've attached a diff for a modified sysutils/portmanager that generates
an error free packing list, this portmanager will patch itself into bsd.ports.mk
so that it is used as the dependency data source when registering ports or creating
packages, even if ports are being installed manually or rebuilt with portupgrade.
Before I include these modifications to the portmanager in the ports tree I think
it is best for someone on the ports team to look this over carefully, if I hear
nothing back on this in a week or so I will go ahead and include these changes into
the normal portmanager through another PR.
>How-To-Repeat:
before installing this version of portmanager do this:
if installed, remove these ports:
ports/databases/db42, databases/p5-BerkeleyDB, security/amavisd-new
cd /usr/ports/databases/p5-BerkeleyDB; make install clean WITH_BDB_VER=42
cd /usr/ports/security/amavisd-new; make install clean
The CONTENTS+ file of amavisd-new is going to report databases/db3 as
a dependency when it is databases/db42 that is really installed.
A work around currently used is to define WITH_BDB_VER=42 in /etc/make.conf,
but is that really a permament solution? I think not.
Now installed the modified portmanager and run
portmanager security/amavisd-new package-depends
You will see that the correct databases/db42 is reported. This version
applies a patch to bsd.ports.mk that allows this correct data to be sent
to pkg_install, so after this portmanager is running repeat the test above
and see for yourself.
The reason why the portmanager solution works is because the data is gathered from
/var/db/pkg/{portnames} and their content files so it is not subjected to the "whims"
of WITH_* settings, it only contains what is actually installed.
I've completed preliminary testing on FreeBSD's 5.4 and 6.0, before I'm satified this
is a ready for the ports tree approx 450 ports will be set back to Oct 1, 2005 then
successfully updated to current status in one run of portmanager on a 5.4 and 6.0
machine. I also test on a 4.11 machine, but that one is slow (AMD 400) so only about
100 ports are tested on it. These tests will take a week or so to complete if no
problems are found, my hope is someone from the ports tree will have reveiwed this
by then.
Installation of the attached portmanager will patch bsd.port.mk and revert the patch
is portmanager is deinstalled. If cvsup or something else overwrites bsd.port.mk
portmanager during an update will discover this and reapply the patch. The process
is'nt fool proof but should work well enough for testing purposes, just understand
I'll improve it before this hits the ports tree.
>Fix:
WARNING for testing only, do not commit to ports tree!!!
--- portmanager-0.3.6.diff begins here ---
diff -ruN portmanager/Makefile portmanager-0.3.6/Makefile
--- portmanager/Makefile Tue Nov 15 19:17:13 2005
+++ portmanager-0.3.6/Makefile Wed Nov 16 08:08:37 2005
@@ -6,8 +6,7 @@
#
PORTNAME= portmanager
-PORTVERSION= 0.3.5
-PORTREVISION= 1
+PORTVERSION= 0.3.6
CATEGORIES= sysutils
MASTER_SITES= http://portmanager.sunsite.dk/distfiles/ \
${MASTER_SITE_SOURCEFORGE}
@@ -59,5 +58,9 @@
post-install:
@${CAT} ${PKGMESSAGE}
+ cd ${PORTSDIR}/Mk;patch<${DATADIR}/patch-bsd.port.mk-0.3.6
+
+pre-deinstall:
+ cd ${PORTSDIR}/Mk;patch -R<${DATADIR}/patch-bsd.port.mk-0.3.6
.include <bsd.port.post.mk>
diff -ruN portmanager/distinfo portmanager-0.3.6/distinfo
--- portmanager/distinfo Tue Nov 15 06:06:08 2005
+++ portmanager-0.3.6/distinfo Wed Nov 16 08:08:37 2005
@@ -1,3 +1,3 @@
-MD5 (portmanager-0.3.5.tar.gz) = b19edf48625ba3565a2b60a0a3f681b0
-SHA256 (portmanager-0.3.5.tar.gz) = e9713a0fd223fb942dca06378f8199b6c5f1e58375201097e55c7ec38fdf2434
-SIZE (portmanager-0.3.5.tar.gz) = 437330
+MD5 (portmanager-0.3.6.tar.gz) = 90c63aedd4c8b3e92cdce1446690c480
+SHA256 (portmanager-0.3.6.tar.gz) = 776e1d5bd4c094b819551020755958e646f9cda1404422cec525d1c9c2d27100
+SIZE (portmanager-0.3.6.tar.gz) = 439431
diff -ruN portmanager/files/patch-0.3.5_1 portmanager-0.3.6/files/patch-0.3.5_1
--- portmanager/files/patch-0.3.5_1 Tue Nov 15 19:17:13 2005
+++ portmanager-0.3.6/files/patch-0.3.5_1 Wed Dec 31 16:00:00 1969
@@ -1,93 +0,0 @@
-diff -ruN ../0.3.5/libMGPM/src/MGPMlogAdd.c ./libMGPM/src/MGPMlogAdd.c
---- ../0.3.5/libMGPM/src/MGPMlogAdd.c Mon Nov 14 13:55:34 2005
-+++ ./libMGPM/src/MGPMlogAdd.c Mon Nov 14 23:17:47 2005
-@@ -48,7 +48,7 @@
- }
-
- logFileStream = fopen( property->logFile->parent.path, "a" );
-- fprintf( logFileStream, "%-25s %-25s\n\t%-25s %-25s %-25s\n", victemName, victemDir, crime, suspectName, suspectDir );
-+ fprintf( logFileStream, "%-35s %-30s\n %-35s %-35s %-30s\n\n", victemName, victemDir, crime, suspectName, suspectDir );
- fclose( logFileStream );
- return( 0 );
- }
-diff -ruN ../0.3.5/libMGPM/src/MGPMrController.c ./libMGPM/src/MGPMrController.c
---- ../0.3.5/libMGPM/src/MGPMrController.c Mon Nov 14 14:46:52 2005
-+++ ./libMGPM/src/MGPMrController.c Tue Nov 15 10:04:32 2005
-@@ -270,6 +270,46 @@
-
- if( path && ( strcmp( path, "PMSTATUS" ) == 0 ) )
- {
-+ property->pmMode = 1; /* fake like we are in single port update */
-+ if( property->resume == 0 )
-+ {
-+ property->cacheDb = MGdbCreate(
-+ property->cacheDbFileName,
-+ property->fieldCacheDbPortDir,
-+ property->fieldCacheDbAvailablePortName,
-+ property->fieldCacheDbMakeFileSize,
-+ property->fieldCacheDbMakeFileTime,
-+ NULL );
-+ MGdbDestroy( property->cacheDb );
-+ if( ( errorCode = MGPMrCreateInstalledDb( property ) ) )
-+ {
-+ fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION,
-+ "MGPMrCreateInstalledDb", errorCode );
-+ return( 1 );
-+ }
-+ if( ( errorCode = MGPMrCreateAllUpdateStatusDb( property ) ) )
-+ {
-+ fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION,
-+ "MGPMrCreateAllUpdateStatusDb", errorCode );
-+ return( 1 );
-+ }
-+ }
-+ if( ( errorCode = MGPMrCreateInstalledDb( property ) ) )
-+ {
-+ fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateStatusDb", errorCode );
-+ return( 1 );
-+ }
-+
-+ if( ( errorCode = MGPMrSinglePortStatus( property ) ) )
-+ {
-+ fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrSinglePortStatus", errorCode );
-+ return( 1 );
-+ }
-+ return( 0 );
-+ }
-+/*
-+ * old way of doing things
-+ *
- if( ( errorCode = MGPMrCreateInstalledDb( property ) ) )
- {
- fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrCreateStatusDb", errorCode );
-@@ -308,7 +348,7 @@
- free( xtermTitle );
- MGPMlogDestroy( property );
- return(0);
-- }
-+*/
-
- if( path && strcmp( path, "PMUPGRADE" ) == 0 )
- {
-diff -ruN ../0.3.5/libMGPM/src/MGPMrSinglePortStatus.c ./libMGPM/src/MGPMrSinglePortStatus.c
---- ../0.3.5/libMGPM/src/MGPMrSinglePortStatus.c Mon Nov 14 14:54:02 2005
-+++ ./libMGPM/src/MGPMrSinglePortStatus.c Mon Nov 14 19:10:08 2005
-@@ -159,7 +159,7 @@
- MGdbAdd( property->oldPortsDb,
- installedPortsDbPortDir,
- installedPortsDbPortName,
-- "1 built with OLD dependency",
-+ "built with OLD dependency",
- oldDependencyName,
- oldDependencyDir,
- NULL );
-@@ -226,7 +226,7 @@
- MGdbAdd( property->oldPortsDb,
- installedPortsDbPortDir,
- installedPortsDbPortName,
-- "2 built with OLD dependency",
-+ "built with OLD dependency",
- MGdbGet( property->dependencyPortsDb,
- MGdbGetRecno( property->dependencyPortsDb ) - 1,
- property->fieldDependencyDbDependencyPortName ),
-Binary files ../0.3.5/portmanager-0.3.6.tar.gz and ./portmanager-0.3.6.tar.gz differ
diff -ruN portmanager/pkg-plist portmanager-0.3.6/pkg-plist
--- portmanager/pkg-plist Sat Nov 5 05:49:10 2005
+++ portmanager-0.3.6/pkg-plist Wed Nov 16 08:08:37 2005
@@ -1,8 +1,10 @@
+ at unexec cd /usr/ports/Mk;patch -R < %D/share/portmanager/patch-bsd.port.mk-0.3.6
@unexec rm -f %D/share/portmanager/3strikes.db 2>/dev/null || true
@unexec rm -f %D/share/portmanager/commandLine.db 2>/dev/null || true
@unexec rm -f %D/share/portmanager/configure.db 2>/dev/null || true
@unexec rm -f %D/share/portmanager/configure.db.temp 2>/dev/null || true
@unexec rm -f %D/share/portmanager/ignore.db 2>/dev/null || true
+ at unexec rm -f %D/share/portmanager/pkg.db || true
@unexec rm -f %D/share/portmanager/portCache.tmp 2>/dev/null || true
@unexec rm -f %D/share/portmanager/ports_available.db 2>/dev/null || true
@unexec rm -f %D/share/portmanager/ports_available_dependencies.db 2>/dev/null || true
@@ -11,6 +13,7 @@
@unexec rm -f %D/share/portmanager/ports_installed.db 2>/dev/null || true
@unexec rm -f %D/share/portmanager/ports_old.db 2>/dev/null || true
%%DATADIR%%/help.txt
+%%DATADIR%%/patch-bsd.port.mk-0.3.6
bin/portmanager
etc/portmanager/pm-020.conf.SAMPLE
include/libMG.h
@@ -20,3 +23,4 @@
lib/libMGPM.so.1
@unexec rmdir %D/etc/portmanager 2>/dev/null || true
@unexec rmdir %D/share/portmanager 2>/dev/null || true
+
--- portmanager-0.3.6.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list