pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk mk/subst.mk: fix pkglint warnings and notes



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9c72922436a9
branches:  trunk
changeset: 427593:9c72922436a9
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Apr 18 11:42:34 2020 +0000

description:
mk/subst.mk: fix pkglint warnings and notes

diffstat:

 mk/subst.mk |  21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diffs (61 lines):

diff -r 30d3b2627afd -r 9c72922436a9 mk/subst.mk
--- a/mk/subst.mk       Sat Apr 18 11:35:15 2020 +0000
+++ b/mk/subst.mk       Sat Apr 18 11:42:34 2020 +0000
@@ -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_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 @@
 
 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_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 @@
                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; \



Home | Main Index | Thread Index | Old Index