Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] xbps-src: quote wrksrc to allow whitespace
@ 2020-09-02 17:05 Chocimier
  2020-09-03 19:03 ` [PR PATCH] [Merged]: " Chocimier
  0 siblings, 1 reply; 2+ messages in thread
From: Chocimier @ 2020-09-02 17:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 576 bytes --]

There is a new pull request by Chocimier against master on the void-packages repository

https://github.com/Chocimier/void-packages-org quote_wrksrc
https://github.com/void-linux/void-packages/pull/24613

xbps-src: quote wrksrc to allow whitespace
Fixes #24477 
One more place is https://github.com/void-linux/void-packages/blob/94c7ef1277be3bfd7e26362d37d808ce678605f4/common/build-style/go.sh#L44 , but I do not like touching go, and hopefully no go package will need modification.

A patch file from https://github.com/void-linux/void-packages/pull/24613.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-quote_wrksrc-24613.patch --]
[-- Type: text/x-diff, Size: 9754 bytes --]

From 2d534d53bab7873cdf94f9c27bced9ff4301588f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Wed, 2 Sep 2020 19:04:41 +0200
Subject: [PATCH] xbps-src: quote wrksrc to allow whitespace

---
 common/build-style/fetch.sh                   |  4 +--
 common/build-style/haskell-stack.sh           |  6 ++---
 common/build-style/perl-module.sh             | 12 ++++-----
 common/hooks/do-extract/00-distfiles.sh       | 26 +++++++++----------
 .../hooks/pre-configure/01-override-config.sh |  4 +--
 common/xbps-src/libexec/xbps-src-doextract.sh |  2 +-
 common/xbps-src/shutils/common.sh             |  2 +-
 common/xbps-src/shutils/pkgtarget.sh          |  4 +--
 xbps-src                                      |  2 +-
 9 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/common/build-style/fetch.sh b/common/build-style/fetch.sh
index f501cc6d53e..8ab140b8072 100644
--- a/common/build-style/fetch.sh
+++ b/common/build-style/fetch.sh
@@ -3,10 +3,10 @@
 do_extract() {
 	local f curfile
 
-	mkdir -p ${wrksrc}
+	mkdir -p "${wrksrc}"
 	for f in ${distfiles}; do
 		curfile="${f#*>}"
 		curfile="${curfile##*/}"
-		cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${curfile} ${wrksrc}/${curfile}
+		cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${curfile} "${wrksrc}/${curfile}"
 	done
 }
diff --git a/common/build-style/haskell-stack.sh b/common/build-style/haskell-stack.sh
index 9eced02e181..2a28ffc9881 100644
--- a/common/build-style/haskell-stack.sh
+++ b/common/build-style/haskell-stack.sh
@@ -20,11 +20,11 @@ do_build() {
 			msg_error "Stackage version not set in \$stackage.\n"
 		fi
 		msg_normal "Using stackage resolver ${stackage}.\n"
-		STACK_ROOT=$wrksrc/.stack \
+		STACK_ROOT="$wrksrc/.stack" \
 			stack init ${_stack_args} --force --resolver ${stackage}
 	fi
 
-	STACK_ROOT=$wrksrc/.stack stack ${_stack_args} ${makejobs} build \
+	STACK_ROOT="$wrksrc/.stack" stack ${_stack_args} ${makejobs} build \
 		${make_build_args}
 }
 
@@ -32,6 +32,6 @@ do_install() {
 	local _stack_args="--system-ghc --skip-ghc-check"
 
 	vmkdir usr/bin
-	STACK_ROOT=$wrksrc/.stack stack ${_stack_args} install \
+	STACK_ROOT="$wrksrc/.stack" stack ${_stack_args} install \
 	       	${make_build_args} --local-bin-path=${DESTDIR}/usr/bin
 }
diff --git a/common/build-style/perl-module.sh b/common/build-style/perl-module.sh
index 3bd6253659f..c2d5b8ddeca 100644
--- a/common/build-style/perl-module.sh
+++ b/common/build-style/perl-module.sh
@@ -29,17 +29,17 @@ do_configure() {
 	fi
 	export PERL5LIB=$perlprefix
 
-	if [ -f ${wrksrc}/Makefile.PL ]; then
-		sed -i "s,/usr/include,${XBPS_CROSS_BASE}/usr/include,g" ${wrksrc}/Makefile.PL
+	if [ -f "${wrksrc}/Makefile.PL" ]; then
+		sed -i "s,/usr/include,${XBPS_CROSS_BASE}/usr/include,g" "${wrksrc}/Makefile.PL"
 	fi
 
 	if [ -z "$perl_configure_dirs" ]; then
 		perlmkf="$wrksrc/Makefile.PL"
-		if [ ! -f $perlmkf ]; then
+		if [ ! -f "$perlmkf" ]; then
 			msg_error "*** ERROR couldn't find $perlmkf, aborting ***\n"
 		fi
 
-		cd $wrksrc
+		cd "$wrksrc"
 		PERL_MM_USE_DEFAULT=1 GCC="$CC" CC="$CC" LD="$CC" \
 			OPTIMIZE="$CFLAGS" \
 			CFLAGS="$CFLAGS -I${XBPS_CROSS_BASE}/usr/include" \
@@ -50,8 +50,8 @@ do_configure() {
 
 	for i in ${perl_configure_dirs}; do
 		perlmkf="$wrksrc/$i/Makefile.PL"
-		if [ -f $perlmkf ]; then
-			cd $wrksrc/$i
+		if [ -f "$perlmkf" ]; then
+			cd "$wrksrc/$i"
 			PERL_MM_USE_DEFAULT=1 GCC="$CC" CC="$CC" LD="$CC" \
 				OPTIMIZE="$CFLAGS" \
 				CFLAGS="$CFLAGS -I${XBPS_CROSS_BASE}/usr/include" \
diff --git a/common/hooks/do-extract/00-distfiles.sh b/common/hooks/do-extract/00-distfiles.sh
index b23b9e14fd9..922f7029491 100644
--- a/common/hooks/do-extract/00-distfiles.sh
+++ b/common/hooks/do-extract/00-distfiles.sh
@@ -7,7 +7,7 @@ hook() {
 	local TAR_CMD
 
 	if [ -z "$distfiles" -a -z "$checksum" ]; then
-		mkdir -p $wrksrc
+		mkdir -p "$wrksrc"
 		return 0
 	fi
 
@@ -21,7 +21,7 @@ hook() {
 	done
 
 	if [ -n "$create_wrksrc" ]; then
-		mkdir -p ${wrksrc} || msg_error "$pkgver: failed to create wrksrc.\n"
+		mkdir -p "${wrksrc}" || msg_error "$pkgver: failed to create wrksrc.\n"
 	fi
 
 	# Disable trap on ERR; the code is smart enough to report errors and abort.
@@ -81,14 +81,14 @@ hook() {
 
 		case ${cursufx} in
 		tar|txz|tbz|tlz|tgz|crate)
-			$TAR_CMD -x --no-same-permissions --no-same-owner -f $srcdir/$curfile -C $extractdir
+			$TAR_CMD -x --no-same-permissions --no-same-owner -f $srcdir/$curfile -C "$extractdir"
 			if [ $? -ne 0 ]; then
 				msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
 			fi
 			;;
 		gz|bz2|xz)
-			cp -f $srcdir/$curfile $extractdir
-			cd $extractdir
+			cp -f $srcdir/$curfile "$extractdir"
+			cd "$extractdir"
 			case ${cursufx} in
 			gz)
 				 gunzip -f $curfile
@@ -103,12 +103,12 @@ hook() {
 			;;
 		zip)
 			if command -v unzip &>/dev/null; then
-				unzip -o -q $srcdir/$curfile -d $extractdir
+				unzip -o -q $srcdir/$curfile -d "$extractdir"
 				if [ $? -ne 0 ]; then
 					msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
 				fi
 			elif command -v bsdtar &>/dev/null; then
-				bsdtar -xf $srcdir/$curfile -C $extractdir
+				bsdtar -xf $srcdir/$curfile -C "$extractdir"
 				if [ $? -ne 0 ]; then
 					msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
 				fi
@@ -118,7 +118,7 @@ hook() {
 			;;
 		rpm)
 			if command -v rpmextract &>/dev/null; then
-				cd $extractdir
+				cd "$extractdir"
 				rpmextract $srcdir/$curfile
 				if [ $? -ne 0 ]; then
 					msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
@@ -129,19 +129,19 @@ hook() {
 			;;
 		txt)
 			if [ "$create_wrksrc" ]; then
-				cp -f $srcdir/$curfile $extractdir
+				cp -f $srcdir/$curfile "$extractdir"
 			else
 				msg_error "$pkgname: ${curfile##*.} files can only be extracted when create_wrksrc is set\n"
 			fi
 			;;
 		7z)
 			if command -v 7z &>/dev/null; then
-				7z x $srcdir/$curfile -o$extractdir
+				7z x $srcdir/$curfile -o"$extractdir"
 				if [ $? -ne 0 ]; then
 					msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
 				fi
 			elif command -v bsdtar &>/dev/null; then
-				bsdtar -xf $srcdir/$curfile -C $extractdir
+				bsdtar -xf $srcdir/$curfile -C "$extractdir"
 				if [ $? -ne 0 ]; then
 					msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
 				fi
@@ -153,11 +153,11 @@ hook() {
 			case "$TAR_CMD" in
 				*bsdtar)
 					$TAR_CMD -xOf $srcdir/$curfile data.tar.gz | \
-						$TAR_CMD -xz -C $extractdir -s ",^,${wrksrc##*/}/," -f -
+						$TAR_CMD -xz -C "$extractdir" -s ",^,${wrksrc##*/}/," -f -
 					;;
 				*)
 					$TAR_CMD -xOf $srcdir/$curfile data.tar.gz | \
-						$TAR_CMD -xz -C $extractdir --transform="s,^,${wrksrc##*/}/,"
+						$TAR_CMD -xz -C "$extractdir" --transform="s,^,${wrksrc##*/}/,"
 					;;
 			esac
 			if [ $? -ne 0 ]; then
diff --git a/common/hooks/pre-configure/01-override-config.sh b/common/hooks/pre-configure/01-override-config.sh
index e9edf149896..29cd66125e2 100644
--- a/common/hooks/pre-configure/01-override-config.sh
+++ b/common/hooks/pre-configure/01-override-config.sh
@@ -4,10 +4,10 @@ hook() {
 	local _cfgdir="${XBPS_COMMONDIR}/environment/configure/automake"
 
 	if [ -z "$build_style" -o "$build_style" = "gnu-configure" ]; then
-		for f in $(find ${wrksrc} -type f -name "*config*.sub"); do
+		for f in $(find "${wrksrc}" -type f -name "*config*.sub"); do
 			cp -f ${_cfgdir}/config.sub ${f}
 		done
-		for f in $(find ${wrksrc} -type f -name "*config*.guess"); do
+		for f in $(find "${wrksrc}" -type f -name "*config*.guess"); do
 			cp -f ${_cfgdir}/config.guess ${f}
 		done
 	fi
diff --git a/common/xbps-src/libexec/xbps-src-doextract.sh b/common/xbps-src/libexec/xbps-src-doextract.sh
index 20358736c2f..8b1633ae77e 100755
--- a/common/xbps-src/libexec/xbps-src-doextract.sh
+++ b/common/xbps-src/libexec/xbps-src-doextract.sh
@@ -40,7 +40,7 @@ fi
 
 # If template defines do_extract() use it rather than the hooks.
 if declare -f do_extract >/dev/null; then
-    [ ! -d "$wrksrc" ] && mkdir -p $wrksrc
+    [ ! -d "$wrksrc" ] && mkdir -p "$wrksrc"
     cd "$wrksrc"
     run_func do_extract
 else
diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh
index e8bcf577c6b..f7280815220 100644
--- a/common/xbps-src/shutils/common.sh
+++ b/common/xbps-src/shutils/common.sh
@@ -30,7 +30,7 @@ run_func() {
 ch_wrksrc() {
     cd "$wrksrc" || msg_error "$pkgver: cannot access wrksrc directory [$wrksrc]\n"
     if [ -n "$build_wrksrc" ]; then
-        cd $build_wrksrc || \
+        cd "$build_wrksrc" || \
             msg_error "$pkgver: cannot access build_wrksrc directory [$build_wrksrc]\n"
     fi
 }
diff --git a/common/xbps-src/shutils/pkgtarget.sh b/common/xbps-src/shutils/pkgtarget.sh
index 090ec5c1a3e..e064b7c2911 100644
--- a/common/xbps-src/shutils/pkgtarget.sh
+++ b/common/xbps-src/shutils/pkgtarget.sh
@@ -79,8 +79,8 @@ remove_pkg_autodeps() {
 remove_pkg_wrksrc() {
     if [ -d "$wrksrc" ]; then
         msg_normal "$pkgver: cleaning build directory...\n"
-        chmod -R +wX $wrksrc # Needed to delete Go Modules
-        rm -rf $wrksrc
+        chmod -R +wX "$wrksrc" # Needed to delete Go Modules
+        rm -rf "$wrksrc"
     fi
 }
 
diff --git a/xbps-src b/xbps-src
index 1c83708c8da..4871a8b00c0 100755
--- a/xbps-src
+++ b/xbps-src
@@ -761,7 +761,7 @@ case "$XBPS_TARGET" in
             if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
                 chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG || exit $?
             else
-                remove_pkg_wrksrc $wrksrc
+                remove_pkg_wrksrc
                 remove_pkg_statedir
                 if declare -f do_clean >/dev/null; then
                     run_func do_clean

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PR PATCH] [Merged]: xbps-src: quote wrksrc to allow whitespace
  2020-09-02 17:05 [PR PATCH] xbps-src: quote wrksrc to allow whitespace Chocimier
@ 2020-09-03 19:03 ` Chocimier
  0 siblings, 0 replies; 2+ messages in thread
From: Chocimier @ 2020-09-03 19:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 412 bytes --]

There's a merged pull request on the void-packages repository

xbps-src: quote wrksrc to allow whitespace
https://github.com/void-linux/void-packages/pull/24613

Description:
Fixes #24477 
One more place is https://github.com/void-linux/void-packages/blob/94c7ef1277be3bfd7e26362d37d808ce678605f4/common/build-style/go.sh#L44 , but I do not like touching go, and hopefully no go package will need modification.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-03 19:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-02 17:05 [PR PATCH] xbps-src: quote wrksrc to allow whitespace Chocimier
2020-09-03 19:03 ` [PR PATCH] [Merged]: " Chocimier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).