[X2Go-Commits] [buildscripts] 05/14: bin/build-deb-package: do not use a subshell for splitting up ${DEB_BUILD_FOR}.

git-admin at x2go.org git-admin at x2go.org
Fri Apr 3 03:07:47 CEST 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository buildscripts.

commit 95090fd6c77113ed17354034d93af145fedc1736
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Fri Apr 3 02:41:24 2015 +0200

    bin/build-deb-package: do not use a subshell for splitting up ${DEB_BUILD_FOR}.
    
    Switch to word splitting and bash arrays.
---
 bin/build-deb-package |   36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/bin/build-deb-package b/bin/build-deb-package
index 6f25293..ae9e095 100755
--- a/bin/build-deb-package
+++ b/bin/build-deb-package
@@ -161,7 +161,17 @@ prepare_workspace() {
 
 clear_pkgdist() {
 	# pkgdist directory cleanup
-	echo "${DEB_BUILD_FOR}" | sed -e 's/ /\n/g' | while read line; do
+
+	# Do NOT spawn a subshell here.
+	# Allow changing global variables in the main process.
+	typeset -a deb_build_for_arr
+	typeset OLDIFS="${IFS}"
+	IFS=" "
+	read -a deb_build_for_arr <<< "${DEB_BUILD_FOR}"
+	IFS="${OLDIFS}"
+
+	typeset line=""
+	for line in "${deb_build_for_arr[@]}"; do
 		l_DIST="$(cut -d":" -f1 <<< "${line/: /:}" | tr [:upper:] [:lower:])"
 		l_CODENAMES="${CODENAMES:-$(cut -d":" -f2- <<< "${line/: /:}" | sed -e 's/,/ /g' | tr [:upper:] [:lower:])}"
 		grep -qs "${l_DIST}" <<< "${DEB_DISTS_SUPPORTED}" && {
@@ -203,7 +213,17 @@ clear_pkgdist() {
 
 build_packages() {
 	# use pbuilder for building all variants of this package
-	echo "${DEB_BUILD_FOR}" | sed -e 's/ /\n/g' | while read line; do
+
+	# Do NOT spawn a subshell here.
+	# Allow changing global variables in the main process.
+	typeset -a deb_build_for_arr
+	typeset OLDIFS="${IFS}"
+	IFS=" "
+	read -a deb_build_for_arr <<< "${DEB_BUILD_FOR}"
+	IFS="${OLDIFS}"
+
+	typeset line=""
+	for line in "${deb_build_for_arr[@]}"; do
 		l_DIST="$(cut -d":" -f1 <<< "${line/: /:}" | tr [:upper:] [:lower:])"
 		l_CODENAMES="${CODENAMES:-$(cut -d":" -f2- <<< "${line/: /:}" | sed -e 's/,/ /g' | tr [:upper:] [:lower:])}"
 		grep -qs "${l_DIST}" <<< "${DEB_DISTS_SUPPORTED}" && {
@@ -312,7 +332,17 @@ build_packages() {
 
 upload_packages() {
 	# dupload the new packages to the reprepro repository
-	echo "${DEB_BUILD_FOR}" | sed -e 's/ /\n/g' | while read line; do
+
+	# Do NOT spawn a subshell here.
+	# Allow changing global variables in the main process.
+	typeset -a deb_build_for_arr
+	typeset OLDIFS="${IFS}"
+	IFS=" "
+	read -a deb_build_for_arr <<< "${DEB_BUILD_FOR}"
+	IFS="${OLDIFS}"
+
+	typeset line=""
+	for line in "${deb_build_for_arr[@]}"; do
 		l_DIST="$(cut -d":" -f1 <<< "${line/: /:}" | tr [:upper:] [:lower:])"
 		l_CODENAMES="${CODENAMES:-$(cut -d":" -f2- <<< "${line/: /:}" | sed -e 's/,/ /g' | tr [:upper:] [:lower:])}"
 		for l_CODENAME in ${l_CODENAMES}; do

--
Alioth's /srv/git/code.x2go.org/buildscripts.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/buildscripts.git


More information about the x2go-commits mailing list