Mon Oct 17 18:08:02 2022 UTC ()
mk: Simplify nokeywords PLIST generation.

Previously there was a static list of commands to filter out, which was always
going to become out of date at some point, as it has since 2009 when @pkgdir
was introduced and those entries have leaked into nokeywords files ever since.

Simply remove any line starting with "@" instead.


(jperkin)
diff -r1.56 -r1.57 pkgsrc/mk/plist/plist.mk

cvs diff -r1.56 -r1.57 pkgsrc/mk/plist/plist.mk (expand / switch to unified diff)

--- pkgsrc/mk/plist/plist.mk 2021/11/30 09:39:50 1.56
+++ pkgsrc/mk/plist/plist.mk 2022/10/17 18:08:02 1.57
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: plist.mk,v 1.56 2021/11/30 09:39:50 jperkin Exp $ 1# $NetBSD: plist.mk,v 1.57 2022/10/17 18:08:02 jperkin Exp $
2# 2#
3# This Makefile fragment handles the creation of PLISTs for use by 3# This Makefile fragment handles the creation of PLISTs for use by
4# pkg_create(8). 4# pkg_create(8).
5# 5#
6# The following variables affect the PLIST generation: 6# The following variables affect the PLIST generation:
7# 7#
8# PLIST_TYPE specifies whether the generated PLIST is derived 8# PLIST_TYPE specifies whether the generated PLIST is derived
9# automatically from the installed files, or if the PLIST entries 9# automatically from the installed files, or if the PLIST entries
10# are listed in files. Valid values are "dynamic" and "static", 10# are listed in files. Valid values are "dynamic" and "static",
11# and the default value is "static". 11# and the default value is "static".
12# 12#
13# PLIST_VARS is the list of names corresponding to automatic variables 13# PLIST_VARS is the list of names corresponding to automatic variables
14# generated by plist.mk to simplify having conditionally-present 14# generated by plist.mk to simplify having conditionally-present
@@ -76,27 +76,29 @@ PLIST_SRC_DFLT+= ${PKGDIR}/${f} @@ -76,27 +76,29 @@ PLIST_SRC_DFLT+= ${PKGDIR}/${f}
76# (2) The package doesn't set GENERATE_PLIST. 76# (2) The package doesn't set GENERATE_PLIST.
77# (3) There are no PLIST files. 77# (3) There are no PLIST files.
78# 78#
79.if !defined(PLIST_SRC) && !defined(GENERATE_PLIST) 79.if !defined(PLIST_SRC) && !defined(GENERATE_PLIST)
80. if !defined(PLIST_SRC_DFLT) || empty(PLIST_SRC_DFLT) 80. if !defined(PLIST_SRC_DFLT) || empty(PLIST_SRC_DFLT)
81PKG_FAIL_REASON+= "Missing PLIST file or PLIST/GENERATE_PLIST definition." 81PKG_FAIL_REASON+= "Missing PLIST file or PLIST/GENERATE_PLIST definition."
82. endif 82. endif
83.endif 83.endif
84 84
85PLIST_SRC?= ${PLIST_SRC_DFLT} 85PLIST_SRC?= ${PLIST_SRC_DFLT}
86 86
87# This is the path to the generated PLIST file. 87# This is the path to the generated PLIST file.
88PLIST= ${WRKDIR}/.PLIST 88PLIST= ${WRKDIR}/.PLIST
89_PLIST_NOKEYWORDS=${PLIST}_nokeywords 89
 90# The nokeywords PLIST file strips out any pkg_create(1) "@" commands.
 91_PLIST_NOKEYWORDS= ${PLIST}_nokeywords
90 92
91###################################################################### 93######################################################################
92 94
93.if (defined(USE_IMAKE) || !empty(USE_TOOLS:Mimake)) 95.if (defined(USE_IMAKE) || !empty(USE_TOOLS:Mimake))
94_IMAKE_MANINSTALL= ${IMAKE_MANINSTALL} 96_IMAKE_MANINSTALL= ${IMAKE_MANINSTALL}
95_PLIST_MANINSTALL= ${IMAKE_MANINSTALL} 97_PLIST_MANINSTALL= ${IMAKE_MANINSTALL}
96.else 98.else
97_IMAKE_MANINSTALL= # empty 99_IMAKE_MANINSTALL= # empty
98_PLIST_MANINSTALL= ${MANINSTALL} 100_PLIST_MANINSTALL= ${MANINSTALL}
99.endif 101.endif
100 102
101_LIBTOOL_EXPAND= \ 103_LIBTOOL_EXPAND= \
102 ${PKGSRC_SETENV} ECHO=${TOOLS_ECHO:Q} GREP=${TOOLS_GREP:Q} \ 104 ${PKGSRC_SETENV} ECHO=${TOOLS_ECHO:Q} GREP=${TOOLS_GREP:Q} \
@@ -256,38 +258,29 @@ _GENERATE_PLIST= ${CAT} /dev/null ${PLIS @@ -256,38 +258,29 @@ _GENERATE_PLIST= ${CAT} /dev/null ${PLIS
256.PHONY: plist 258.PHONY: plist
257plist: ${PLIST} ${_PLIST_NOKEYWORDS} 259plist: ${PLIST} ${_PLIST_NOKEYWORDS}
258 260
259.if (${PLIST_TYPE} == "static") && !empty(PLIST_SRC) 261.if (${PLIST_TYPE} == "static") && !empty(PLIST_SRC)
260${PLIST}: ${PLIST_SRC} 262${PLIST}: ${PLIST_SRC}
261.endif 263.endif
262${PLIST}: 264${PLIST}:
263 ${RUN} ${MKDIR} ${.TARGET:H} 265 ${RUN} ${MKDIR} ${.TARGET:H}
264 ${RUN} { ${_GENERATE_PLIST} } > ${.TARGET}-1src 266 ${RUN} { ${_GENERATE_PLIST} } > ${.TARGET}-1src
265 ${RUN} ${PKGSRC_SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_1_AWK} < ${.TARGET}-1src > ${.TARGET}-2mac 267 ${RUN} ${PKGSRC_SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_1_AWK} < ${.TARGET}-1src > ${.TARGET}-2mac
266 ${RUN} ${PKGSRC_SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_AWK} < ${.TARGET}-2mac > ${.TARGET}-3mag 268 ${RUN} ${PKGSRC_SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_AWK} < ${.TARGET}-2mac > ${.TARGET}-3mag
267 ${RUN} ${PKGSRC_SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_SHLIB_AWK} < ${.TARGET}-3mag > ${.TARGET} 269 ${RUN} ${PKGSRC_SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_SHLIB_AWK} < ${.TARGET}-3mag > ${.TARGET}
268 270
269# for list of keywords see pkg_create(1) 
270${_PLIST_NOKEYWORDS}: ${PLIST} 271${_PLIST_NOKEYWORDS}: ${PLIST}
271 ${RUN} ${AWK} < ${PLIST} > ${.TARGET} ' \ 272 ${RUN} ${AWK} < ${PLIST} > ${.TARGET} ' \
272 BEGIN { \ 273 $$0 ~ /^@/ { next }; \
273 FILTER="@("; \ 
274 FILTER=FILTER"cd|cwd|src|exec|unexec|mode|option";\ 
275 FILTER=FILTER"|owner|group|comment|ignore"; \ 
276 FILTER=FILTER"|ignore_inst|name|dirrm|mtree"; \ 
277 FILTER=FILTER"|display|pkgdep|blddep|pkgcfl"; \ 
278 FILTER=FILTER")[[:space:]]"; \ 
279 }; \ 
280 $$0 ~ FILTER { next }; \ 
281 { print }' 274 { print }'
282 275
283.if defined(INFO_FILES) 276.if defined(INFO_FILES)
284INFO_FILES_cmd= \ 277INFO_FILES_cmd= \
285 ${CAT} ${PLIST} | \ 278 ${CAT} ${PLIST} | \
286 ${PKGSRC_SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_INFO_AWK} | \ 279 ${PKGSRC_SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_INFO_AWK} | \
287 ${AWK} '($$0 !~ "-[0-9]*(\\.gz)?$$") { print }' 280 ${AWK} '($$0 !~ "-[0-9]*(\\.gz)?$$") { print }'
288.endif 281.endif
289 282
290ICON_THEMES_cmd= \ 283ICON_THEMES_cmd= \
291 ${CAT} ${PLIST} | \ 284 ${CAT} ${PLIST} | \
292 ${PKGSRC_SETENV} ${_PLIST_AWK_ENV} ${AWK} -F / \ 285 ${PKGSRC_SETENV} ${_PLIST_AWK_ENV} ${AWK} -F / \
293 '$$0 ~ "^share/icons/[^/]+/.*$$" { print $$3 }' | \ 286 '$$0 ~ "^share/icons/[^/]+/.*$$" { print $$3 }' | \