[X2Go-Commits] [buildscripts] 01/04: bin/build-nsis-package.sh: do not spawn new copies of the same processes for no good reason.

git-admin at x2go.org git-admin at x2go.org
Sun May 10 03:16:08 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 d7089b98468f15a1931553ed848adad6aea678e7
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sun May 10 03:12:09 2015 +0200

    bin/build-nsis-package.sh: do not spawn new copies of the same processes for no good reason.
    
    Will be harmful when trying to edit global variables.
---
 bin/build-nsis-package.sh |   27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/bin/build-nsis-package.sh b/bin/build-nsis-package.sh
index 0bae4e3..80de031 100755
--- a/bin/build-nsis-package.sh
+++ b/bin/build-nsis-package.sh
@@ -136,14 +136,24 @@ prepare_workspace() {
 	return 0
 }
 
+# Cleans up the pkgdist directory used for building packages.
+# Does not take parameters.
+# Does not "return" anything.
 clear_pkgdist() {
-	# pkgdist directory cleanup
-	echo "$NSIS_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 nsis_build_for_arr
+	typeset OLDIFS="${IFS}"
+	IFS=" "
+	read -a nsis_build_for_arr <<< "${NSIS_BUILD_FOR}"
+	IFS="${OLDIFS}"
+
+	typeset line=""
+	for line in "${nsis_build_for_arr[@]}"; do
 		l_DIST="$(echo ${line/: /:} | cut -d":" -f1 | tr [:upper:] [:lower:])"
 		l_CODENAMES="${CODENAMES:-$(echo ${line/: /:} | cut -d":" -f2- | sed -e 's/,/ /g' | tr [:upper:] [:lower:])}"
 		echo "$NSIS_DISTS_SUPPORTED" | grep $l_DIST >/dev/null && {
 			for l_CODENAME in $l_CODENAMES; do
-
 				# in case we build a special CODENAME (squeeze, wheezy, lucid, ...) do skip
 				# the wrong distribution here...
 				test -z $CODENAMES || echo $line | grep $CODENAMES || break
@@ -213,8 +223,17 @@ build_packages() {
 
 upload_packages() {
 	# dupload the new packages to the reprepro repository
-	echo "$NSIS_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 nsis_build_for_arr
+	typeset OLDIFS="${IFS}"
+	IFS=" "
+	read -a nsis_build_for_arr <<< "${NSIS_BUILD_FOR}"
+	IFS="${OLDIFS}"
+
+	typeset line=""
+	for line in "${nsis_build_for_arr[@]}"; do
 		# FIXME: this should be handled at the beginning of this script!!!
 		MINGW_REPOS_BASE=/srv/sites/x2go.org/code/releases/binary-win32/x2goclient/heuler/
 

--
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