diff options
author | Mihai Moldovan <ionic@ionic.de> | 2015-04-03 02:41:24 +0200 |
---|---|---|
committer | Mihai Moldovan <ionic@ionic.de> | 2015-04-03 02:41:24 +0200 |
commit | 95090fd6c77113ed17354034d93af145fedc1736 (patch) | |
tree | 71c1e2506293314ece7f36876727644b68e18dcd /bin | |
parent | 6bc245d846cd4c50609c1439121f202fc037365d (diff) | |
download | buildscripts-95090fd6c77113ed17354034d93af145fedc1736.tar.gz buildscripts-95090fd6c77113ed17354034d93af145fedc1736.tar.bz2 buildscripts-95090fd6c77113ed17354034d93af145fedc1736.zip |
bin/build-deb-package: do not use a subshell for splitting up ${DEB_BUILD_FOR}.
Switch to word splitting and bash arrays.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/build-deb-package | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/bin/build-deb-package b/bin/build-deb-package index 6f25293..ae9e095 100755 --- a/bin/build-deb-package +++ b/bin/build-deb-package @@ -161,7 +161,17 @@ prepare_workspace() { clear_pkgdist() { # pkgdist directory cleanup - echo "${DEB_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 deb_build_for_arr + typeset OLDIFS="${IFS}" + IFS=" " + read -a deb_build_for_arr <<< "${DEB_BUILD_FOR}" + IFS="${OLDIFS}" + + typeset line="" + for line in "${deb_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}" <<< "${DEB_DISTS_SUPPORTED}" && { @@ -203,7 +213,17 @@ clear_pkgdist() { build_packages() { # use pbuilder for building all variants of this package - echo "${DEB_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 deb_build_for_arr + typeset OLDIFS="${IFS}" + IFS=" " + read -a deb_build_for_arr <<< "${DEB_BUILD_FOR}" + IFS="${OLDIFS}" + + typeset line="" + for line in "${deb_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}" <<< "${DEB_DISTS_SUPPORTED}" && { @@ -312,7 +332,17 @@ build_packages() { upload_packages() { # dupload the new packages to the reprepro repository - echo "${DEB_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 deb_build_for_arr + typeset OLDIFS="${IFS}" + IFS=" " + read -a deb_build_for_arr <<< "${DEB_BUILD_FOR}" + IFS="${OLDIFS}" + + typeset line="" + for line in "${deb_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 |