From: Mike Pagano <mpagano@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH v3] eclass/kernel-2.eclass: Remove use of tr in global scope
Date: Wed, 6 Sep 2017 19:40:50 -0400 [thread overview]
Message-ID: <d150d451-b587-bb54-a4c0-5690b0c1e1f9@gentoo.org> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1978 bytes --]
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 <mpagano@gentoo.org>
---
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next reply other threads:[~2017-09-06 23:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 23:40 Mike Pagano [this message]
2017-09-07 1:13 ` [gentoo-dev] [PATCH v3] eclass/kernel-2.eclass: Remove use of tr in global scope Floyd Anderson
2017-09-07 7:01 ` [gentoo-dev] " Duncan
2017-09-07 5:42 ` [gentoo-dev] " Michał Górny
2017-09-07 7:39 ` Ciaran McCreesh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d150d451-b587-bb54-a4c0-5690b0c1e1f9@gentoo.org \
--to=mpagano@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox