[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    Re: [gentoo-dev] Re: [PATCH] eclass/kernel-2.eclass: Remove use of tr in global scope
From:       Ulrich Mueller <ulm () gentoo ! org>
Date:       2017-08-31 9:24:14
Message-ID: 22951.54718.362026.433723 () a1i15 ! kph ! uni-mainz ! de
[Download RAW message or body]


> > > > > On Thu, 31 Aug 2017, Michał Górny wrote:

> > > @@ -1425,9 +1426,10 @@ detect_arch() {
> > > COMPAT_URI="${!COMPAT_URI}"
> > > 
> > > [[ -n ${COMPAT_URI} ]] && \
> > > -           ARCH_URI="${ARCH_URI} $(echo ${LOOP_ARCH} | tr '[:upper:]' \
> > > '[:lower:]')? ( ${COMPAT_URI} )" +           ARCH_URI="${ARCH_URI} \
> > > ${LOOP_ARCH,,}? ( ${COMPAT_URI} )" 
> > > -       if [[ ${LOOP_ARCH} == "$(echo $(tc-arch-kernel) | tr '[:lower:]' \
> > > '[:upper:]')" ]];  then +       TC_ARCH_KERNEL=$(tc-arch-kernel); 
> > > +       if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL^^} ]];   then
> > > 
> > > 
> > 
> > Unfortunately, the ${VAR,,} and ${VAR^^} forms were added in bash
> > 4.0 [1], which means they are not available in EAPIs before 6,
> > which only allow constructs from bash 3.2 [2].
> > 
> > [1]: https://tiswww.case.edu/php/chet/bash/NEWS
> > [2]: https://projects.gentoo.org/pms/6/pms.html#x1-640006

> That's what I wanted to say. However, considering it's broken
> anyway, I guess this is kind of improvement (since it technically
> breaks old ebuilds only).

Many kernel ebuilds are still at EAPI 5, though.

> As a cheap alternative, you could just do a big 'case' with
> hardcoded mappings. Or given that ALL_ARCH is already defined, you
> can define ALL_ARCH_LC (lowercase) and map from one to the other.

There is also "shopt -s nocasematch" which is available since
bash 3.1.

Ulrich


[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic