aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory M. Tuner <gmt@be-evil.net>2013-12-30 02:05:00 -0800
committerGregory M. Tuner <gmt@be-evil.net>2013-12-30 02:05:00 -0800
commita0b991aa76913f90924986ad13e05088b9a12ee4 (patch)
tree6813553447d38378a2d0e760c85a951876d734be /eclass/multilib-build.eclass
parenteclass/multibuild: multibuild_for_best_variant: die: grammar/clarity (diff)
downloadgmt-a0b991aa76913f90924986ad13e05088b9a12ee4.tar.gz
gmt-a0b991aa76913f90924986ad13e05088b9a12ee4.tar.bz2
gmt-a0b991aa76913f90924986ad13e05088b9a12ee4.zip
eclass/multilib-build: quoting and double-slash avoidance
Some minor changes to be more precise and consistent with quoting. Spiff up code to drop leading and trailing single-slash to support multiple slashes. Tidy up some standard pointless double-slash-injection thinkos (leaves a couple more in, that git wanted to merge in silly ways; I guess they'll end up merged in the wrong commit, try tidy up later?) Signed-off-by: Gregory M. Tuner <gmt@be-evil.net>
Diffstat (limited to 'eclass/multilib-build.eclass')
-rw-r--r--eclass/multilib-build.eclass27
1 files changed, 16 insertions, 11 deletions
diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
index 62c8899..47612fa 100644
--- a/eclass/multilib-build.eclass
+++ b/eclass/multilib-build.eclass
@@ -369,24 +369,27 @@ multilib_prepare_wrappers() {
[[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments"
local root=${1:-${ED}}
+ # ensure root has a single trailing slash
+ [[ ${root} =~ /+$ ]] && root="${root%${BASH_REMATCH[0]}}"
+ root="${root}/"
local f
for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do
# drop leading slash if it's there
- f=${f#/}
+ [[ ${f} =~ ^/+ ]] && f="${f#${BASH_REMATCH[0]}}"
if [[ ${f} != usr/include/* ]]; then
die "Wrapping headers outside of /usr/include is not supported at the moment."
fi
# and then usr/include
- f=${f#usr/include}
+ f="${f#usr/include}"
- local dir=${f%/*}
+ local dir="${f%/*}"
- if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
+ if [[ ! -f "${ED}tmp/multilib-include${f}" ]]; then
dodir "/tmp/multilib-include${dir}"
# a generic template
- cat > "${ED}/tmp/multilib-include${f}" <<_EOF_
+ cat > "${ED}tmp/multilib-include${f}" <<_EOF_
/* This file is auto-generated by multilib-build.eclass
* as a multilib-friendly wrapper. For the original content,
* please see the files that are #included below.
@@ -415,10 +418,10 @@ _EOF_
fi
# Some ABIs may have install less files than others.
- if [[ -f ${root}/usr/include${f} ]]; then
+ if [[ -f "${root}usr/include${f}" ]]; then
# $CHOST shall be set by multilib_toolchain_setup
dodir "/tmp/multilib-include/${CHOST}${dir}"
- mv "${root}/usr/include${f}" "${ED}/tmp/multilib-include/${CHOST}${dir}/" || die
+ mv "${root}usr/include${f}" "${ED}tmp/multilib-include/${CHOST}${dir}/" || die
# XXX: get abi_* directly
local abi_flag
@@ -441,7 +444,7 @@ _EOF_
# Note: match a space afterwards to avoid collision potential.
sed -e "/${abi_flag} /s&error.*&include <${CHOST}${f}>&" \
- -i "${ED}/tmp/multilib-include${f}" || die
+ -i "${ED}tmp/multilib-include${f}" || die
fi
done
}
@@ -466,12 +469,14 @@ multilib_install_wrappers() {
[[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments"
local root=${1:-${ED}}
+ # ensure root has a single trailing slash
+ [[ ${root} =~ /+$ ]] && root="${root%${BASH_REMATCH[0]}}"
+ root="${root}/"
- if [[ -d "${ED}"/tmp/multilib-include ]]; then
+ if [[ -d "${ED}"tmp/multilib-include ]]; then
multibuild_merge_root \
"${ED}"/tmp/multilib-include "${root}"/usr/include
- # it can fail if something else uses /tmp
- rmdir "${ED}"/tmp &>/dev/null
+ rmdir "${ED}"tmp &>/dev/null # can fail if something else uses /tmp
fi
}