pkgsrc-Changes archive

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

CVS commit: pkgsrc



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sat Mar 21 12:22:31 UTC 2020

Modified Files:
        pkgsrc/mk: subst.mk
        pkgsrc/regress/infra-unittests: subst.sh

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


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 pkgsrc/mk/subst.mk
cvs rdiff -u -r1.7 -r1.8 pkgsrc/regress/infra-unittests/subst.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/subst.mk
diff -u pkgsrc/mk/subst.mk:1.65 pkgsrc/mk/subst.mk:1.66
--- pkgsrc/mk/subst.mk:1.65     Fri Mar 20 09:00:44 2020
+++ pkgsrc/mk/subst.mk  Sat Mar 21 12:22:31 2020
@@ -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 @@ _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: ${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_}}

Index: pkgsrc/regress/infra-unittests/subst.sh
diff -u pkgsrc/regress/infra-unittests/subst.sh:1.7 pkgsrc/regress/infra-unittests/subst.sh:1.8
--- pkgsrc/regress/infra-unittests/subst.sh:1.7 Sat Mar 21 06:53:18 2020
+++ pkgsrc/regress/infra-unittests/subst.sh     Sat Mar 21 12:22:31 2020
@@ -510,3 +510,31 @@ EOF
 
        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