This time, use bash 4.0, but limit the use of this function to ebuild that have EAPI >= 6. Display a warning for maintainers to upgrade their ebuilds, or remove the call. Thanks to mgorny for the suggestion. Signed-off-by: Mike Pagano --- eclass/kernel-2.eclass | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass index 84909f30c..a80f3e91a 100644 --- a/eclass/kernel-2.eclass +++ b/eclass/kernel-2.eclass @@ -1407,11 +1407,20 @@ getfilevar() { # This function sets ARCH_URI and ARCH_PATCH # with the neccessary info for the arch sepecific compatibility # patchsets. +# To use, an ebuild could contain a line like: +# AMD64_URI=http//linktothearchspecificpatch +# This function requires EAPI >= 6. detect_arch() { - local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL + if [[ "${EAPI}" -lt 6 ]]; then + eqawarn "ebuild is attempting to call detect_arch when EAPI < 6." + eqawarn "This function will not be executed." + return + fi + local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL + # COMPAT_URI is the contents of ${ARCH}_URI # ARCH_URI is the URI for all the ${ARCH}_URI patches # ARCH_PATCH is ARCH_URI broken into files for UNIPATCH @@ -1425,18 +1434,15 @@ detect_arch() { COMPAT_URI="${LOOP_ARCH}_URI" COMPAT_URI="${!COMPAT_URI}" - declare -l LOOP_ARCH_L=${LOOP_ARCH} - [[ -n ${COMPAT_URI} ]] && \ - ARCH_URI="${ARCH_URI} ${LOOP_ARCH_L}? ( ${COMPAT_URI} )" + ARCH_URI="${ARCH_URI} ${LOOP_ARCH,,}? ( ${COMPAT_URI} )" - declare -u TC_ARCH_KERNEL=$(tc-arch-kernel) - if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL} ]]; then + TC_ARCH_KERNEL=$(tc-arch-kernel); + if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL^^} ]]; then for i in ${COMPAT_URI}; do ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}" done fi - done } -- 2.13.5