Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope
Date: Thu, 31 Aug 2017 17:27:26
Message-Id: 1504200430.15812.2.camel@gentoo.org
In Reply to: [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope by Mike Pagano
1 W dniu czw, 31.08.2017 o godzinie 12∶33 -0400, użytkownik Mike Pagano
2 napisał:
3 > As per PMS remove calls to external command 'tr' in global scope See bug #629106.
4
5 Closes: https://bugs.gentoo.org/629106
6
7 (assuming you want the bug closed)
8
9 >
10 > Signed-off-by: Mike Pagano <mpagano@g.o>
11 > ---
12 > eclass/kernel-2.eclass | 11 ++++++++---
13 > 1 file changed, 8 insertions(+), 3 deletions(-)
14 >
15 > diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
16 > index 09409ab1f..205ea93d5 100644
17 > --- a/eclass/kernel-2.eclass
18 > +++ b/eclass/kernel-2.eclass
19 > @@ -1410,7 +1410,7 @@ getfilevar() {
20 >
21 > detect_arch() {
22 >
23 > - local ALL_ARCH LOOP_ARCH COMPAT_URI i
24 > + local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL
25 >
26 > # COMPAT_URI is the contents of ${ARCH}_URI
27 > # ARCH_URI is the URI for all the ${ARCH}_URI patches
28 > @@ -1418,20 +1418,25 @@ detect_arch() {
29 >
30 > ARCH_URI=""
31 > ARCH_PATCH=""
32 > + TC_ARCH_KERNEL=""
33 > ALL_ARCH="ALPHA AMD64 ARM HPPA IA64 M68K MIPS PPC PPC64 S390 SH SPARC X86"
34 >
35 > for LOOP_ARCH in ${ALL_ARCH}; do
36 > COMPAT_URI="${LOOP_ARCH}_URI"
37 > COMPAT_URI="${!COMPAT_URI}"
38 >
39 > + declare -l LOOP_ARCH_L=${LOOP_ARCH}
40 > +
41 > [[ -n ${COMPAT_URI} ]] && \
42 > - ARCH_URI="${ARCH_URI} $(echo ${LOOP_ARCH} | tr '[:upper:]' '[:lower:]')? ( ${COMPAT_URI} )"
43 > + ARCH_URI="${ARCH_URI} ${LOOP_ARCH_L}? ( ${COMPAT_URI} )"
44 >
45 > - if [[ ${LOOP_ARCH} == "$(echo $(tc-arch-kernel) | tr '[:lower:]' '[:upper:]')" ]]; then
46 > + declare -u TC_ARCH_KERNEL=$(tc-arch-kernel);
47
48 Strictly speaking, you shouldn't use tc-arch-kernel in global scope
49 either since it depends on CHOST. However, we can live with it for now.
50
51 Also, didn't you accidentally add a trailing space there?
52
53 > + if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL} ]]; then
54
55 Missing newline? Tab in middle of the line looks weird.
56
57 > for i in ${COMPAT_URI}; do
58 > ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}"
59 > done
60 > fi
61 > +
62 > done
63 > }
64 >
65
66 Besides those minor nits, +1.
67
68 --
69 Best regards,
70 Michał Górny

Replies