pkgsrc-Changes archive

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

CVS commit: pkgsrc/mk



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sun Mar 22 18:43:46 UTC 2020

Modified Files:
        pkgsrc/mk: subst.mk

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 pkgsrc/mk/subst.mk

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.70 pkgsrc/mk/subst.mk:1.71
--- pkgsrc/mk/subst.mk:1.70     Sun Mar 22 13:19:50 2020
+++ pkgsrc/mk/subst.mk  Sun Mar 22 18:43:46 2020
@@ -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 @@ ${_SUBST_COOKIE.${_class_}}:
                                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 @@ ${_SUBST_COOKIE.${_class_}}:
        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