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: Thu Apr 23 19:30:29 UTC 2020
Modified Files:
pkgsrc/mk: subst.mk
pkgsrc/regress/infra-unittests: subst.sh
Log Message:
mk/subst.mk: warn about all noop patterns before erroring out
To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 pkgsrc/mk/subst.mk
cvs rdiff -u -r1.22 -r1.23 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.82 pkgsrc/mk/subst.mk:1.83
--- pkgsrc/mk/subst.mk:1.82 Thu Apr 23 19:16:49 2020
+++ pkgsrc/mk/subst.mk Thu Apr 23 19:30:29 2020
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.82 2020/04/23 19:16:49 rillig Exp $
+# $NetBSD: subst.mk,v 1.83 2020/04/23 19:30:29 rillig Exp $
#
# The subst framework replaces text in one or more files in the WRKSRC
# directory. Packages can define several ``classes'' of replacements.
@@ -156,13 +156,16 @@ ${SUBST_STAGE.${class}}: subst-${class}
subst-${class}: ${_SUBST_COOKIE.${class}}
${_SUBST_COOKIE.${class}}:
- ${RUN} \
+ ${RUN} set -u; \
message=${SUBST_MESSAGE.${class}:Q}; \
[ "$$message" ] && ${ECHO_SUBST_MSG} "$$message"; \
\
cd ${WRKSRC}; \
patterns=${SUBST_FILES.${class}:Q}; \
set -f; \
+ noop_count=''; \
+ noop_patterns=''; \
+ noop_sep=''; \
for pattern in $$patterns; do \
set +f; \
changed=no; \
@@ -191,10 +194,18 @@ ${_SUBST_COOKIE.${class}}:
${ECHO} "$$file" >> ${.TARGET}.tmp; \
done; \
\
- [ "$$changed,${SUBST_NOOP_OK.${class}:tl}" = no,no ] \
- && ${FAIL_MSG} "[subst.mk:${class}] The filename pattern \"$$pattern\" has no effect."; \
- done; \
+ [ "$$changed,${SUBST_NOOP_OK.${class}:tl}" = no,no ] && { \
+ noop_count="$$noop_count+"; \
+ noop_patterns="$$noop_patterns$$noop_sep$$pattern"; \
+ noop_sep=" "; \
+ }; \
+ done; \
\
+ case $$noop_count in \
+ ('') ;; \
+ (+) ${FAIL_MSG} "[subst.mk:${class}] The filename pattern \"$$noop_patterns\" has no effect.";; \
+ (*) ${FAIL_MSG} "[subst.mk:${class}] The filename patterns \"$$noop_patterns\" have no effect."; \
+ esac; \
${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp; \
${MV} ${.TARGET}.tmp ${.TARGET}
.endfor
Index: pkgsrc/regress/infra-unittests/subst.sh
diff -u pkgsrc/regress/infra-unittests/subst.sh:1.22 pkgsrc/regress/infra-unittests/subst.sh:1.23
--- pkgsrc/regress/infra-unittests/subst.sh:1.22 Thu Apr 23 19:16:49 2020
+++ pkgsrc/regress/infra-unittests/subst.sh Thu Apr 23 19:30:29 2020
@@ -938,10 +938,10 @@ if test_case_begin "pattern matches only
fi
-if test_case_begin "first filename pattern has no effect"; then
+if test_case_begin "two filename patterns have no effect"; then
- # All patterns of SUBST_FILES should be applied before erroring out.
- # TODO: also warn about file2
+ # All patterns of SUBST_FILES should be applied before erroring out,
+ # to give a complete picture of the situation.
create_file_lines "testcase.mk" \
'SUBST_CLASSES+= id' \
@@ -963,7 +963,8 @@ if test_case_begin "first filename patte
assert_that "out" --file-is-lines \
'=> Substituting "id" in file1 file2' \
'warning: [subst.mk:id] Nothing changed in "file1".' \
- 'fail: [subst.mk:id] The filename pattern "file1" has no effect.' \
+ 'warning: [subst.mk:id] Nothing changed in "file2".' \
+ 'fail: [subst.mk:id] The filename patterns "file1 file2" have no effect.' \
'*** Error code 1' \
'' \
'Stop.' \
Home |
Main Index |
Thread Index |
Old Index