Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jul 2006 17:20:05 GMT
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 101137 for review
Message-ID:  <200607091720.k69HK5W6037512@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=101137

Change 101137 by gabor@gabor_spitfire on 2006/07/09 17:19:34

	Implement conflict checking in DESTDIR.  This method uses chroot to do
	that, I also made a ${CHROOT} variable for that.
	
	The current TODO list:
	- Implement deinstall from DESTDIR (it will happen with chroot as well)
	- Add some clarification when printing file lists at the end of the
	  installation process
	- Fix dependency handling for DESTDIR, I realized that this is still
	  broken when I tested the current change

Affected files ...

.. //depot/projects/soc2006/gabor_ports/Mk/bsd.port.mk#13 edit

Differences ...

==== //depot/projects/soc2006/gabor_ports/Mk/bsd.port.mk#13 (text+ko) ====

@@ -1032,6 +1032,7 @@
 CHGRP?=		/usr/bin/chgrp
 CHMOD?=		/bin/chmod
 CHOWN?=		/usr/sbin/chown
+CHROOT?=	/usr/sbin/chroot
 COMM?=		/usr/bin/comm
 CP?=		/bin/cp
 CPIO?=		/usr/bin/cpio
@@ -3518,11 +3519,10 @@
 
 # Check conflicts
 
-### FIXME: conflict checking in DESTDIR is temporarly ignored for testing
-
 .if !target(check-conflicts)
 check-conflicts:
-.if defined(CONFLICTS) && !defined(DISABLE_CONFLICTS) && !defined(DESTDIR)
+.if defined(CONFLICTS) && !defined(DISABLE_CONFLICTS)
+.if !defined(DESTDIR)
 	@found=`${PKG_INFO} -I ${CONFLICTS:C/.+/'&'/} 2>/dev/null | ${AWK} '{print $$1}'`; \
 	conflicts_with=; \
 	for entry in $${found}; do \
@@ -3545,6 +3545,30 @@
 		${ECHO_MSG} "      Please remove them first with pkg_delete(1)."; \
 		exit 1; \
 	fi
+.else
+	@found=`${CHROOT} ${DESTDIR} ${PKG_INFO} -I ${CONFLICTS:C/.+/'&'/} 2>/dev/null | ${AWK} '{print $$1}'`; \
+	conflicts_with=; \
+	for entry in $${found}; do \
+		if ${CHROOT} ${DESTDIR} ${PKG_INFO} -e $${entry} ; then \
+			prfx=`${CHROOT} ${DESTDIR} ${PKG_INFO} -q -p "$${entry}" 2> /dev/null | ${SED} -ne '1s/^@cwd //p'`; \
+			orgn=`${CHROOT} ${DESTDIR} ${PKG_INFO} -q -o "$${entry}" 2> /dev/null`; \
+			if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \
+				conflicts_with="$${conflicts_with} $${entry}"; \
+			fi; \
+		fi; \
+	done; \
+	if [ -n "$${conflicts_with}" ]; then \
+		${ECHO_MSG}; \
+		${ECHO_MSG} "===>  ${PKGNAME} conflicts with installed package(s): "; \
+		for entry in $${conflicts_with}; do \
+			${ECHO_MSG} "      $${entry}"; \
+		done; \
+		${ECHO_MSG}; \
+		${ECHO_MSG} "      They install files into the same place."; \
+		${ECHO_MSG} "      Please remove them first with pkg_delete(1)."; \
+		exit 1; \
+	fi
+.endif
 .endif  # CONFLICTS
 .endif
 



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