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: only create cookie after everything is...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2058d67d82ff
branches:  trunk
changeset: 413843:2058d67d82ff
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Mar 22 18:43:46 2020 +0000

description:
mk/subst.mk: only create cookie after everything is finished

When fixing the SUBST definitions in a package, it can hapen that the
substitution aborts in the middle. In such a case the cookie should not
be written and the substitution should be retried. Otherwise the build
may continue with half the substitutions done.

diffstat:

 mk/subst.mk |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (25 lines):

diff -r 4d8a8ec34802 -r 2058d67d82ff mk/subst.mk
--- a/mk/subst.mk       Sun Mar 22 18:38:27 2020 +0000
+++ b/mk/subst.mk       Sun Mar 22 18:43:46 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.70 2020/03/22 13:19:50 rillig Exp $
+# $NetBSD: subst.mk,v 1.71 2020/03/22 18:43:46 rillig Exp $
 #
 # The subst framework replaces text in one or more files in the WRKSRC
 # directory. Packages can define several ``classes'' of replacements.
@@ -174,7 +174,7 @@
                                changed=yes;                            \
                                ${_SUBST_KEEP.${_class_}};              \
                                ${MV} -f "$$tmpfile" "$$file";          \
-                               ${ECHO} "$$file" >> ${.TARGET};         \
+                               ${ECHO} "$$file" >> ${.TARGET}.tmp;     \
                        fi;                                             \
                else                                                    \
                        ${_SUBST_WARN.${_class_}} "Ignoring non-text file \"$$file\"."; \
@@ -186,5 +186,5 @@
        fi; \
        done; \
        ${RMDIR} "$$emptydir"
-       ${RUN} ${TOUCH} ${TOUCH_FLAGS} ${.TARGET:Q}
+       ${RUN} ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp && ${MV} ${.TARGET}.tmp ${.TARGET}
 .endfor



Home | Main Index | Thread Index | Old Index