public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope
@ 2017-08-31 16:33 Mike Pagano
  2017-08-31 17:27 ` Michał Górny
  2017-08-31 17:51 ` Ulrich Mueller
  0 siblings, 2 replies; 6+ messages in thread
From: Mike Pagano @ 2017-08-31 16:33 UTC (permalink / raw
  To: gentoo-dev

As per PMS remove calls to external command 'tr' in global scope See bug #629106.

Signed-off-by: Mike Pagano <mpagano@gentoo.org>
---
 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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope
  2017-08-31 16:33 [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope Mike Pagano
@ 2017-08-31 17:27 ` Michał Górny
  2017-08-31 18:11   ` Mike Pagano
  2017-08-31 17:51 ` Ulrich Mueller
  1 sibling, 1 reply; 6+ messages in thread
From: Michał Górny @ 2017-08-31 17:27 UTC (permalink / raw
  To: gentoo-dev

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 <mpagano@gentoo.org>
> ---
>  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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope
  2017-08-31 16:33 [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope Mike Pagano
  2017-08-31 17:27 ` Michał Górny
@ 2017-08-31 17:51 ` Ulrich Mueller
  1 sibling, 0 replies; 6+ messages in thread
From: Ulrich Mueller @ 2017-08-31 17:51 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 320 bytes --]

>>>>> 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

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope
  2017-08-31 17:27 ` Michał Górny
@ 2017-08-31 18:11   ` Mike Pagano
  2017-08-31 18:53     ` Walter Dnes
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Pagano @ 2017-08-31 18:11 UTC (permalink / raw
  To: gentoo-dev

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.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope
  2017-08-31 18:11   ` Mike Pagano
@ 2017-08-31 18:53     ` Walter Dnes
  2017-08-31 19:05       ` Mike Gilbert
  0 siblings, 1 reply; 6+ messages in thread
From: Walter Dnes @ 2017-08-31 18:53 UTC (permalink / raw
  To: gentoo-dev

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 <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope
  2017-08-31 18:53     ` Walter Dnes
@ 2017-08-31 19:05       ` Mike Gilbert
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Gilbert @ 2017-08-31 19:05 UTC (permalink / raw
  To: Gentoo Dev

On Thu, Aug 31, 2017 at 2:53 PM, Walter Dnes <waltdnes@waltdnes.org> 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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-08-31 19:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-31 16:33 [gentoo-dev] [PATCH v2] eclass/kernel-2.eclass: Remove use of tr in global scope Mike Pagano
2017-08-31 17:27 ` Michał Górny
2017-08-31 18:11   ` Mike Pagano
2017-08-31 18:53     ` Walter Dnes
2017-08-31 19:05       ` Mike Gilbert
2017-08-31 17:51 ` Ulrich Mueller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox