Sun Feb 9 22:39:21 2020 UTC ()
mk/bsd.pkg.mk: support spaces in PATH directories

Fixes PR pkg/53959.


(rillig)
diff -r1.2034 -r1.2035 pkgsrc/mk/bsd.pkg.mk
diff -r1.1 -r1.2 pkgsrc/regress/path/spec

cvs diff -r1.2034 -r1.2035 pkgsrc/mk/bsd.pkg.mk (expand / switch to unified diff)

--- pkgsrc/mk/bsd.pkg.mk 2020/01/21 10:56:54 1.2034
+++ pkgsrc/mk/bsd.pkg.mk 2020/02/09 22:39:20 1.2035
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: bsd.pkg.mk,v 1.2034 2020/01/21 10:56:54 kamil Exp $ 1# $NetBSD: bsd.pkg.mk,v 1.2035 2020/02/09 22:39:20 rillig Exp $
2# 2#
3# This file is in the public domain. 3# This file is in the public domain.
4# 4#
5# Please see the pkgsrc/doc/guide manual for details on the 5# Please see the pkgsrc/doc/guide manual for details on the
6# variables used in this make file template. 6# variables used in this make file template.
7# 7#
8# Default sequence for "all" is: 8# Default sequence for "all" is:
9# 9#
10# bootstrap-depends 10# bootstrap-depends
11# fetch 11# fetch
12# checksum 12# checksum
13# depends 13# depends
14# tools 14# tools
@@ -432,28 +432,30 @@ ${FAKEHOMEDIR}: @@ -432,28 +432,30 @@ ${FAKEHOMEDIR}:
432. if !empty(USE_ABI_DEPENDS:M[yY][eE][sS]) 432. if !empty(USE_ABI_DEPENDS:M[yY][eE][sS])
433DEPENDS+= ${ABI_DEPENDS} 433DEPENDS+= ${ABI_DEPENDS}
434BUILD_DEPENDS+= ${BUILD_ABI_DEPENDS} 434BUILD_DEPENDS+= ${BUILD_ABI_DEPENDS}
435. else 435. else
436_BUILD_DEFS+= USE_ABI_DEPENDS 436_BUILD_DEFS+= USE_ABI_DEPENDS
437. endif 437. endif
438.endif 438.endif
439 439
440.if !defined(_PATH_ORIG) 440.if !defined(_PATH_ORIG)
441_PATH_ORIG:= ${PATH} 441_PATH_ORIG:= ${PATH}
442MAKEFLAGS+= _PATH_ORIG=${_PATH_ORIG:Q} 442MAKEFLAGS+= _PATH_ORIG=${_PATH_ORIG:Q}
443.endif 443.endif
444 444
445_PATH_COMPONENTS= ${PREPEND_PATH:[-1..1]} ${_PATH_ORIG:C,:, ,} 445_PATH_COMPONENTS= \
446PATH= ${_PATH_COMPONENTS:ts:} 446 ${PREPEND_PATH:[-1..1]} \
 447 ${_PATH_ORIG:S, ,__space_in_path__,gW:S,:, ,g}
 448PATH= ${_PATH_COMPONENTS:ts::S,__space_in_path__, ,g}
447 449
448################################################################ 450################################################################
449# Many ways to disable a package. 451# Many ways to disable a package.
450# 452#
451# Ignore packages that can't be resold if building for a CDROM. 453# Ignore packages that can't be resold if building for a CDROM.
452# 454#
453# Don't build a package if it's restricted and we don't want to 455# Don't build a package if it's restricted and we don't want to
454# get into that. 456# get into that.
455# 457#
456# Don't attempt to build packages against X if we don't have X. 458# Don't attempt to build packages against X if we don't have X.
457# 459#
458# Don't build a package if it's broken. 460# Don't build a package if it's broken.
459################################################################ 461################################################################

cvs diff -r1.1 -r1.2 pkgsrc/regress/path/spec (expand / switch to unified diff)

--- pkgsrc/regress/path/spec 2020/02/09 22:28:58 1.1
+++ pkgsrc/regress/path/spec 2020/02/09 22:39:21 1.2
@@ -1,26 +1,24 @@ @@ -1,26 +1,24 @@
1#! /bin/sh 1#! /bin/sh
2# $NetBSD: spec,v 1.1 2020/02/09 22:28:58 rillig Exp $ 2# $NetBSD: spec,v 1.2 2020/02/09 22:39:21 rillig Exp $
3# 3#
4# Ensures that the PATH variable can contain spaces, and that commands in 4# Ensures that the PATH variable can contain spaces, and that commands in
5# such directories can be found and executed. 5# such directories can be found and executed.
6# 6#
7# For its own directories (PREFIX, WRKDIR), pkgsrc does not support paths 7# For its own directories (PREFIX, WRKDIR), pkgsrc does not support paths
8# with spaces, though. 8# with spaces, though.
9 9
10do_test() { 10do_test() {
11 env \ 11 env \
12 PATH="/Path with spaces:$PATH:/Path with spaces" \ 12 PATH="/Path with spaces:$PATH:/Path with spaces" \
13 PKGNAME="package-1.0" \ 13 PKGNAME="package-1.0" \
14 $TEST_MAKE \ 14 $TEST_MAKE \
15 -f "../../mk/bsd.pkg.mk" \ 15 -f "../../mk/bsd.pkg.mk" \
16 show-var VARNAME=PATH > "$TEST_OUTFILE" 16 show-var VARNAME=PATH > "$TEST_OUTFILE"
17} 17}
18 18
19check_result() { 19check_result() {
20 exit_status 0 20 exit_status 0
21 21
22 # FIXME: the spaces must be preserved. 22 output_require ":/Path with spaces:"
23 output_require ":/Path:with:spaces:" 23 output_require "/Path with spaces$"
24 # FIXME: the spaces must be preserved. 
25 output_require "/Path:with:spaces$" 
26} 24}