runqemu: fix the tests for core-image-*
cover runqemu: fix the tests for core-image-*
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(-)
PATCH 1/1 runqemu: replace bashism with working shell idiom
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.
--- scripts/runqemu | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)
scripts/runqemu +7 -6
@@ -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."
Signature · 1 line
1.7.0.4
Re: [PATCH 1/1] runqemu: replace bashism with working shell idiom
Quoted 9 lines · Peter Seebach
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<[email protected]>
Thank you, Peter.
Quoted 30 lines
--- scripts/runqemu | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)scripts/runqemu +7
-6@@ -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."
Signature · 3 lines
Scott Garman Embedded Linux Engineer - Yocto Project Intel Open Source Technology Center
Saul Wold
AppliedQuoted 19 lines · Peter Seebach
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 stringsare available in the git repository at:
git://git.yoctoproject.org/poky-contribseebs/cleanup
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=seebs/cleanupPeter Seebach (1):
runqemu: replace bashism with working shell idiom
Quoted 9 lines
scripts/runqemu | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Merged into OE-Core
Thanks
Sau!