Gentoo Archives: gentoo-dev

From: Jonathan Callen <jcallen@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: [PATCH] eclass/kernel-2.eclass: Remove use of tr in global scope
Date: Thu, 31 Aug 2017 01:51:21
Message-Id: d37ffb71-22ba-f436-aafe-a971b49f4aba@gentoo.org
In Reply to: [gentoo-dev] [PATCH] eclass/kernel-2.eclass: Remove use of tr in global scope by Mike Pagano
1 On 08/30/2017 08:02 PM, Mike Pagano wrote:
2 > As per PMS remove calls to external command 'tr' in global scope
3 > See bug #629106
4 >
5 > Signed-off-by: Mike Pagano <mpagano@g.o>
6 > ---
7 > eclass/kernel-2.eclass | 8 +++++---
8 > 1 file changed, 5 insertions(+), 3 deletions(-)
9 >
10 > diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
11 > index 09409ab1f..cdc8c4043 100644
12 > --- a/eclass/kernel-2.eclass
13 > +++ b/eclass/kernel-2.eclass
14 > @@ -1410,7 +1410,7 @@ getfilevar() {
15 >
16 > detect_arch() {
17 >
18 > - local ALL_ARCH LOOP_ARCH COMPAT_URI i
19 > + local ALL_ARCH LOOP_ARCH COMPAT_URI TC_ARCH_KERNEL
20 >
21 > # COMPAT_URI is the contents of ${ARCH}_URI
22 > # ARCH_URI is the URI for all the ${ARCH}_URI patches
23 > @@ -1418,6 +1418,7 @@ detect_arch() {
24 >
25 > ARCH_URI=""
26 > ARCH_PATCH=""
27 > + TC_ARCH_KERNEL=""
28 > ALL_ARCH="ALPHA AMD64 ARM HPPA IA64 M68K MIPS PPC PPC64 S390 SH SPARC X86"
29 >
30 > for LOOP_ARCH in ${ALL_ARCH}; do
31 > @@ -1425,9 +1426,10 @@ detect_arch() {
32 > COMPAT_URI="${!COMPAT_URI}"
33 >
34 > [[ -n ${COMPAT_URI} ]] && \
35 > - ARCH_URI="${ARCH_URI} $(echo ${LOOP_ARCH} | tr '[:upper:]' '[:lower:]')? ( ${COMPAT_URI} )"
36 > + ARCH_URI="${ARCH_URI} ${LOOP_ARCH,,}? ( ${COMPAT_URI} )"
37 >
38 > - if [[ ${LOOP_ARCH} == "$(echo $(tc-arch-kernel) | tr '[:lower:]' '[:upper:]')" ]]; then
39 > + TC_ARCH_KERNEL=$(tc-arch-kernel);
40 > + if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL^^} ]]; then
41 >
42 >
43
44 Unfortunately, the ${VAR,,} and ${VAR^^} forms were added in bash 4.0
45 [1], which means they are not available in EAPIs before 6, which only
46 allow constructs from bash 3.2 [2].
47
48 [1]: https://tiswww.case.edu/php/chet/bash/NEWS
49 [2]: https://projects.gentoo.org/pms/6/pms.html#x1-640006
50
51 --
52 Jonathan Callen

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies