pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/regress/subst
Module Name: pkgsrc
Committed By: rillig
Date: Sun Mar 17 11:28:13 UTC 2019
Modified Files:
pkgsrc/regress/subst: Makefile PLIST
Added Files:
pkgsrc/regress/subst/files: expected
Removed Files:
pkgsrc/regress/subst: vars.mk
Log Message:
regress/subst: demonstrate that SUBST_VARS doesn't pass newlines
Sure, it's an edge case and has not been necessary until now.
Nevertheless it's good to see how this can be done.
Variables having dots in their names are also not handled completely
correct. This also didn't occur in practice since the variable names
passed to SUBST_VARS are usually A-Za-z0-9_ only.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 pkgsrc/regress/subst/Makefile
cvs rdiff -u -r1.1 -r1.2 pkgsrc/regress/subst/PLIST
cvs rdiff -u -r1.1 -r0 pkgsrc/regress/subst/vars.mk
cvs rdiff -u -r0 -r1.1 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/regress/subst/Makefile
diff -u pkgsrc/regress/subst/Makefile:1.4 pkgsrc/regress/subst/Makefile:1.5
--- pkgsrc/regress/subst/Makefile:1.4 Sun Mar 17 10:19:36 2019
+++ pkgsrc/regress/subst/Makefile Sun Mar 17 11:28:13 2019
@@ -1,30 +1,58 @@
-# $NetBSD: Makefile,v 1.4 2019/03/17 10:19:36 rillig Exp $
+# $NetBSD: Makefile,v 1.5 2019/03/17 11:28:13 rillig Exp $
#
-DISTNAME= subst-1.0
+DISTNAME= subst-19.03
CATEGORIES= regress
DISTFILES= # none
MAINTAINER= pkgsrc-users%NetBSD.org@localhost
COMMENT= Test the SUBST framework
+LICENSE= 2-clause-bsd
WRKSRC= ${WRKDIR}
-USE_TOOLS+= diff
+USE_TOOLS+= diff printf
SUBST_CLASSES+= vars
SUBST_STAGE.vars= do-build
-SUBST_FILES.vars= vars
-SUBST_VARS.vars= PLAIN DQUOT SQUOT DELIM EVIL1
-
-.include "vars.mk"
+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
+
+PLAIN= hello_world
+DQUOT= "hello world"
+SQUOT= 'hello world'
+DELIM= hello, world
+PRINTABLE= !"\#$$%&'()*+,-./09:;<=>?@AZ[\]^_`az{|}
+
+#UNDEFINED= # undefined
+
+# 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}
+
+BACKSLASHES= \" \, \\, \" \' \0\000 \x40 \089 \a \$$
+
+# Ensure that special regex characters may appear in variable names.
+VAR......= dots
+VAR.abcde= letters
+
+do-extract:
+ ${RUN} ${SED} -e /^\#/d -e /^$$/d ${FILESDIR}/expected \
+ > ${WRKSRC}/expected
pre-build:
- for v in ${SUBST_VARS.vars}; do echo "$$v=@$$v@"; done > ${WRKSRC}/vars
+ ${RUN} printf '%s: <@%s@>\n' ${SUBST_VARS.vars:@var@ ${var:Q} ${var:Q} @} \
+ > ${WRKSRC}/vars.before
+ ${RUN} ${CAT} ${WRKSRC}/vars.before > ${WRKSRC}/vars.after
do-build:
@${DO_NADA}
post-build:
- diff -u vars.mk ${WRKSRC}/vars
+ ${RUN} diff -u ${WRKSRC}/expected ${WRKSRC}/vars.after
.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/regress/subst/PLIST
diff -u pkgsrc/regress/subst/PLIST:1.1 pkgsrc/regress/subst/PLIST:1.2
--- pkgsrc/regress/subst/PLIST:1.1 Sat Jun 21 16:15:01 2014
+++ pkgsrc/regress/subst/PLIST Sun Mar 17 11:28:13 2019
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.2 2019/03/17 11:28:13 rillig Exp $
+@comment unused
Added files:
Index: pkgsrc/regress/subst/files/expected
diff -u /dev/null pkgsrc/regress/subst/files/expected:1.1
--- /dev/null Sun Mar 17 11:28:13 2019
+++ pkgsrc/regress/subst/files/expected Sun Mar 17 11:28:13 2019
@@ -0,0 +1,23 @@
+# $NetBSD: expected,v 1.1 2019/03/17 11:28:13 rillig Exp $
+#
+# The expected output from the SUBST_VARS test.
+# Each substituted value is enclosed in <angle brackets> to clearly
+# show where it begins and ends.
+
+PLAIN: <hello_world>
+DQUOT: <"hello world">
+SQUOT: <'hello world'>
+DELIM: <hello, world>
+PRINTABLE: <!"#$%&'()*+,-./09:;<=>?@AZ[\]^_`az{|}>
+
+UNDEFINED: <>
+
+BETWEEN_SPACE: < between spaces >
+BETWEEN_TAB: < between tabs >
+BETWEEN_NL: <>
+
+BACKSLASHES: <\" \, \\, \" \' \0\000 \x40 \089 \a \$>
+
+VAR......: <dots>
+# FIXME: must be <letters> instead of <dots>
+VAR.abcde: <dots>
Home |
Main Index |
Thread Index |
Old Index