Date: 20 Jun 2004 15:18:48 -0000 From: Thomas-Martin Seck <tmseck@netcologne.de> To: FreeBSD-gnats-submit@FreeBSD.org Cc: thomas-sent@tmseck.homedns.org Subject: ports/68147: [PATCH] bsd.port.mk: allow a port to conflict with itself Message-ID: <20040620151848.4818.qmail@laurel.tmseck.homedns.org> Resent-Message-ID: <200406201520.i5KFKHB7034897@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 68147 >Category: ports >Synopsis: [PATCH] bsd.port.mk: allow a port to conflict with itself >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: Sun Jun 20 15:20:16 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Thomas-Martin Seck >Release: FreeBSD 4.10-STABLE i386 >Organization: a private site in Germany >Environment: FreeBSD ports collection as of June 20th, 2004. >Description: The ports system uses a conflicts checking mechanism to prevent a port that is to be installed from overwriting an existing port's files. This mechanism employs a variable CONFLICTS which is a list of basic regular expressions which are used to check the list of installed ports that were installed using the same PREFIX. With the current checking algorithm it is not allowed for a port to register a conflict with itself. This is eminent when a user wants to force the reinstallation of an already installed port which had defined a self-conflict (see below) by setting FORCE_PKG_REGISTER because then the installation will be prevented with "PKGNAME conflicts with PKGNAME" which is technically correct but not a problem that should prevent the installation since the user explicitly wanted to overwrite the existing installation. So where do self-conflicts come from? Often there are multiple versions of a popular software in the ports tree, depending on the release policies of the upstream vendor. For the sake of example, imagine that we have multiple versions of "myport" with package names of myport-1, myport-2, and myport-3, maybe all maintained by different maintainers. If the maintainer of myport-1 set CONFLICTS to myport-*, myport-1 would correctly conflict with all further and previous versions of myport but also with itself. So the maintainer of myport-1 needs to register a conflict against myport-2, and myport-3. If myport-4 is added, he needs to revisit his conflicts definition and add myport-4. The same applies for the maintainers of myport-{2,3,...}. As long as the ports are actively maintained this might work but I seriously doubt that a port maintained by ports@ will ever be updated that way. As the maintainer of the conflicting squid-2.4, squid-2.5, and the upcoming squid-3.x ports I have been confronted with exactly this problem when the conflicts check was introduced. My first conflicts definition included a self-conflict and was thus criticized. I propose that we allow a port to conflict with itself because the check for a self-conflict is already covered by the check-already-installed target which is run before the check-conflicts target. A self-conflict should silently be discarded since the user expressed that he wants to override the existing installation. >How-To-Repeat: Install these example ports (based upon an example presented by eik@ on freebsd-ports) and force a reinstall. # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # misc/conflicttest1/Makefile # misc/conflicttest1/pkg-descr # misc/conflicttest2/Makefile # misc/conflicttest2/pkg-descr # echo x - misc/conflicttest1/Makefile sed 's/^X//' >misc/conflicttest1/Makefile << 'END-of-misc/conflicttest1/Makefile' X# New ports collection makefile for: conflicttest X# Date created: 19 Jun 2004 X# Whom: Thomas-Martin Seck X# X# $FreeBSD$ X# X XPORTNAME= conflicttest XPORTVERSION= 1.0 XCATEGORIES= misc XMASTER_SITES= # XDISTFILES= X XMAINTAINER= tmseck@netcologne.de XCOMMENT= Version 1 of conflicttest X XCONFLICTS= conflicttest-* X XLATEST_LINK= conflicttest1 X XNO_BUILD= yes X Xdo-install: X @${ECHO_CMD} "===> ${PKGNAME} sucessfully installed" X X.include <bsd.port.mk> END-of-misc/conflicttest1/Makefile echo x - misc/conflicttest1/pkg-descr sed 's/^X//' >misc/conflicttest1/pkg-descr << 'END-of-misc/conflicttest1/pkg-descr' X END-of-misc/conflicttest1/pkg-descr echo x - misc/conflicttest2/Makefile sed 's/^X//' >misc/conflicttest2/Makefile << 'END-of-misc/conflicttest2/Makefile' X# New ports collection makefile for: conflicttest X# Date created: 19 Jun 2004 X# Whom: Thomas-Martin Seck X# X# $FreeBSD$ X# X XPORTNAME= conflicttest XPORTVERSION= 2.0 XCATEGORIES= misc XMASTER_SITES= # XDISTFILES= X XMAINTAINER= tmseck@netcologne.de XCOMMENT= Version 2 of conflicttest X XCONFLICTS= conflicttest-* X XLATEST_LINK= conflicttest2 X XNO_BUILD= yes X Xdo-install: X @${ECHO_CMD} "===> ${PKGNAME} sucessfully installed" X X.include <bsd.port.mk> END-of-misc/conflicttest2/Makefile echo x - misc/conflicttest2/pkg-descr sed 's/^X//' >misc/conflicttest2/pkg-descr << 'END-of-misc/conflicttest2/pkg-descr' X END-of-misc/conflicttest2/pkg-descr exit >Fix: Apply this patch to bsd.port.mk: Index: bsd.port.mk =================================================================== RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v retrieving revision 1.491 diff -u -u -r1.491 bsd.port.mk --- bsd.port.mk 10 Jun 2004 07:30:19 -0000 1.491 +++ bsd.port.mk 20 Jun 2004 14:15:18 -0000 @@ -3093,7 +3093,7 @@ conflicting=0; \ for entry in $${found}; do \ prfx=`${PKG_INFO} -q -p $${entry} 2> /dev/null | ${SED} -ne '1s|^@cwd ||p'`; \ - if [ "x${PREFIX}" = "x$${prfx}" ]; then \ + if [ "x${PREFIX}" = "x$${prfx}" -a "x$${entry}" != "x${PKGNAME}" ]; then \ conflicting=1;\ conflicts_with="$${conflicts_with} $${entry}";\ fi;\ >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040620151848.4818.qmail>