pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc mk/subst.mk: fix bmake warnings in case of duplicate S...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/47fd3837ed33
branches:  trunk
changeset: 425333:47fd3837ed33
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Mar 21 12:22:31 2020 +0000

description:
mk/subst.mk: fix bmake warnings in case of duplicate SUBST classes

diffstat:

 mk/subst.mk                      |   6 +++---
 regress/infra-unittests/subst.sh |  28 ++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 3 deletions(-)

diffs (57 lines):

diff -r efdb2532bfc2 -r 47fd3837ed33 mk/subst.mk
--- a/mk/subst.mk       Sat Mar 21 11:57:18 2020 +0000
+++ b/mk/subst.mk       Sat Mar 21 12:22:31 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.65 2020/03/20 09:00:44 rillig Exp $
+# $NetBSD: subst.mk,v 1.66 2020/03/21 12:22:31 rillig Exp $
 #
 # The subst framework replaces text in one or more files in the WRKSRC
 # directory. Packages can define several ``classes'' of replacements.
@@ -101,10 +101,10 @@
        [ -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: ${SUBST_CLASSES:O:u}"
+PKG_FAIL_REASON+=      "[subst.mk] duplicate SUBST class in: ${SUBST_CLASSES:O}"
 .endif
 
-.for _class_ in ${SUBST_CLASSES}
+.for _class_ in ${SUBST_CLASSES:O:u}
 _SUBST_COOKIE.${_class_}=      ${WRKDIR}/.subst_${_class_}_done
 
 SUBST_FILTER_CMD.${_class_}?=  LC_ALL=C ${SED} ${SUBST_SED.${_class_}}
diff -r efdb2532bfc2 -r 47fd3837ed33 regress/infra-unittests/subst.sh
--- a/regress/infra-unittests/subst.sh  Sat Mar 21 11:57:18 2020 +0000
+++ b/regress/infra-unittests/subst.sh  Sat Mar 21 12:22:31 2020 +0000
@@ -510,3 +510,31 @@
 
        test_case_end
 fi
+
+
+if test_case_begin "duplicate SUBST class"; then
+
+       create_file "testcase.mk" <<EOF
+SUBST_CLASSES+=                one
+SUBST_CLASSES+=                two
+SUBST_CLASSES+=                one
+
+all:
+       @printf 'fail reason: %s\n' \${PKG_FAIL_REASON} 1>&2
+
+.include "prepare-subst.mk"
+.include "mk/subst.mk"
+EOF
+
+       test_file "testcase.mk" "all" \
+               1> "$tmpdir/stdout" \
+               2> "$tmpdir/stderr" \
+       && exitcode=0 || exitcode=$?
+
+       assert_that "stdout" --file-is-empty
+       assert_that "stderr" --file-is-lines \
+               "fail reason: [subst.mk] duplicate SUBST class in: one one two"
+       assert_that "$exitcode" --equals 0
+
+       test_case_end
+fi



Home | Main Index | Thread Index | Old Index