1 |
W dniu śro, 30.08.2017 o godzinie 21∶51 -0400, użytkownik Jonathan |
2 |
Callen napisał: |
3 |
> On 08/30/2017 08:02 PM, Mike Pagano wrote: |
4 |
> > As per PMS remove calls to external command 'tr' in global scope |
5 |
> > See bug #629106 |
6 |
> > |
7 |
> > Signed-off-by: Mike Pagano <mpagano@g.o> |
8 |
> > --- |
9 |
> > eclass/kernel-2.eclass | 8 +++++--- |
10 |
> > 1 file changed, 5 insertions(+), 3 deletions(-) |
11 |
> > |
12 |
> > diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass |
13 |
> > index 09409ab1f..cdc8c4043 100644 |
14 |
> > --- a/eclass/kernel-2.eclass |
15 |
> > +++ b/eclass/kernel-2.eclass |
16 |
> > @@ -1410,7 +1410,7 @@ getfilevar() { |
17 |
> > |
18 |
> > detect_arch() { |
19 |
> > |
20 |
> > - local ALL_ARCH LOOP_ARCH COMPAT_URI i |
21 |
> > + local ALL_ARCH LOOP_ARCH COMPAT_URI TC_ARCH_KERNEL |
22 |
> > |
23 |
> > # COMPAT_URI is the contents of ${ARCH}_URI |
24 |
> > # ARCH_URI is the URI for all the ${ARCH}_URI patches |
25 |
> > @@ -1418,6 +1418,7 @@ detect_arch() { |
26 |
> > |
27 |
> > ARCH_URI="" |
28 |
> > ARCH_PATCH="" |
29 |
> > + TC_ARCH_KERNEL="" |
30 |
> > ALL_ARCH="ALPHA AMD64 ARM HPPA IA64 M68K MIPS PPC PPC64 S390 SH SPARC X86" |
31 |
> > |
32 |
> > for LOOP_ARCH in ${ALL_ARCH}; do |
33 |
> > @@ -1425,9 +1426,10 @@ detect_arch() { |
34 |
> > COMPAT_URI="${!COMPAT_URI}" |
35 |
> > |
36 |
> > [[ -n ${COMPAT_URI} ]] && \ |
37 |
> > - ARCH_URI="${ARCH_URI} $(echo ${LOOP_ARCH} | tr '[:upper:]' '[:lower:]')? ( ${COMPAT_URI} )" |
38 |
> > + ARCH_URI="${ARCH_URI} ${LOOP_ARCH,,}? ( ${COMPAT_URI} )" |
39 |
> > |
40 |
> > - if [[ ${LOOP_ARCH} == "$(echo $(tc-arch-kernel) | tr '[:lower:]' '[:upper:]')" ]]; then |
41 |
> > + TC_ARCH_KERNEL=$(tc-arch-kernel); |
42 |
> > + if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL^^} ]]; then |
43 |
> > |
44 |
> > |
45 |
> |
46 |
> Unfortunately, the ${VAR,,} and ${VAR^^} forms were added in bash 4.0 |
47 |
> [1], which means they are not available in EAPIs before 6, which only |
48 |
> allow constructs from bash 3.2 [2]. |
49 |
> |
50 |
> [1]: https://tiswww.case.edu/php/chet/bash/NEWS |
51 |
> [2]: https://projects.gentoo.org/pms/6/pms.html#x1-640006 |
52 |
> |
53 |
|
54 |
That's what I wanted to say. However, considering it's broken anyway, I |
55 |
guess this is kind of improvement (since it technically breaks old |
56 |
ebuilds only). |
57 |
|
58 |
As a cheap alternative, you could just do a big 'case' with hardcoded |
59 |
mappings. Or given that ALL_ARCH is already defined, you can define |
60 |
ALL_ARCH_LC (lowercase) and map from one to the other. |
61 |
|
62 |
-- |
63 |
Best regards, |
64 |
Michał Górny |