summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2015-04-03 02:41:24 +0200
committerMihai Moldovan <ionic@ionic.de>2015-04-03 02:41:24 +0200
commit95090fd6c77113ed17354034d93af145fedc1736 (patch)
tree71c1e2506293314ece7f36876727644b68e18dcd /bin
parent6bc245d846cd4c50609c1439121f202fc037365d (diff)
downloadbuildscripts-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-xbin/build-deb-package36
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