Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] package_rpm.bbclass: Accomodate dash when using arrays
@ 2012-07-29 21:27 Khem Raj
  2012-07-30  9:26 ` Paul Eggleton
  2012-07-31 11:22 ` Richard Purdie
  0 siblings, 2 replies; 4+ messages in thread
From: Khem Raj @ 2012-07-29 21:27 UTC (permalink / raw)
  To: openembedded-core

we were assigning local variable to an array coming through
positional arguments. local is a non posix contruct thats
also supported by dash luckily but operates differently in this
case it exapnds the array before assignment. so

local pkgs="$@"

turns into pkgs=locale-base-en-us locale-base-en-gb

ant we see errors

run.do_rootfs.25593: 932: local: locale-base-en-gb: bad variable name

So lets not use defining and assigning local in one go
first define a local and then the assignment

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/package_rpm.bbclass |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index b4bc52e..50e9b31 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -200,7 +200,12 @@ rpm_update_pkg () {
 process_pkg_list_rpm() {
 	local insttype=$1
 	shift
-	local pkgs="$@"
+	# $@ is special POSIX linear array can not be assigned
+	# to a local variable directly in dash since its separated by
+	# space and dash expands it before assignment
+	# and local x=1 2 3 and not x="1 2 3"
+	local pkgs
+	pkgs="$@"
 	local confbase=${INSTALL_CONFBASE_RPM}
 
 	echo -n > ${target_rootfs}/install/base_archs.pkglist
-- 
1.7.9.5




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

* Re: [PATCH] package_rpm.bbclass: Accomodate dash when using arrays
  2012-07-29 21:27 [PATCH] package_rpm.bbclass: Accomodate dash when using arrays Khem Raj
@ 2012-07-30  9:26 ` Paul Eggleton
  2012-07-30 15:27   ` Khem Raj
  2012-07-31 11:22 ` Richard Purdie
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Eggleton @ 2012-07-30  9:26 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core

On Sunday 29 July 2012 14:27:05 Khem Raj wrote:
> we were assigning local variable to an array coming through
> positional arguments. local is a non posix contruct thats
> also supported by dash luckily but operates differently in this
> case it exapnds the array before assignment. so
> 
> local pkgs="$@"
> 
> turns into pkgs=locale-base-en-us locale-base-en-gb
> 
> ant we see errors
> 
> run.do_rootfs.25593: 932: local: locale-base-en-gb: bad variable name
> 
> So lets not use defining and assigning local in one go
> first define a local and then the assignment

Oops, sorry about that.

However, in the other thread you said package_rpm.bbclass was "full of 
bashisms" - is there only this one?

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



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

* Re: [PATCH] package_rpm.bbclass: Accomodate dash when using arrays
  2012-07-30  9:26 ` Paul Eggleton
@ 2012-07-30 15:27   ` Khem Raj
  0 siblings, 0 replies; 4+ messages in thread
From: Khem Raj @ 2012-07-30 15:27 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: openembedded-core@lists.openembedded.org



-Khem

On Jul 30, 2012, at 2:26 AM, Paul Eggleton <paul.eggleton@linux.intel.com> wrote:

> On Sunday 29 July 2012 14:27:05 Khem Raj wrote:
>> we were assigning local variable to an array coming through
>> positional arguments. local is a non posix contruct thats
>> also supported by dash luckily but operates differently in this
>> case it exapnds the array before assignment. so
>> 
>> local pkgs="$@"
>> 
>> turns into pkgs=locale-base-en-us locale-base-en-gb
>> 
>> ant we see errors
>> 
>> run.do_rootfs.25593: 932: local: locale-base-en-gb: bad variable name
>> 
>> So lets not use defining and assigning local in one go
>> first define a local and then the assignment
> 
> Oops, sorry about that.
> 
> However, in the other thread you said package_rpm.bbclass was "full of 
> bashisms" - is there only this one?


I was referring to use of local since that is not posix but it seems it's so prevalent that even dash has extension for it so we are ok with dash and bash there 
> 
> Cheers,
> Paul
> 
> -- 
> 
> Paul Eggleton
> Intel Open Source Technology Centre



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

* Re: [PATCH] package_rpm.bbclass: Accomodate dash when using arrays
  2012-07-29 21:27 [PATCH] package_rpm.bbclass: Accomodate dash when using arrays Khem Raj
  2012-07-30  9:26 ` Paul Eggleton
@ 2012-07-31 11:22 ` Richard Purdie
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2012-07-31 11:22 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Sun, 2012-07-29 at 14:27 -0700, Khem Raj wrote:
> we were assigning local variable to an array coming through
> positional arguments. local is a non posix contruct thats
> also supported by dash luckily but operates differently in this
> case it exapnds the array before assignment. so
> 
> local pkgs="$@"
> 
> turns into pkgs=locale-base-en-us locale-base-en-gb
> 
> ant we see errors
> 
> run.do_rootfs.25593: 932: local: locale-base-en-gb: bad variable name
> 
> So lets not use defining and assigning local in one go
> first define a local and then the assignment
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/classes/package_rpm.bbclass |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Merged to master, thanks.

Richard




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

end of thread, other threads:[~2012-07-31 11:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-29 21:27 [PATCH] package_rpm.bbclass: Accomodate dash when using arrays Khem Raj
2012-07-30  9:26 ` Paul Eggleton
2012-07-30 15:27   ` Khem Raj
2012-07-31 11:22 ` Richard Purdie

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