pkgsrc-Changes archive

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

CVS commit: pkgsrc



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sun Mar 17 12:01:14 UTC 2019

Modified Files:
        pkgsrc/mk: subst.mk
        pkgsrc/regress/subst: Makefile
        pkgsrc/regress/subst/files: expected

Log Message:
mk/subst.mk: substitute embedded newlines, escape dots in variable names


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 pkgsrc/mk/subst.mk
cvs rdiff -u -r1.5 -r1.6 pkgsrc/regress/subst/Makefile
cvs rdiff -u -r1.1 -r1.2 pkgsrc/regress/subst/files/expected

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.58 pkgsrc/mk/subst.mk:1.59
--- pkgsrc/mk/subst.mk:1.58     Fri Nov 30 18:38:19 2018
+++ pkgsrc/mk/subst.mk  Sun Mar 17 12:01:14 2019
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.58 2018/11/30 18:38:19 rillig Exp $
+# $NetBSD: subst.mk,v 1.59 2019/03/17 12:01:14 rillig Exp $
 #
 # This Makefile fragment implements a general text replacement facility.
 # Package makefiles define a ``class'', for each of which a particular
@@ -84,7 +84,7 @@ SUBST_FILTER_CMD.${_class_}?= ${SED} ${S
 SUBST_VARS.${_class_}?=                # none
 SUBST_MESSAGE.${_class_}?=     Substituting "${_class_}" in ${SUBST_FILES.${_class_}}
 .  for v in ${SUBST_VARS.${_class_}}
-SUBST_FILTER_CMD.${_class_}+=  -e s,@${v}@,${${v}:S|\\|\\\\|gW:S|,|\\,|gW:S|&|\\\&|gW:Q},g
+SUBST_FILTER_CMD.${_class_}+=  -e s,@${v:C|[^A-Za-z0-9_]|\\\\&|gW:Q}@,${${v}:S|\\|\\\\|gW:S|,|\\,|gW:S|&|\\\&|gW:S|${.newline}|\\${.newline}|gW:Q},g
 .  endfor
 .  if !empty(SUBST_SHOW_DIFF.${_class_}:Uno:M[Yy][Ee][Ss])
 _SUBST_KEEP.${_class_}?=       ${DIFF} -u "$$file" "$$tmpfile" || true

Index: pkgsrc/regress/subst/Makefile
diff -u pkgsrc/regress/subst/Makefile:1.5 pkgsrc/regress/subst/Makefile:1.6
--- pkgsrc/regress/subst/Makefile:1.5   Sun Mar 17 11:28:13 2019
+++ pkgsrc/regress/subst/Makefile       Sun Mar 17 12:01:14 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2019/03/17 11:28:13 rillig Exp $
+# $NetBSD: Makefile,v 1.6 2019/03/17 12:01:14 rillig Exp $
 #
 
 DISTNAME=      subst-19.03
@@ -18,7 +18,8 @@ SUBST_FILES.vars=     vars.after
 SUBST_VARS.vars=       PLAIN DQUOT SQUOT DELIM PRINTABLE
 SUBST_VARS.vars+=      UNDEFINED
 SUBST_VARS.vars+=      BETWEEN_SPACE BETWEEN_TAB BETWEEN_NL
-SUBST_VARS.vars+=      BACKSLASHES VAR...... VAR.abcde
+SUBST_VARS.vars+=      BACKSLASHES
+SUBST_VARS.vars+=      VAR...... VAR.abcde VAR.<>
 
 PLAIN=         hello_world
 DQUOT=         "hello   world"
@@ -31,14 +32,14 @@ PRINTABLE=  !"\#$$%&'()*+,-./09:;<=>?@AZ[
 # Ensure that leading and trailing whitespace is preserved.
 BETWEEN_SPACE= ${:U }between spaces${:U }
 BETWEEN_TAB=   ${:U    }between tabs${:U       }
-# TODO: currently fails; needs to be fixed in subst.mk
-#BETWEEN_NL=   ${.newline}between newlines${.newline}
+BETWEEN_NL=    ${.newline}between newlines${.newline}
 
 BACKSLASHES=   \" \, \\, \" \' \0\000 \x40 \089 \a \$$
 
 # Ensure that special regex characters may appear in variable names.
 VAR......=     dots
 VAR.abcde=     letters
+VAR.<>=                angle brackets
 
 do-extract:
        ${RUN} ${SED} -e /^\#/d -e /^$$/d ${FILESDIR}/expected \

Index: pkgsrc/regress/subst/files/expected
diff -u pkgsrc/regress/subst/files/expected:1.1 pkgsrc/regress/subst/files/expected:1.2
--- pkgsrc/regress/subst/files/expected:1.1     Sun Mar 17 11:28:13 2019
+++ pkgsrc/regress/subst/files/expected Sun Mar 17 12:01:14 2019
@@ -1,4 +1,4 @@
-# $NetBSD: expected,v 1.1 2019/03/17 11:28:13 rillig Exp $
+# $NetBSD: expected,v 1.2 2019/03/17 12:01:14 rillig Exp $
 #
 # The expected output from the SUBST_VARS test.
 # Each substituted value is enclosed in <angle brackets> to clearly
@@ -14,10 +14,12 @@ UNDEFINED: <>
 
 BETWEEN_SPACE: < between spaces >
 BETWEEN_TAB: < between tabs    >
-BETWEEN_NL: <>
+BETWEEN_NL: <
+between newlines
+>
 
 BACKSLASHES: <\" \, \\, \" \' \0\000 \x40 \089 \a \$>
 
 VAR......: <dots>
-# FIXME: must be <letters> instead of <dots>
-VAR.abcde: <dots>
+VAR.abcde: <letters>
+VAR.<>: <angle brackets>



Home | Main Index | Thread Index | Old Index