Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc mk/subst.mk: always remove temporary file



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2765973e0fa3
branches:  trunk
changeset: 434140:2765973e0fa3
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Jun 11 18:04:41 2020 +0000

description:
mk/subst.mk: always remove temporary file

Fixes PR pkg/55364.

diffstat:

 mk/subst.mk                      |  10 ++++------
 regress/infra-unittests/subst.sh |   8 +++-----
 2 files changed, 7 insertions(+), 11 deletions(-)

diffs (47 lines):

diff -r e683ea954102 -r 2765973e0fa3 mk/subst.mk
--- a/mk/subst.mk       Thu Jun 11 17:57:11 2020 +0000
+++ b/mk/subst.mk       Thu Jun 11 18:04:41 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.95 2020/06/03 10:56:46 gdt Exp $
+# $NetBSD: subst.mk,v 1.96 2020/06/11 18:04:41 rillig Exp $
 #
 # The subst framework replaces text in one or more files in the WRKSRC
 # directory. Packages can define several ``classes'' of replacements.
@@ -204,11 +204,9 @@
                        ${CMP} -s "$$tmpfile" "$$file" && {             \
                                ${AWK} -f ${PKGSRCDIR}/mk/scripts/subst-identity.awk -- ${SUBST_SED.${class}} \
                                && found=$$(LC_ALL=C ${SED} -n ${SUBST_SED.${class}:C,^['"]?s.*,&p,} "$$file") \
-                               && [ -n "$$found" ] && {                \
-                                       changed=yes;                    \
-                                       continue;                       \
-                               };                                      \
-                               ${_SUBST_WARN.${class}} "Nothing changed in \"$$file\"."; \
+                               && [ -n "$$found" ]                     \
+                               && changed=yes                          \
+                               || ${_SUBST_WARN.${class}} "Nothing changed in \"$$file\"."; \
                                ${RM} -f "$$tmpfile";                   \
                                continue;                               \
                        };                                              \
diff -r e683ea954102 -r 2765973e0fa3 regress/infra-unittests/subst.sh
--- a/regress/infra-unittests/subst.sh  Thu Jun 11 17:57:11 2020 +0000
+++ b/regress/infra-unittests/subst.sh  Thu Jun 11 18:04:41 2020 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: subst.sh,v 1.47 2020/06/11 17:57:11 rillig Exp $
+# $NetBSD: subst.sh,v 1.48 2020/06/11 18:04:41 rillig Exp $
 #
 # Tests for mk/subst.mk.
 #
@@ -1388,10 +1388,8 @@
 
        assert_that "$tmpdir/output" --file-is-lines \
                '=> Substituting "id" in file'
-       # demonstrate PR pkg/55364
-       # FIXME: negate
-       if [ ! -f "file.subst.sav" ]; then
-               assert_fail 'FIXME: temporary file still exists\n'
+       if [ -f "file.subst.sav" ]; then
+               assert_fail 'temporary file still exists\n'
        fi
 
        test_case_end



Home | Main Index | Thread Index | Old Index