Subject: pkg/25059: support DEPENDS_TARGET="install clean"
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <apb@cequrux.com>
List: pkgsrc-bugs
Date: 04/05/2004 09:56:15
>Number:         25059
>Category:       pkg
>Synopsis:       support DEPENDS_TARGET="install clean"
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 05 07:58:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Alan Barrett
>Release:        NetBSD 1.6ZK
>Organization:
Not much
>Environment:
System: NetBSD 1.6ZK
Architecture: i386
Machine: i386
>Description:
Setting DEPENDS_TARGET to multiple words doesn't work,
because bsd.pkg.mk uses an unquoted ${DEPENDS_TARGET}
in several places where ${DEPENDS_TARGET:Q} would be appropriate.

>How-To-Repeat:

	cd /usr/pkgsrc/meta-pkgs/kde3 # or anything with many dependencies
	make DEPENDS_TARGET="install clean" install clean

Observe that the dependencies are not cleaned immediately, as
one might hope.

>Fix:
Apply the appended patch.

Index: pkgsrc/mk/bsd.pkg.mk
===================================================================
--- bsd.pkg.mk	31 Mar 2004 11:19:09 -0000	1.1434
+++ bsd.pkg.mk	2 Apr 2004 07:42:14 -0000
@@ -3216,7 +3216,7 @@
 	@${TOUCH} ${INTERACTIVE_COOKIE}
 	@${FALSE}
 .else
-	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-extract DEPENDS_TARGET=${DEPENDS_TARGET} PKG_PHASE=extract
+	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-extract DEPENDS_TARGET=${DEPENDS_TARGET:Q} PKG_PHASE=extract
 .endif
 
 ${PATCH_COOKIE}:
@@ -3415,7 +3415,7 @@
 .if !target(reinstall)
 reinstall:
 	${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE} ${PLIST}
-	${_PKG_SILENT}${_PKG_DEBUG}DEPENDS_TARGET=${DEPENDS_TARGET} ${MAKE} ${MAKEFLAGS} install
+	${_PKG_SILENT}${_PKG_DEBUG}DEPENDS_TARGET=${DEPENDS_TARGET:Q} ${MAKE} ${MAKEFLAGS} install
 .endif
 
 # Deinstall
@@ -3508,7 +3508,7 @@
 .endif
 	${_PKG_SILENT}${_PKG_DEBUG}					\
 		${MAKE} ${MAKEFLAGS} ${UPDATE_TARGET} KEEP_WRKDIR=YES	\
-			DEPENDS_TARGET=${DEPENDS_TARGET}
+			DEPENDS_TARGET=${DEPENDS_TARGET:Q}
 	${_PKG_SILENT}${_PKG_DEBUG}					\
 	[ ! -s ${DDIR} ] || for dep in `${CAT} ${DDIR}` ; do		\
 		(if cd ../.. && cd "$${dep}" ; then			\
@@ -3519,7 +3519,7 @@
 				${MAKE} ${MAKEFLAGS} deinstall;		\
 			fi &&						\
 			${MAKE} ${MAKEFLAGS} ${UPDATE_TARGET}		\
-				DEPENDS_TARGET=${DEPENDS_TARGET} ;	\
+				DEPENDS_TARGET=${DEPENDS_TARGET:Q} ;	\
 		else							\
 			${ECHO_MSG} "${_PKGSRC_IN}> Skipping removed directory $${dep}"; \
 		fi) ;							\
@@ -4038,7 +4038,7 @@
 			${SHCOMMENT} Cycle through some FTP server here ;\
 			${ECHO_MSG} "Installing from source" ;		\
 			${MAKE} ${MAKEFLAGS} package 			\
-				DEPENDS_TARGET=${DEPENDS_TARGET} &&	\
+				DEPENDS_TARGET=${DEPENDS_TARGET:Q} &&	\
 			${MAKE} ${MAKEFLAGS} clean ;			\
 		fi ; \
 	fi
@@ -4185,7 +4185,7 @@
 		${ECHO_MSG} "${_PKGSRC_IN}> Required installed package $$pkg: $${found} found"; \
 	else								\
 		${ECHO_MSG} "${_PKGSRC_IN}> Required package $$pkg: NOT found"; \
-		target=${DEPENDS_TARGET};				\
+		target=${DEPENDS_TARGET:Q};				\
 		${ECHO_MSG} "${_PKGSRC_IN}> Verifying $$target for $$dir"; 	\
 		if [ ! -d $$dir ]; then					\
 			${ECHO_MSG} "=> No directory for $$dir.  Skipping.."; \
>Release-Note:
>Audit-Trail:
>Unformatted: