Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] runqemu: fix the tests for core-image-*
@ 2012-05-14 22:49 Peter Seebach
  2012-05-14 22:49 ` [PATCH 1/1] runqemu: replace bashism with working shell idiom Peter Seebach
  2012-05-16 18:16 ` [PATCH 0/1] runqemu: fix the tests for core-image-* Saul Wold
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Seebach @ 2012-05-14 22:49 UTC (permalink / raw)
  To: openembedded-core

This replaces the =~ tests with a dash-friendly shell idiom which is,
IMHO, comparably readable (I actually like it better) and also works
on more versions of bash.

A side note:  Do we really need a more complicated test instead of
just "*core-image-*"?

The following changes since commit 36d1717e2ad4ca1620ee9f01b524b5ff2f499b26:
  Paul Eggleton (1):
        classes/rootfs_*: fix splitting package dependency strings

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib seebs/cleanup
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=seebs/cleanup

Peter Seebach (1):
  runqemu: replace bashism with working shell idiom

 scripts/runqemu |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)




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

* [PATCH 1/1] runqemu: replace bashism with working shell idiom
  2012-05-14 22:49 [PATCH 0/1] runqemu: fix the tests for core-image-* Peter Seebach
@ 2012-05-14 22:49 ` Peter Seebach
  2012-05-15  2:18   ` Scott Garman
  2012-05-16 18:16 ` [PATCH 0/1] runqemu: fix the tests for core-image-* Saul Wold
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Seebach @ 2012-05-14 22:49 UTC (permalink / raw)
  To: openembedded-core

The =~ operator is not one of my favorites, not just due to portability
issues, but because it's not well known, and a lot of people might
not expect a regex operator.

The canonical shell idiom for this is to use case with alternation
and wildcards.  As a side note, if you are matching anything containing
core-image-sato, you don't need to also check for core-image-sato-sdk.

Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
---
 scripts/runqemu |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 305e46a..fc7363f 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -300,14 +300,15 @@ findimage() {
     # recently created one is the one we most likely want to boot.
     filenames=`ls -t $where/*-image*$machine.$extension 2>/dev/null | xargs`
     for name in $filenames; do
-        if [ "$name" =~ core-image-sato-sdk -o \
-              "$name" =~ core-image-sato     -o \
-              "$name" =~ core-image-lsb      -o \
-              "$name" =~ core-image-basic    -o \
-              "$name" =~ core-image-minimal ]; then
+        case $name in
+        *core-image-sato* | \
+        *core-image-lsb* | \
+        *core-image-basic* | \
+        *core-image-minimal* )
             ROOTFS=$name
             return
-        fi	
+            ;;
+        esac
     done
 
     echo "Couldn't find a $machine rootfs image in $where."
-- 
1.7.0.4




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

* Re: [PATCH 1/1] runqemu: replace bashism with working shell idiom
  2012-05-14 22:49 ` [PATCH 1/1] runqemu: replace bashism with working shell idiom Peter Seebach
@ 2012-05-15  2:18   ` Scott Garman
  0 siblings, 0 replies; 4+ messages in thread
From: Scott Garman @ 2012-05-15  2:18 UTC (permalink / raw)
  To: openembedded-core

On 05/14/2012 03:49 PM, Peter Seebach wrote:
> The =~ operator is not one of my favorites, not just due to portability
> issues, but because it's not well known, and a lot of people might
> not expect a regex operator.
>
> The canonical shell idiom for this is to use case with alternation
> and wildcards.  As a side note, if you are matching anything containing
> core-image-sato, you don't need to also check for core-image-sato-sdk.
>
> Signed-off-by: Peter Seebach<peter.seebach@windriver.com>

Thank you, Peter.

Acked-by: Scott Garman <scott.a.garman@intel.com>

> ---
>   scripts/runqemu |   13 +++++++------
>   1 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/scripts/runqemu b/scripts/runqemu
> index 305e46a..fc7363f 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -300,14 +300,15 @@ findimage() {
>       # recently created one is the one we most likely want to boot.
>       filenames=`ls -t $where/*-image*$machine.$extension 2>/dev/null | xargs`
>       for name in $filenames; do
> -        if [ "$name" =~ core-image-sato-sdk -o \
> -              "$name" =~ core-image-sato     -o \
> -              "$name" =~ core-image-lsb      -o \
> -              "$name" =~ core-image-basic    -o \
> -              "$name" =~ core-image-minimal ]; then
> +        case $name in
> +        *core-image-sato* | \
> +        *core-image-lsb* | \
> +        *core-image-basic* | \
> +        *core-image-minimal* )
>               ROOTFS=$name
>               return
> -        fi	
> +            ;;
> +        esac
>       done
>
>       echo "Couldn't find a $machine rootfs image in $where."


-- 
Scott Garman
Embedded Linux Engineer - Yocto Project
Intel Open Source Technology Center



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

* Re: [PATCH 0/1] runqemu: fix the tests for core-image-*
  2012-05-14 22:49 [PATCH 0/1] runqemu: fix the tests for core-image-* Peter Seebach
  2012-05-14 22:49 ` [PATCH 1/1] runqemu: replace bashism with working shell idiom Peter Seebach
@ 2012-05-16 18:16 ` Saul Wold
  1 sibling, 0 replies; 4+ messages in thread
From: Saul Wold @ 2012-05-16 18:16 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On 05/15/2012 01:49 AM, Peter Seebach wrote:
> This replaces the =~ tests with a dash-friendly shell idiom which is,
> IMHO, comparably readable (I actually like it better) and also works
> on more versions of bash.
>
> A side note:  Do we really need a more complicated test instead of
> just "*core-image-*"?
>
> The following changes since commit 36d1717e2ad4ca1620ee9f01b524b5ff2f499b26:
>    Paul Eggleton (1):
>          classes/rootfs_*: fix splitting package dependency strings
>
> are available in the git repository at:
>
>    git://git.yoctoproject.org/poky-contrib seebs/cleanup
>    http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=seebs/cleanup
>
> Peter Seebach (1):
>    runqemu: replace bashism with working shell idiom
>
>   scripts/runqemu |   13 +++++++------
>   1 files changed, 7 insertions(+), 6 deletions(-)
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
Merged into OE-Core

Thanks
	Sau!



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

end of thread, other threads:[~2012-05-16 18:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-14 22:49 [PATCH 0/1] runqemu: fix the tests for core-image-* Peter Seebach
2012-05-14 22:49 ` [PATCH 1/1] runqemu: replace bashism with working shell idiom Peter Seebach
2012-05-15  2:18   ` Scott Garman
2012-05-16 18:16 ` [PATCH 0/1] runqemu: fix the tests for core-image-* Saul Wold

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