From 4dc4759fa371810413dc6ff1c1dc381bc8b952f2 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Fri, 3 Apr 2015 02:44:09 +0200 Subject: 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(-) (limited to 'bin') 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 -- cgit v1.2.3