diff options
author | Mihai Moldovan <ionic@ionic.de> | 2015-04-03 02:44:09 +0200 |
---|---|---|
committer | Mihai Moldovan <ionic@ionic.de> | 2015-04-03 02:44:09 +0200 |
commit | 4dc4759fa371810413dc6ff1c1dc381bc8b952f2 (patch) | |
tree | 6be12152a05a96cbd2d14530584a54be1caedf41 /bin | |
parent | d0182496e6070323209e13a86e65405a2ac29e58 (diff) | |
download | buildscripts-4dc4759fa371810413dc6ff1c1dc381bc8b952f2.tar.gz buildscripts-4dc4759fa371810413dc6ff1c1dc381bc8b952f2.tar.bz2 buildscripts-4dc4759fa371810413dc6ff1c1dc381bc8b952f2.zip |
bin/build-rpm-package: change ${RPM_BUILD_FOR} splitting to a bash-only solution in more places.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/build-rpm-package | 23 |
1 files 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 |