Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Sep 1999 21:29:58 -0500 (CDT)
From:      hetzels@westbend.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/13650: Port Conflict Checking for bsd.port.mk
Message-ID:  <199909090229.VAA58358@spare.westbend.net>

next in thread | raw e-mail | index | archive | help

>Number:         13650
>Category:       ports
>Synopsis:       Port Conflict Checking for bsd.port.mk
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep  8 19:40:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Scot W. Hetzel
>Release:        FreeBSD 3.2-RELEASE i386
>Organization:
West Bend Internet
>Environment:


>Description:

Currently, we have no way of checking our installed ports for conflicting 
files when a port/package is being installed.

With the attached patch to bsd.port.mk and pr bin/13649 (4.0-CURRENT) or
bin/13647 (3.2-STABLE) applied to pkg_install tools or ports collection
will be able to check the system for conflicting ports.

Place the following into a port's Makefile:

CONFLICTS=      apache*-1.2* apache*-1.3.[012345] apache-*+ssl_*

The CONFLICTS variable uses shell meta characters (  []*?<>,<=,>= ), to do
pattern matching on conflicting ports.

will result in @pkgcfl directives in its packing list.

@pkgcfl apache*-1.2*
@pkgcfl apache*-1.3.[012345]
@pkgcfl apache-*+ssl_*

bsd.port.mk will check for conflicting packages during the install of the
port.  If it detects a conflict, it will not install the port until the
offending port is removed from the system.

NOTE: By setting ENABLE_CONFLICTS to NO, it will disable conflict checking
      for the port install and for the building of the port's package.


Currently, the patch is set to allow Conflict checking for CURRENT
(OSVERSION >= 400009) and 3.2-STABLE (OSVERSION >= 320001).  These will need
to be changed to the appropriate values.

>How-To-Repeat:


>Fix:
	
Apply the attached patched to bsd.port.mk.


Index: ports_Mk/bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.318
diff -u -r1.318 bsd.port.mk
--- bsd.port.mk	1999/09/08 06:04:43	1.318
+++ bsd.port.mk	1999/09/09 01:09:53
@@ -185,6 +185,16 @@
 # DEPENDS_TARGET - The default target to execute when a port is calling a
 #				  dependency (default: "install").
 #
+# Conflict checking. Use if your port conflicts with annother port or version.
+#
+# CONFLICTS - A list of package names/patterns that the port conflicts with.
+#
+# For example:
+#	CONFLICTS=      apache*-1.2* apache*-1.3.[012345] apache-*+ssl_* apache<1.3.9
+#
+#  the pkg_install tools use use shell metacharactes for pattern matching (  []*?<>,<=,>= )
+#  (see pkg_info(1))
+#
 # Various directory definitions and variables to control them.
 # You rarely need to redefine any of these except WRKSRC and NO_WRKSUBDIR.
 #
@@ -448,6 +458,19 @@
 .endif
 .endif
 
+# Does the pkg_install tools support Conflict Checking?
+# NOTE: Where should this code belong ([pre]/post/someother location)?
+# NOTE: Needs to be changed to correct OSVERSION for STABLE & CURRENT
+.if ${OSVERSION} >= 400009
+ENABLE_CONFLICTS?=	YES
+.elif ${OSVERSION} < 40000
+.if ${OSVERSION} > 320001
+ENABLE_CONFLICTS?=	YES
+.endif
+.else
+ENABLE_CONFLICTS=	NO
+.endif
+
 # Get the object format.
 .if !defined(PORTOBJFORMAT)
 PORTOBJFORMAT!=	test -x /usr/bin/objformat && /usr/bin/objformat || echo aout
@@ -807,6 +830,11 @@
 PKG_DELETE?=	/usr/sbin/pkg_delete
 .if !defined(PKG_ARGS)
 PKG_ARGS=		-v -c ${COMMENT} -d ${DESCR} -f ${TMPPLIST} -p ${PREFIX} -P "`${MAKE} package-depends | ${GREP} -v -E ${PKG_IGNORE_DEPENDS} | sort -u`" ${EXTRA_PKG_ARGS}
+# Only allow those systems that have the new pkg_create utility to use the CONFLICTS option
+# NOTE: OSVERSION needs to be set to the correct value.
+.if defined(CONFLICTS) && ${ENABLE_CONFLICTS} == YES
+PKG_ARGS+=		-C "${CONFLICTS}"
+.endif
 .if exists(${PKGINSTALL})
 PKG_ARGS+=		-i ${PKGINSTALL}
 .endif
@@ -1378,6 +1406,7 @@
 	  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
 	  DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \
 	  RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \
+	  CONFLICTS="${CONFLICTS}" \
 	${ALL_HOOK}
 .endif
 
@@ -1727,6 +1756,24 @@
 .if make(real-install)
 	@cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} check-categories
 .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
+# We need pkg_info to understand patern matching in order to enable the use of CONFLICTS.
+.if defined(CONFLICTS) && ${ENABLE_CONFLICTS} == YES
+	@${RM} -f ${WRKDIR}/.CONFLICTS
+.for conflict in ${CONFLICTS}
+	@found="`${PKG_INFO} -e \"${conflict}\" || ${TRUE}`"; \
+	if [ X"$$found" != X"" ]; then					\
+		${ECHO} "$$found" >> ${WRKDIR}/.CONFLICTS;		\
+	fi
+.endfor
+	@if [ -s ${WRKDIR}/.CONFLICTS ]; then				\
+		found=`cat ${WRKDIR}/.CONFLICTS | ${SED} -e s'|${PKG_DBDIR}/||g' | tr '\012' ' '`; \
+		${ECHO_MSG} "===>  ${PKGNAME} conflicts with installed package(s): $$found found."; \
+		${ECHO_MSG} "      They install the same files into the same place."; \
+		${ECHO_MSG} "      Please remove $$found first with pkg_delete(1)."; \
+		${RM} -f ${WRKDIR}/.CONFLICTS;				\
+		exit 1;							\
+	fi
+.endif	# CONFLICTS
 	@if [ -d ${PKG_DBDIR}/${PKGNAME} ]; then \
 		${ECHO_MSG} "===>  ${PKGNAME} is already installed - perhaps an older version?"; \
 		${ECHO_MSG} "      If so, you may wish to \`\`make deinstall'' and install"; \

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909090229.VAA58358>