Subject: Re: +BUILD_INFO for Perl modules correct?
To: None <tech-pkg@NetBSD.org>
From: Klaus Heinz <k.heinz.mai.sieben@kh-22.de>
List: tech-pkg
Date: 05/16/2007 16:52:31
--tEFtbjk+mNEviIIX
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

Hi,

  [ this was about changes to mk/flavor/pkg/metadata.mk to prevent
    recording a requirement for /lib/libc.so.12 because something like
    "ldd @unexec /bin/rmdir" was executed ]

Since Jörg Sonnenberger had doubts about the correctness of the previous
patches and to avoid changing several awk expressions I have reworked my
solution.

Instead of filtering out those keywords in several places I would like
to introduce a temporary file ${PLIST_NOKEYWORDS} which does not contain
any of the allowed keywords mentioned in pkg_create(1). All affected
statements in metadata.mk use ${PLIST_NOKEYWORDS} instead of ${PLIST}.

This solution requires small changes to mk/plist/plist.mk in addition to
mk/flavor/pkg/metadata.mk.

ciao
     Klaus

--tEFtbjk+mNEviIIX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="plist.mk.diff-nokeywords"

Index: plist.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/plist/plist.mk,v
retrieving revision 1.22
diff -u -r1.22 plist.mk
--- plist.mk	19 Apr 2007 23:13:42 -0000	1.22
+++ plist.mk	16 May 2007 14:46:45 -0000
@@ -64,6 +64,7 @@
 
 # This is the path to the generated PLIST file.
 PLIST=		${WRKDIR}/.PLIST
+_PLIST_NOKEYWORDS=${PLIST}.nokeywords
 
 ######################################################################
 
@@ -229,7 +230,7 @@
 .endif
 
 .PHONY: plist
-plist: ${PLIST}
+plist: ${PLIST} ${_PLIST_NOKEYWORDS}
 
 .if ${PLIST_TYPE} == "static"
 ${PLIST}: ${PLIST_SRC}
@@ -242,6 +243,20 @@
 	${SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_SHLIB_AWK}		\
 		> ${.TARGET}
 
+# for list of keywords see pkg_create(1)
+${_PLIST_NOKEYWORDS}: ${PLIST}
+	${_PKG_SILENT}${_PKG_DEBUG} ${AWK} < ${PLIST} > ${.TARGET} '	\
+		BEGIN {							\
+			FILTER="@(";					\
+			FILTER=FILTER"cd|cwd|src|exec|unexec|mode|option";\
+			FILTER=FILTER"|owner|group|comment|ignore";	\
+			FILTER=FILTER"|ignore_inst|name|dirrm|mtree";	\
+			FILTER=FILTER"|display|pkgdep|blddep|pkgcfl";	\
+			FILTER=FILTER")[[:space:]]";			\
+		};							\
+		$$0 ~ FILTER { next };					\
+		{ print }'
+
 .if defined(INFO_FILES)
 INFO_FILES_cmd=								\
 	${CAT} ${PLIST} |						\

--tEFtbjk+mNEviIIX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="metadata.mk.diff-nokeywords"

Index: metadata.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/metadata.mk,v
retrieving revision 1.19
diff -u -r1.19 metadata.mk
--- metadata.mk	1 May 2007 12:41:10 -0000	1.19
+++ metadata.mk	16 May 2007 14:49:03 -0000
@@ -61,14 +61,14 @@
 	"")	ldd=`${TYPE} ldd 2>/dev/null | ${AWK} '{ print $$NF }'` ;; \
 	*)	ldd=${LDD:Q} ;;						\
 	esac;								\
-	bins=`${AWK} '/(^|\/)(bin|sbin|libexec)\// { print "${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
+	bins=`${AWK} '/(^|\/)(bin|sbin|libexec)\// { print "${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${_PLIST_NOKEYWORDS}`; \
 	case ${OBJECT_FMT:Q}"" in					\
 	ELF)								\
-		libs=`${AWK} '/(^|\/)lib\/lib.*\.so\.[0-9]+$$/ { print "${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
+		libs=`${AWK} '/(^|\/)lib\/lib.*\.so\.[0-9]+$$/ { print "${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${_PLIST_NOKEYWORDS}`; \
 		if ${TEST} -n "$$bins" -o -n "$$libs"; then		\
 			requires=`($$ldd $$bins $$libs 2>/dev/null || ${TRUE}) | ${AWK} '$$2 == "=>" && $$3 ~ "/" { print $$3 }' | ${SORT} -u`; \
 		fi;							\
-		linklibs=`${AWK} '/[^@].*\.so\.[0-9\.]+$$/ { print "${DESTDIR}${PREFIX}/" $$0 }' ${PLIST}`; \
+		linklibs=`${AWK} '/.*\.so\.[0-9\.]+$$/ { print "${DESTDIR}${PREFIX}/" $$0 }' ${_PLIST_NOKEYWORDS}`; \
 		for i in $$linklibs; do					\
 			if ${TEST} -r $$i -a ! -x $$i -a ! -h $$i; then	\
 				${TEST} ${PKG_DEVELOPER:Uno:Q}"" = "no" || \
@@ -78,7 +78,7 @@
 		done;							\
 		;;							\
 	Mach-O)								\
-		libs=`${AWK} '/(^|\/)lib\/lib.*\.dylib/ { print "${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
+		libs=`${AWK} '/(^|\/)lib\/lib.*\.dylib/ { print "${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${_PLIST_NOKEYWORDS}`; \
 		if ${TEST} "$$bins" != "" -o "$$libs" != ""; then	\
 			requires=`($$ldd $$bins $$libs 2>/dev/null || ${TRUE}) | ${AWK} '/compatibility version/ { print $$1 }' | ${SORT} -u`; \
 		fi;							\

--tEFtbjk+mNEviIIX--