summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2009-11-03 13:56:31 +0100
committerMarc Kleine-Budde <mkl@pengutronix.de>2009-11-03 14:50:14 +0100
commit4ea6c0f85405aefa836b0710d3597de84d23d7bd (patch)
treea89ce39a2a6491c16b6e55e25f6f4304647dd9e7
parent9cdb07a378fd1782ebebaff36c5ee5337fda1770 (diff)
downloadptxdist-4ea6c0f85405aefa836b0710d3597de84d23d7bd.tar.gz
ptxdist-4ea6c0f85405aefa836b0710d3597de84d23d7bd.tar.xz
[ptxdist] fix "local -a" + IFS problem
This patch fixes a problem with bash-3.0.x. This old bash versions doesn't respect IFS when splitting a variable: This costruct doesn't work: foo="bar:baz" local -a qux=( ${foo} ) echo "${foo[@]}" it prints: bar:baz bash > 3.0.x prints bar baz The correct sequence is to first declare qux as a local array and then assign it: local -a qux qux=( ${foo} ) Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> cherry-picked from master 3f64846d95f14140e78751b643eaac49a61b15df Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r--scripts/lib/ptxd_make_00-init.sh12
-rw-r--r--scripts/lib/ptxd_make_get.sh7
-rw-r--r--scripts/lib/ptxd_make_world_common.sh3
-rw-r--r--scripts/libptxdist.sh6
4 files changed, 19 insertions, 9 deletions
diff --git a/scripts/lib/ptxd_make_00-init.sh b/scripts/lib/ptxd_make_00-init.sh
index 6da1477c9..245b43157 100644
--- a/scripts/lib/ptxd_make_00-init.sh
+++ b/scripts/lib/ptxd_make_00-init.sh
@@ -157,7 +157,8 @@ ptxd_init_cross_env() {
local orig_IFS="${IFS}"
IFS=":"
- local -a prefix=( ${PTXDIST_PATH_SYSROOT_PREFIX} )
+ local -a prefix
+ prefix=( ${PTXDIST_PATH_SYSROOT_PREFIX} )
IFS="${orig_IFS}"
# add "-isystem <DIR>/include"
@@ -185,7 +186,8 @@ ptxd_init_cross_env() {
#
# add <DIR>/lib/pkgconfig and <DIR>/share/pkgconfig
- local -a pkg_libdir=( "${prefix[@]/%//lib/pkgconfig}" "${prefix[@]/%//share/pkgconfig}" )
+ local -a pkg_libdir
+ pkg_libdir=( "${prefix[@]/%//lib/pkgconfig}" "${prefix[@]/%//share/pkgconfig}" )
#
# PKG_CONFIG_PATH contains additional pkg-config search
@@ -204,14 +206,16 @@ ptxd_init_cross_env() {
local -a opt_pkg_path
if opt_pkg_path=( $(ptxd_get_ptxconf PTXCONF_PKG_CONFIG_PATH) ); then
IFS=":"
- local -a sysroot=( ${PTXDIST_PATH_SYSROOT} )
+ local -a sysroot
+ sysroot=( ${PTXDIST_PATH_SYSROOT} )
IFS="${orig_IFS}"
pkg_path=( "${opt_pkg_path[@]/#/${sysroot[0]}}" )
fi
IFS=":"
- export PTXDIST_CROSS_ENV_PKG_CONFIG="PKG_CONFIG_PATH='${pkg_path[*]}' PKG_CONFIG_LIBDIR='${pkg_libdir[*]}'"
+ PTXDIST_CROSS_ENV_PKG_CONFIG="PKG_CONFIG_PATH='${pkg_path[*]}' PKG_CONFIG_LIBDIR='${pkg_libdir[*]}'"
+ export PTXDIST_CROSS_ENV_PKG_CONFIG
IFS="${orig_IFS}"
}
diff --git a/scripts/lib/ptxd_make_get.sh b/scripts/lib/ptxd_make_get.sh
index 77186fadc..9a9f964f6 100644
--- a/scripts/lib/ptxd_make_get.sh
+++ b/scripts/lib/ptxd_make_get.sh
@@ -102,10 +102,12 @@ export -f ptxd_make_get_download_permitted
# - no-check-certificate don't check server certificate (https only)
#
ptxd_make_get() {
- local orig_argv=( "${@}" )
local -a argv
local mrd=false # is mirror already part of urls?
+ local -a orig_argv
+ orig_argv=( "${@}" )
+
if [ -z "${1}" ]; then
echo
echo "${PROMPT}error: empty parameter to '${FUNCNAME}'"
@@ -163,7 +165,8 @@ ptxd_make_get() {
#
local orig_ifs="${IFS}"
IFS=";"
- local -a opts=( ${1} )
+ local -a opts
+ opts=( ${1} )
IFS="${orig_ifs}"
unset orig_ifs
diff --git a/scripts/lib/ptxd_make_world_common.sh b/scripts/lib/ptxd_make_world_common.sh
index d44435b67..ef2adcc2b 100644
--- a/scripts/lib/ptxd_make_world_common.sh
+++ b/scripts/lib/ptxd_make_world_common.sh
@@ -12,7 +12,8 @@
# check for deprecated vars and print them
#
ptxd_make_world_init_deprecation_check() {
- local -a dep=(
+ local -a dep
+ dep=(
pkg_deprecated_install_builddir
pkg_deprecated_install_hosttool
pkg_deprecated_install_opt
diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh
index 7445ed84e..a508a8428 100644
--- a/scripts/libptxdist.sh
+++ b/scripts/libptxdist.sh
@@ -55,7 +55,8 @@ _ptxd_dialog_box() {
local old_ifs="${IFS}"
local IFS=''
- local msg="${*}"
+ local msg
+ msg="${*}"
IFS="${old_ifs}"
if [ -n "${PTX_MENU}" ]; then
@@ -78,7 +79,8 @@ ptxd_dialog_msgbox() {
ptxd_dialog_yesno() {
local old_ifs="${IFS}"
local IFS=''
- local msg="${*}"
+ local msg
+ msg="${*}"
IFS="${old_ifs}"
local answer