PERFORCE change 101140 for review

Gabor Kovesdan gabor at FreeBSD.org
Sun Jul 9 17:52:49 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=101140

Change 101140 by gabor at gabor_spitfire on 2006/07/09 17:51:53

	- Implement deinstalling from DESTDIR
	- PKG_* macros for pkg_* tools have to be always relative to
	  DESTDIR since we use chrooting
	- PKGINSTALLVER are determined from DESTDIR as well

Affected files ...

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

Differences ...

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

@@ -2211,11 +2211,11 @@
 .if ${OSVERSION} < 491101 && ${PKGORIGIN} != "sysutils/pkg_install"
 EXTRACT_DEPENDS+=	${LOCALBASE}/sbin/pkg_info:${PORTSDIR}/sysutils/pkg_install
 .endif
-PKG_CMD?=		${LOCALBASE}/sbin/pkg_create
-PKG_ADD?=		${LOCALBASE}/sbin/pkg_add
-PKG_DELETE?=	${LOCALBASE}/sbin/pkg_delete
-PKG_INFO?=		${LOCALBASE}/sbin/pkg_info
-PKG_VERSION?=		${LOCALBASE}/sbin/pkg_version
+PKG_CMD?=		${LOCALBASE_REL}/sbin/pkg_create
+PKG_ADD?=		${LOCALBASE_REL}/sbin/pkg_add
+PKG_DELETE?=	${LOCALBASE_REL}/sbin/pkg_delete
+PKG_INFO?=		${LOCALBASE_REL}/sbin/pkg_info
+PKG_VERSION?=		${LOCALBASE_REL}/sbin/pkg_version
 .else
 PKG_CMD?=		/usr/sbin/pkg_create
 PKG_ADD?=		/usr/sbin/pkg_add
@@ -2227,7 +2227,7 @@
 # Does the pkg_create tool support conflict checking?
 # XXX Slow?
 .if !defined(PKGINSTALLVER)
-PKGINSTALLVER!= ${PKG_INFO} -P 2>/dev/null | ${SED} -e 's/.*: //'
+PKGINSTALLVER!= ${CHROOT} ${DESTDIR} ${PKG_INFO} -P 2>/dev/null | ${SED} -e 's/.*: //'
 .endif
 .if ${PKGINSTALLVER} < 20030417
 DISABLE_CONFLICTS=	YES
@@ -4172,8 +4172,6 @@
 #
 # Special target to remove installation
 
-### FIXME: deinstall from DESTDIR
-
 .if !target(deinstall)
 deinstall:
 .if ${UID} != 0 && !defined(INSTALL_AS_USER)
@@ -4182,6 +4180,7 @@
 		${SU_CMD} "${MAKE} ${__softMAKEFLAGS} ${.TARGET}"
 	@${ECHO_MSG} "===>  Returning to user credentials"
 .else
+.if !defined(DESTDIR)
 	@${ECHO_MSG} "===>  Deinstalling for ${PKGORIGIN}"
 	@found_names=`${PKG_INFO} -q -O ${PKGORIGIN}`; \
 	for p in $${found_names}; do \
@@ -4200,6 +4199,26 @@
 			${ECHO_MSG} "===>   ${PKGBASE} not installed, skipping"; \
 	fi
 	@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
+.else
+	@${ECHO_MSG} "===>  Deinstalling for ${PKGORIGIN} from ${DESTDIR}"
+	@found_names=`${CHROOT} ${DESTDIR} ${PKG_INFO} -q -O ${PKGORIGIN}`; \
+	for p in $${found_names}; do \
+			check_name=`${ECHO_CMD} $${p} | ${SED} -e 's/-[^-]*$$//'`; \
+			if [ "$${check_name}" = "${PKGBASE}" ]; then \
+					prfx=`${CHROOT} ${DESTDIR} ${PKG_INFO} -q -p $${p} 2> /dev/null | ${SED} -ne '1s|^@cwd ||p'`; \
+					if [ "x${PREFIX}" = "x$${prfx}" ]; then \
+							${ECHO_MSG} "===>   Deinstalling $${p}"; \
+							${CHROOT} ${DESTDIR} ${PKG_DELETE} -f $${p}; \
+					else \
+							${ECHO_MSG} "===>   $${p} has a different PREFIX: $${prfx}, skipping"; \
+					fi; \
+			fi; \
+	done; \
+	if [ -z "$${found_names}" ]; then \
+			${ECHO_MSG} "===>   ${PKGBASE} not installed in ${DESTDIR}, skipping"; \
+	fi
+	@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
+.endif
 .endif
 .endif
 


More information about the p4-projects mailing list