Thu Jun 25 08:45:00 2020 UTC ()
mk: Handle pdksh issue with "set -e" in for loop.

With our current version of pdksh, a "false && something" construct under
"set -e" conditions will continue as it does with other shells, but if the
construct is within a for loop then it exits, causing failures in the
substitution code.  An explicit "|| true" is necessary to avoid this.

Approved during the freeze by wiz.


(jperkin)
diff -r1.100 -r1.101 pkgsrc/mk/subst.mk

cvs diff -r1.100 -r1.101 pkgsrc/mk/subst.mk (expand / switch to unified diff)

--- pkgsrc/mk/subst.mk 2020/06/16 18:13:54 1.100
+++ pkgsrc/mk/subst.mk 2020/06/25 08:45:00 1.101
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: subst.mk,v 1.100 2020/06/16 18:13:54 rillig Exp $ 1# $NetBSD: subst.mk,v 1.101 2020/06/25 08:45:00 jperkin Exp $
2# 2#
3# The subst framework replaces text in one or more files in the WRKSRC 3# The subst framework replaces text in one or more files in the WRKSRC
4# directory. Packages can define several ``classes'' of replacements. 4# directory. Packages can define several ``classes'' of replacements.
5# Each such class defines: 5# Each such class defines:
6# 6#
7# - in which stage of the build process the replacement happens 7# - in which stage of the build process the replacement happens
8# - which files are affected by the replacement 8# - which files are affected by the replacement
9# - which text or pattern is replaced by which replacement text 9# - which text or pattern is replaced by which replacement text
10# 10#
11# A typical example is: 11# A typical example is:
12# 12#
13# SUBST_CLASSES+= prefix 13# SUBST_CLASSES+= prefix
14# SUBST_STAGE.prefix= pre-configure 14# SUBST_STAGE.prefix= pre-configure
@@ -211,24 +211,24 @@ ${_SUBST_COOKIE.${class}}: @@ -211,24 +211,24 @@ ${_SUBST_COOKIE.${class}}:
211 continue; \ 211 continue; \
212 }; \ 212 }; \
213 [ -x "$$file" ] && ${CHMOD} +x "$$tmpfile"; \ 213 [ -x "$$file" ] && ${CHMOD} +x "$$tmpfile"; \
214 found_any=yes; \ 214 found_any=yes; \
215 ${_SUBST_KEEP.${class}}; \ 215 ${_SUBST_KEEP.${class}}; \
216 ${MV} -f "$$tmpfile" "$$file"; \ 216 ${MV} -f "$$tmpfile" "$$file"; \
217 ${ECHO} "$$file" >> ${.TARGET}.tmp; \ 217 ${ECHO} "$$file" >> ${.TARGET}.tmp; \
218 done; \ 218 done; \
219 \ 219 \
220 [ "$$found_any,${SUBST_NOOP_OK.${class}:tl}" = no,no ] && { \ 220 [ "$$found_any,${SUBST_NOOP_OK.${class}:tl}" = no,no ] && { \
221 noop_count="$$noop_count+"; \ 221 noop_count="$$noop_count+"; \
222 noop_patterns="$$noop_patterns$$noop_sep$$pattern"; \ 222 noop_patterns="$$noop_patterns$$noop_sep$$pattern"; \
223 noop_sep=" "; \ 223 noop_sep=" "; \
224 }; \ 224 } || ${TRUE}; \
225 done; \ 225 done; \
226 \ 226 \
227 case $$noop_count in \ 227 case $$noop_count in \
228 ('') ;; \ 228 ('') ;; \
229 (+) ${FAIL_MSG} "[subst.mk:${class}] The filename pattern \"$$noop_patterns\" has no effect.";; \ 229 (+) ${FAIL_MSG} "[subst.mk:${class}] The filename pattern \"$$noop_patterns\" has no effect.";; \
230 (*) ${FAIL_MSG} "[subst.mk:${class}] The filename patterns \"$$noop_patterns\" have no effect.";; \ 230 (*) ${FAIL_MSG} "[subst.mk:${class}] The filename patterns \"$$noop_patterns\" have no effect.";; \
231 esac; \ 231 esac; \
232 ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp; \ 232 ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp; \
233 ${MV} ${.TARGET}.tmp ${.TARGET} 233 ${MV} ${.TARGET}.tmp ${.TARGET}
234.endfor 234.endfor