summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2020-02-11 01:59:30 +0000
committerrillig <rillig@pkgsrc.org>2020-02-11 01:59:30 +0000
commit872881e1cf7e0d4fcc9363935dbba4e464364dc7 (patch)
tree530f574078d5bf79b0abd8e9dad503fb3d87e04f /regress
parentd2ef0ae4ceda010855263a3199c48edb2e34d7ef (diff)
downloadpkgsrc-872881e1cf7e0d4fcc9363935dbba4e464364dc7.tar.gz
mk/pkginstall/files: allow spaces in configuration file names
Fixes PR pkg/42191.
Diffstat (limited to 'regress')
-rw-r--r--regress/conf-files-spaces/DESCR2
-rw-r--r--regress/conf-files-spaces/Makefile28
-rw-r--r--regress/conf-files-spaces/PLIST4
-rw-r--r--regress/conf-files-spaces/spec30
4 files changed, 64 insertions, 0 deletions
diff --git a/regress/conf-files-spaces/DESCR b/regress/conf-files-spaces/DESCR
new file mode 100644
index 00000000000..0a4839dd6c4
--- /dev/null
+++ b/regress/conf-files-spaces/DESCR
@@ -0,0 +1,2 @@
+Demonstrates that the names of CONF_FILES can contain spaces and that
+these can be quoted using backslashes, double quotes or single quotes.
diff --git a/regress/conf-files-spaces/Makefile b/regress/conf-files-spaces/Makefile
new file mode 100644
index 00000000000..af6d469cef3
--- /dev/null
+++ b/regress/conf-files-spaces/Makefile
@@ -0,0 +1,28 @@
+# $NetBSD: Makefile,v 1.1 2020/02/11 01:59:30 rillig Exp $
+#
+# Requires bmake from 2015 or later, since in previous versions, the .for
+# loop did split the variable values strictly on spaces, without taking
+# backslashes or quotes into account.
+
+PKGNAME= conf-files-spaces-2020.02.11
+CATEGORIES= misc
+DISTFILES= # none
+
+COMMENT= Demonstrates spaces in configuration file names
+LICENSE= 2-clause-bsd
+
+BUILD_DIRS= # none
+EGDIR= share/${PKGBASE}
+EGFILES= back\ slash.conf "d quot.conf" 's quot.conf'
+
+.for file in ${EGFILES}
+CONF_FILES+= ${EGDIR}/${file} ${PKG_SYSCONFDIR}/${file}
+.endfor
+
+do-install:
+ mkdir ${DESTDIR}${PREFIX}/${EGDIR}
+.for file in ${EGFILES}
+ ${INSTALL_DATA} /dev/null ${DESTDIR}${PREFIX}/${EGDIR}/${file}
+.endfor
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/regress/conf-files-spaces/PLIST b/regress/conf-files-spaces/PLIST
new file mode 100644
index 00000000000..ab4f64190a4
--- /dev/null
+++ b/regress/conf-files-spaces/PLIST
@@ -0,0 +1,4 @@
+@comment $NetBSD: PLIST,v 1.1 2020/02/11 01:59:30 rillig Exp $
+share/conf-files-spaces/back slash.conf
+share/conf-files-spaces/d quot.conf
+share/conf-files-spaces/s quot.conf
diff --git a/regress/conf-files-spaces/spec b/regress/conf-files-spaces/spec
new file mode 100644
index 00000000000..b5453f658eb
--- /dev/null
+++ b/regress/conf-files-spaces/spec
@@ -0,0 +1,30 @@
+# $NetBSD: spec,v 1.1 2020/02/11 01:59:30 rillig Exp $
+#
+# Up to February 2020, pkgsrc could not handle configuration files with
+# spaces in their names.
+
+do_setup() {
+ $TEST_MAKE deinstall clean
+}
+
+do_test() {
+ PKG_CONFIG=yes $TEST_MAKE install >> "$TEST_OUTFILE"
+
+ sysconfdir=`$TEST_MAKE show-var VARNAME=PKG_SYSCONFDIR`
+ for file in "back slash.conf" "d quot.conf" "s quot.conf"; do
+ test -f "$sysconfdir/$file" || regress_fail "'$file' not found"
+ done
+
+ PKG_CONFIG=yes $TEST_MAKE deinstall >> "$TEST_OUTFILE"
+}
+
+check_result() {
+ exit_status "0"
+ output_require ": copying .*/back slash.conf to .*/back slash.conf"
+ output_require ": copying .*/d quot.conf to .*/d quot.conf"
+ output_require ": copying .*/s quot.conf to .*/s quot.conf"
+}
+
+do_cleanup() {
+ $TEST_MAKE deinstall clean
+}