summaryrefslogtreecommitdiff
path: root/mk/subst.mk
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2020-04-18 11:42:34 +0000
committerrillig <rillig@pkgsrc.org>2020-04-18 11:42:34 +0000
commit9c5dba8a137cc76a3a43b9bb0db455b9be874758 (patch)
tree6799ecedfe31efba6caafe9a96c1744aa062f059 /mk/subst.mk
parent3f110a4e04d04397a061de91ace2de7f7caec00e (diff)
downloadpkgsrc-9c5dba8a137cc76a3a43b9bb0db455b9be874758.tar.gz
mk/subst.mk: fix pkglint warnings and notes
Diffstat (limited to 'mk/subst.mk')
-rw-r--r--mk/subst.mk21
1 files changed, 11 insertions, 10 deletions
diff --git a/mk/subst.mk b/mk/subst.mk
index de0b739d73d..099a130a0ba 100644
--- a/mk/subst.mk
+++ b/mk/subst.mk
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.75 2020/04/18 11:32:01 rillig Exp $
+# $NetBSD: subst.mk,v 1.76 2020/04/18 11:42:34 rillig Exp $
#
# The subst framework replaces text in one or more files in the WRKSRC
# directory. Packages can define several ``classes'' of replacements.
@@ -97,7 +97,7 @@ SUBST_SHOW_DIFF?= no
SUBST_NOOP_OK?= yes # only for backwards compatiblity
_VARGROUPS+= subst
-_USR_VARS.subst= SUBST_SHOW_DIFF SUBST_NOOP_OK
+_USER_VARS.subst= SUBST_SHOW_DIFF SUBST_NOOP_OK
_PKG_VARS.subst= SUBST_CLASSES
.for c in ${SUBST_CLASSES}
. for pv in SUBST_STAGE SUBST_MESSAGE SUBST_FILES SUBST_SED SUBST_VARS \
@@ -113,9 +113,9 @@ _LISTED_VARS.subst= SUBST_SED.* SUBST_FILTER_CMD.*
ECHO_SUBST_MSG?= ${STEP_MSG}
-# _SUBST_IS_TEXT_FILE_CMD returns 0 if $$file is a text file.
-_SUBST_IS_TEXT_FILE_CMD?= \
- [ -z "`LC_ALL=C ${TR} -cd '\\0' < "$$file" | ${TR} '\\0' 'x'`" ]
+# _SUBST_IS_TEXT_FILE_CMD exits successfully if $$file is a text file.
+_SUBST_IS_TEXT_FILE_CMD= \
+ [ -z "`LC_ALL=C ${TR} -cd '\\0' < \"$$file\" | ${TR} '\\0' 'x'`" ]
.if ${SUBST_CLASSES:U:O} != ${SUBST_CLASSES:U:O:u}
PKG_FAIL_REASON+= "[subst.mk] duplicate SUBST class in: ${SUBST_CLASSES:O}"
@@ -134,15 +134,16 @@ SUBST_FILTER_CMD.${class}+= -e s,@${v:C|[^A-Za-z0-9_]|\\\\&|gW:Q}@,${${v}:S|\\|\
_SUBST_KEEP.${class}?= LC_ALL=C ${DIFF} -u "$$file" "$$tmpfile" || true
. endif
_SUBST_KEEP.${class}?= ${DO_NADA}
-SUBST_SKIP_TEXT_CHECK.${class}?= no
+SUBST_SKIP_TEXT_CHECK.${class}?= \
+ no
SUBST_NOOP_OK.${class}?= ${SUBST_NOOP_OK}
_SUBST_WARN.${class}= ${${SUBST_NOOP_OK.${class}:tl} == yes:?${INFO_MSG}:${WARNING_MSG}} "[subst.mk:${class}]"
-.if !empty(SUBST_SKIP_TEXT_CHECK.${class}:M[Yy][Ee][Ss])
+. if !empty(SUBST_SKIP_TEXT_CHECK.${class}:M[Yy][Ee][Ss])
_SUBST_IS_TEXT_FILE_CMD.${class}= ${TRUE}
-.else
+. else
_SUBST_IS_TEXT_FILE_CMD.${class}= ${_SUBST_IS_TEXT_FILE_CMD}
-.endif
+. endif
. if defined(SUBST_STAGE.${class})
${SUBST_STAGE.${class}}: subst-${class}
@@ -191,7 +192,7 @@ ${_SUBST_COOKIE.${class}}:
fi; \
done; \
\
- if test "$$changed,${SUBST_NOOP_OK.${class}:tl}" = no,no; then \
+ if ${TEST} "$$changed,${SUBST_NOOP_OK.${class}:tl}" = no,no; then \
${FAIL_MSG} "[subst.mk:${class}] The pattern $$pattern has no effect."; \
fi; \
done; \