Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc mk/subst.mk: properly detect s,a,a,1 as identity subst...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2349a2aa6930
branches:  trunk
changeset: 431752:2349a2aa6930
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat May 16 12:43:10 2020 +0000

description:
mk/subst.mk: properly detect s,a,a,1 as identity substitution

Seen in games/bastet.  The 1 is not necessary though since it only
repeats the default behavior of sed.

diffstat:

 games/bastet/Makefile            |  4 ++--
 mk/scripts/subst-identity.awk    |  4 ++--
 regress/infra-unittests/subst.sh |  5 ++++-
 3 files changed, 8 insertions(+), 5 deletions(-)

diffs (57 lines):

diff -r a43ebe9db655 -r 2349a2aa6930 games/bastet/Makefile
--- a/games/bastet/Makefile     Sat May 16 12:31:11 2020 +0000
+++ b/games/bastet/Makefile     Sat May 16 12:43:10 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.23 2020/05/06 14:04:31 adam Exp $
+# $NetBSD: Makefile,v 1.24 2020/05/16 12:43:10 rillig Exp $
 
 DISTNAME=      bastet-0.43.2
 PKGREVISION=   2
@@ -22,7 +22,7 @@
 SUBST_STAGE.vardir=    pre-configure
 SUBST_FILES.vardir=    Config.cpp
 SUBST_MESSAGE.vardir=  Fixing VARBASE.
-SUBST_SED.vardir=      -e "s|/var/games|${VARBASE}/games|1"
+SUBST_SED.vardir=      -e "s|/var/games|${VARBASE}/games|"
 
 REQD_FILES_PERMS+=     /dev/null ${VARBASE}/games/bastet.scores2 ${GAMEDATA_PERMS}
 
diff -r a43ebe9db655 -r 2349a2aa6930 mk/scripts/subst-identity.awk
--- a/mk/scripts/subst-identity.awk     Sat May 16 12:31:11 2020 +0000
+++ b/mk/scripts/subst-identity.awk     Sat May 16 12:43:10 2020 +0000
@@ -1,5 +1,5 @@
 #! /usr/bin/awk -f
-# $NetBSD: subst-identity.awk,v 1.3 2020/05/11 19:52:14 rillig Exp $
+# $NetBSD: subst-identity.awk,v 1.4 2020/05/16 12:43:10 rillig Exp $
 #
 # Tests whether a sed(1) command line consists of only identity substitutions
 # like s,id,id,.
@@ -45,7 +45,7 @@
        pat_from = substr(s, 3, i - 3);
 
        subst = "s" sep pat_from sep pat_to sep;
-       return s == subst || s == subst "g";
+       return s == subst || s == subst "g" || s == subst "1";
 }
 
 function main(   i) {
diff -r a43ebe9db655 -r 2349a2aa6930 regress/infra-unittests/subst.sh
--- a/regress/infra-unittests/subst.sh  Sat May 16 12:31:11 2020 +0000
+++ b/regress/infra-unittests/subst.sh  Sat May 16 12:43:10 2020 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: subst.sh,v 1.40 2020/05/12 05:34:04 rillig Exp $
+# $NetBSD: subst.sh,v 1.41 2020/05/16 12:43:10 rillig Exp $
 #
 # Tests for mk/subst.mk.
 #
@@ -1192,6 +1192,9 @@
        assert_identity 'no'    -e 's,^a,^a,'
        assert_identity 'no'    -e 's,\(^aaa\)aaa,\(^aaa\)aaa,'
 
+       # Seen in games/bastet before 2020-05-16.
+       assert_identity 'yes'   -e 's,a,a,1'
+
        test_case_end
 fi
 



Home | Main Index | Thread Index | Old Index