[X2Go-Commits] [buildscripts] 07/14: bin/build-rpm-package: change ${RPM_BUILD_FOR} splitting to a bash-only solution in more places.

git-admin at x2go.org git-admin at x2go.org
Fri Apr 3 03:07:48 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 4dc4759fa371810413dc6ff1c1dc381bc8b952f2
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Fri Apr 3 02:44:09 2015 +0200

    bin/build-rpm-package: change ${RPM_BUILD_FOR} splitting to a bash-only solution in more places.
---
 bin/build-rpm-package |   23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index 4cf2652..af4eacd 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -538,8 +538,16 @@ prepare_workspace() {
 # Does not take parameters.
 # Does not "return" anything.
 clear_pkgdist() {
-	# pkgdist directory cleanup
-	echo "${RPM_BUILD_FOR}" | sed -e 's/ /\n/g' | while read line; do
+	# Do NOT spawn a subshell here. Functions like get_extra_repository() need to
+	# change global variables in the main process.
+	typeset -a rpm_build_for_arr
+	typeset OLDIFS="${IFS}"
+	IFS=" "
+	read -a rpm_build_for_arr <<< "${RPM_BUILD_FOR}"
+	IFS="${OLDIFS}"
+
+	typeset line=""
+	for line in "${rpm_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}" <<< "${RPM_DISTS_SUPPORTED}" && {
@@ -829,9 +837,16 @@ build_packages() {
 # Has no parameters.
 # Does not "return" any value.
 upload_packages() {
-	# dupload the new packages to the reprepro repository
+	# Do NOT spawn a subshell here. Functions like get_extra_repository() need to
+	# change global variables in the main process.
+	typeset -a rpm_build_for_arr
+	typeset OLDIFS="${IFS}"
+	IFS=" "
+	read -a rpm_build_for_arr <<< "${RPM_BUILD_FOR}"
+	IFS="${OLDIFS}"
 
-	echo "${RPM_BUILD_FOR}" | sed -e 's/ /\n/g' | while read line; do
+	typeset line=""
+	for line in "${rpm_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