Date: Sat, 21 Jul 2007 20:10:38 +0200 From: Alexander Leidinger <Alexander@Leidinger.net> To: tmseck-lists@netcologne.de (Thomas-Martin Seck) Cc: freebsd-ports@freebsd.org, portmgr@freebsd.org Subject: Re: Problems with +CONTENTS being messed up by pkg_delete -f Message-ID: <20070721201038.6fe07d20@deskjail> In-Reply-To: <200707201754.l6KHs6Xg010278@bledge.tmseck.homedns.org> References: <20070720133842.385b7bc4@deskjail> <200707201754.l6KHs6Xg010278@bledge.tmseck.homedns.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--MP_hzlS9.L_IqRxq6JjUPrfPTE Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Quoting tmseck-lists@netcologne.de (Thomas-Martin Seck) (Fri, 20 Jul 2007 19:54:06 +0200 (CEST)): > * Alexander Leidinger <Alexander@leidinger.net> [gmane.os.freebsd.devel.ports]: > > > Quoting Robert Noland <rnoland@2hip.net> (Thu, 19 Jul 2007 13:31:42 -0400): > > > >> Ok, so the issue that I hope to address is not really a "portmanager" > >> issue. The original version of package-depends always listed the > >> current version (from ports) in the +CONTENTS file. When that list was > >> passed to sort -u, you ended up with a single dependency for each > >> origin. > >> > >> The new way it takes each direct dependency and adds those, then > >> recursively parses the +CONTENTS file of each of those and adds those > >> entries and finally passes the whole thing to sort -u. This allows for > >> multiple dependencies with the same origin to be listed in the +CONTENTS > >> file. > >> > >> As an example... port a depends on b and c. Port c has a version bump > >> and is updated but technically b doesn't require an update. Now if port > >> a is updated it will get the current version of c and also the old > >> version of c from b. > > > > Ok, I see the problem (in case b depends on c too). This is only an > > issue if you do this by hand instead of using portupgrade (or something > > else), as those tools should correct the dependency in port b to the > > new version of c. If they don't do it, it's a bug in those tools. > > Oh not at all. This will also happen if you install dependencies via > packages when these packages' dependencies do not exactly match what you > have presently installed. > > Example: > > package a-1.0 has a recorded dependency on b-1.0. Meanwhile, b got > upgraded to 1.0_1. > You have b-1.0_1 installed locally and then install port c which depends > on a and use a's package in order to save build time (imagine a being > something in the firefox/xorg-libs range with USE_PACKAGE_DEPENDS set in > your make environment). Hilarity ensues. The old algorithm could recover > from this I guess. Sort of. There would still be a wrong dependency in the db (for port a, but not for port c). As for the current algorithm this only leads to listing a dependency more than once. Normally this is catched by the sort in PKG_ARGS, but as only the origin is the same and not the version number, this fails. To fix it, we can change the sort invocation to include "-t : -k 2". This does fix this issue, but also changes the final sorting order (sorted for origin, and not for package name). Is this an issue? Here's a visualisation. Old sort invocation: printf 'png-1.2.18:graphics/png\nperl-5.8.8:lang/perl5.8\nperl-5.8.8_1:lang/perl5.8\n' | sort -u Result: perl-5.8.8:lang/perl5.8 perl-5.8.8_1:lang/perl5.8 png-1.2.18:graphics/png New sort invocation: printf 'png-1.2.18:graphics/png\nperl-5.8.8:lang/perl5.8\nperl-5.8.8_1:lang/perl5.8\n' | sort -u -t : -k 2 Result: png-1.2.18:graphics/png perl-5.8.8:lang/perl5.8 Attached is the patch for this and the bug when a port has no origin recorded (and the fix for the comment regarding the name of the actual-package-depends target). I haven't tested this much, maybe someone can give it a try in the case where a port has no origin recorded and in the case which is discussed in this thread. If everything is fine and portmgr doesn't object to the change of the final order of the dependencies as recorded in the package, I will submit this for an experimental run on the ports build cluster. > It looks like one is forced to repair the package db with external tools > everytime one does not install from source and from scratch. This was the case before (sort of), but it was not that obvious as now. Bye, Alexander. -- Time is the most valuable thing a man can spend. -- Theophrastus http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 --MP_hzlS9.L_IqRxq6JjUPrfPTE Content-Type: text/x-patch; name=bsd.port.mk.diff Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=bsd.port.mk.diff Index: bsd.port.mk =================================================================== RCS file: /import/FreeBSD-CVS/ports/Mk/bsd.port.mk,v retrieving revision 1.573 diff -u -r1.573 bsd.port.mk --- bsd.port.mk 29 Jun 2007 14:09:39 -0000 1.573 +++ bsd.port.mk 21 Jul 2007 18:03:10 -0000 @@ -732,7 +732,7 @@ # tree as recorded in the Makefiles of the ports # collection, not as recorded in the currently # installed ports. -# actual-package-depends-list +# actual-package-depends # - Like package-depends-list but with the difference # that the dependencies of the currently installed # ports are used instead of the dependencies as @@ -2458,7 +2469,7 @@ DISABLE_CONFLICTS= YES .endif .if !defined(PKG_ARGS) -PKG_ARGS= -v -c -${COMMENT:Q} -d ${DESCR} -f ${TMPPLIST} -p ${PREFIX} -P "`cd ${.CURDIR} && ${MAKE} actual-package-depends | ${GREP} -v -E ${PKG_IGNORE_DEPENDS} | ${SORT} -u`" ${EXTRA_PKG_ARGS} $${_LATE_PKG_ARGS} +PKG_ARGS= -v -c -${COMMENT:Q} -d ${DESCR} -f ${TMPPLIST} -p ${PREFIX} -P "`cd ${.CURDIR} && ${MAKE} actual-package-depends | ${GREP} -v -E ${PKG_IGNORE_DEPENDS} | ${SORT} -u -t : -k 2`" ${EXTRA_PKG_ARGS} $${_LATE_PKG_ARGS} .if !defined(NO_MTREE) PKG_ARGS+= -m ${MTREE_FILE} .endif @@ -5489,6 +5558,10 @@ dir=$${tmp\#\#*/}/$${dir\#\#*/}; \ set -- $$origins; \ while [ $$\# -gt 1 ]; do \ + if [ ! -d "${PORTSDIR}/$$2" ]; then \ + shift; \ + continue; \ + fi \ if [ "$$dir" = "$$2" ]; then \ ${ECHO_CMD} $$1:$$dir; \ if [ -e ${PKG_DBDIR}/$$1/+CONTENTS -a -z "${EXPLICIT_PACKAGE_DEPENDS}" ]; then \ --MP_hzlS9.L_IqRxq6JjUPrfPTE--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070721201038.6fe07d20>