[X2Go-Commits] [buildscripts] 01/02: bin/build-rpm-package: do not use create_mock_config() in a subshell. It needs to edit variables in global scope.

git-admin at x2go.org git-admin at x2go.org
Wed Apr 1 11:32:58 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 cff96a2a5ce261e8937fcdd3b73ad9c4cbee8a0a
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Apr 1 11:11:13 2015 +0200

    bin/build-rpm-package: do not use create_mock_config() in a subshell. It needs to edit variables in global scope.
---
 bin/build-rpm-package |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index 94eaa61..b439522 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -247,14 +247,14 @@ repeat_str () { # INPUT COUNT
 # /etc/mock/), the build component and the target specification ("full" or "base").
 # Base refers to adding x2go-extras only, while full means also
 # adding the full X2Go upstream repository with all published files.
-# The created config file path is returned.
+#
+# Calling this function in a subshell is an error, as it NEEDS to modify
+# variables in global scope!
 create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET
 	typeset MOCK_BASE="${1:?"Error: no mock base config passed to ${FUNCNAME}()."}"
 	typeset COMPONENT="${2:?"Error: no component (X2Go release group) passed to ${FUNCNAME}()."}"
 	typeset TARGET="${3:?"Error: no target (full or base) passed to ${FUNCNAME}()."}"
 
-	typeset ret=""
-
 	# Check argument sanity.
 	typeset DISTRO=""
 
@@ -393,9 +393,6 @@ create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET
 
 	# Reset input field separator to original value.
 	IFS="${OLDIFS}"
-
-	# Strictly speaking not necessary, but do it anyway.
-	printf "${TMP_MOCK_CFG_FILE}"
 }
 
 # Fetches extras repositories, if requested.
@@ -447,10 +444,11 @@ get_extra_repository () {
 					WANT="full"
 				fi
 
-				typeset GEN_CONFIG="$(create_mock_config "${DIST}-${CODENAME}-${ARCH}" "${COMPONENT}" "${WANT}")"
+				create_mock_config "${DIST}-${CODENAME}-${ARCH}" "${COMPONENT}" "${WANT}"
 
 				# Remove the .cfg extension again... and maybe add it back later.
-				ret="${ret}${GEN_CONFIG%.cfg}"
+				ret="${ret}${TMP_MOCK_CFG_FILE%.cfg}"
+
 			else
 				ret="${ret}${RPM_MOCK_CONFIG_DIR}/${DIST}-${CODENAME}-${ARCH}"
 			fi

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