Re: [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope

2017-08-31 Thread Mike Gilbert
On Thu, Aug 31, 2017 at 2:53 PM, Walter Dnes  wrote:
> On Thu, Aug 31, 2017 at 02:11:30PM -0400, Mike Pagano wrote
>> On Thu, Aug 31, 2017 at 07:27:10PM +0200, Micha?? Górny wrote:
>> > W dniu czw, 31.08.2017 o godzinie 12???33???-0400, u??ytkownik Mike Pagano
>> > napisa??:
>> > > As per PMS remove calls to external command 'tr' in global scope See bug 
>> > > #629106.
>> >
>> > Closes: https://bugs.gentoo.org/629106
>> >
>> > (assuming you want the bug closed)
>> >
>> > >
>>
>> Thanks for the review. Committed.  It seems we are limited by PMS one
>> way or the other.  If someone has a better idea of doing this simple
>> lowercase/uppercase change that satisifies PMS at all versions I am
>> happy to revisit.
>
>   Is "sed -e" allowed?  E.g.

No. sed is an external binary that may not be called from global scpoe.



Re: [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope

2017-08-31 Thread Walter Dnes
On Thu, Aug 31, 2017 at 02:11:30PM -0400, Mike Pagano wrote
> On Thu, Aug 31, 2017 at 07:27:10PM +0200, Micha?? Górny wrote:
> > W dniu czw, 31.08.2017 o godzinie 12???33???-0400, u??ytkownik Mike Pagano
> > napisa??:
> > > As per PMS remove calls to external command 'tr' in global scope See bug 
> > > #629106.
> > 
> > Closes: https://bugs.gentoo.org/629106
> > 
> > (assuming you want the bug closed)
> > 
> > > 
> 
> Thanks for the review. Committed.  It seems we are limited by PMS one
> way or the other.  If someone has a better idea of doing this simple
> lowercase/uppercase change that satisifies PMS at all versions I am
> happy to revisit.

  Is "sed -e" allowed?  E.g.

[d531][waltdnes][~] echo "AbCd" | sed -e 's/\(.*\)/\L\1/' 
abcd
[d531][waltdnes][~] echo "AbCd" | sed -e 's/\(.*\)/\U\1/'
ABCD

-- 
Walter Dnes 
I don't run "desktop environments"; I run useful applications



Re: [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope

2017-08-31 Thread Mike Pagano
On Thu, Aug 31, 2017 at 07:27:10PM +0200, Michał Górny wrote:
> W dniu czw, 31.08.2017 o godzinie 12∶33 -0400, użytkownik Mike Pagano
> napisał:
> > As per PMS remove calls to external command 'tr' in global scope See bug 
> > #629106.
> 
> Closes: https://bugs.gentoo.org/629106
> 
> (assuming you want the bug closed)
> 
> > 

Thanks for the review. Committed.  It seems we are limited by PMS one
way or the other.  If someone has a better idea of doing this simple
lowercase/uppercase change that satisifies PMS at all versions I am
happy to revisit.





Re: [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope

2017-08-31 Thread Ulrich Mueller
> On Thu, 31 Aug 2017, Mike Pagano wrote:

> + declare -l LOOP_ARCH_L=${LOOP_ARCH}
> [...]
> + declare -u TC_ARCH_KERNEL=$(tc-arch-kernel); 

This is not legal in EAPI 5 or earlier, because the -l and -u options
of declare did not exist in bash 3.2. So it is no improvement over
using ,, and ^^ operators.

Ulrich


pgp3pirt7YEKp.pgp
Description: PGP signature


Re: [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope

2017-08-31 Thread Michał Górny
W dniu czw, 31.08.2017 o godzinie 12∶33 -0400, użytkownik Mike Pagano
napisał:
> As per PMS remove calls to external command 'tr' in global scope See bug 
> #629106.

Closes: https://bugs.gentoo.org/629106

(assuming you want the bug closed)

> 
> Signed-off-by: Mike Pagano 
> ---
>  eclass/kernel-2.eclass | 11 ---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
> index 09409ab1f..205ea93d5 100644
> --- a/eclass/kernel-2.eclass
> +++ b/eclass/kernel-2.eclass
> @@ -1410,7 +1410,7 @@ getfilevar() {
>  
>  detect_arch() {
>  
> - local ALL_ARCH LOOP_ARCH COMPAT_URI i
> + 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
> @@ -1418,20 +1418,25 @@ detect_arch() {
>  
>   ARCH_URI=""
>   ARCH_PATCH=""
> + TC_ARCH_KERNEL=""
>   ALL_ARCH="ALPHA AMD64 ARM HPPA IA64 M68K MIPS PPC PPC64 S390 SH SPARC 
> X86"
>  
>   for LOOP_ARCH in ${ALL_ARCH}; do
>   COMPAT_URI="${LOOP_ARCH}_URI"
>   COMPAT_URI="${!COMPAT_URI}"
>  
> + declare -l LOOP_ARCH_L=${LOOP_ARCH}
> +
>   [[ -n ${COMPAT_URI} ]] && \
> - ARCH_URI="${ARCH_URI} $(echo ${LOOP_ARCH} | tr 
> '[:upper:]' '[:lower:]')? ( ${COMPAT_URI} )"
> + ARCH_URI="${ARCH_URI} ${LOOP_ARCH_L}? ( ${COMPAT_URI} )"
>  
> - if [[ ${LOOP_ARCH} == "$(echo $(tc-arch-kernel) | tr 
> '[:lower:]' '[:upper:]')" ]];  then
> + declare -u TC_ARCH_KERNEL=$(tc-arch-kernel); 

Strictly speaking, you shouldn't use tc-arch-kernel in global scope
either since it depends on CHOST. However, we can live with it for now.

Also, didn't you accidentally add a trailing space there?

> + if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL} ]]; then

Missing newline? Tab in middle of the line looks weird.

>   for i in ${COMPAT_URI}; do
>   ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}"
>   done
>   fi
> +
>   done
>  }
>  

Besides those minor nits, +1.

-- 
Best regards,
Michał Górny




[gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope

2017-08-31 Thread Mike Pagano
As per PMS remove calls to external command 'tr' in global scope See bug 
#629106.

Signed-off-by: Mike Pagano 
---
 eclass/kernel-2.eclass | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 09409ab1f..205ea93d5 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1410,7 +1410,7 @@ getfilevar() {
 
 detect_arch() {
 
-   local ALL_ARCH LOOP_ARCH COMPAT_URI i
+   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
@@ -1418,20 +1418,25 @@ detect_arch() {
 
ARCH_URI=""
ARCH_PATCH=""
+   TC_ARCH_KERNEL=""
ALL_ARCH="ALPHA AMD64 ARM HPPA IA64 M68K MIPS PPC PPC64 S390 SH SPARC 
X86"
 
for LOOP_ARCH in ${ALL_ARCH}; do
COMPAT_URI="${LOOP_ARCH}_URI"
COMPAT_URI="${!COMPAT_URI}"
 
+   declare -l LOOP_ARCH_L=${LOOP_ARCH}
+
[[ -n ${COMPAT_URI} ]] && \
-   ARCH_URI="${ARCH_URI} $(echo ${LOOP_ARCH} | tr 
'[:upper:]' '[:lower:]')? ( ${COMPAT_URI} )"
+   ARCH_URI="${ARCH_URI} ${LOOP_ARCH_L}? ( ${COMPAT_URI} )"
 
-   if [[ ${LOOP_ARCH} == "$(echo $(tc-arch-kernel) | tr 
'[:lower:]' '[:upper:]')" ]];  then
+   declare -u 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