diff mbox series

[2/2] scripts/oe-find-native-sysroot: use bitbake-getvar

Message ID 20230906151648.313352-2-ross.burton@arm.com
State Accepted, archived
Commit b5011a2fc248d88b5491cf6af1fc15e5974f6e45
Headers show
Series [1/2] qemu-system-native: enable PNG support | expand

Commit Message

Ross Burton Sept. 6, 2023, 3:16 p.m. UTC
From: Ross Burton <ross.burton@arm.com>

Instead of bitbake and grep, just use bitbake-getvar.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 scripts/oe-find-native-sysroot | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

Comments

Jose Quaresma Sept. 7, 2023, 11:23 a.m. UTC | #1
Sorry, I have replayed directly to Ross so forward to the list.

I also have tested it locally and if there are some warnings generated they
will be captured as well
breaking the OECORE_NATIVE_SYSROOT content, so the -q is required.

Jose

---------- Forwarded message ---------
De: Jose Quaresma <quaresma.jose@gmail.com>
Date: quarta, 6/09/2023 à(s) 17:37
Subject: Re: [OE-core] [PATCH 2/2] scripts/oe-find-native-sysroot: use
bitbake-getvar
To: Ross Burton <ross.burton@arm.com>




Ross Burton <ross.burton@arm.com> escreveu no dia quarta, 6/09/2023 à(s)
16:16:

> From: Ross Burton <ross.burton@arm.com>
>
> Instead of bitbake and grep, just use bitbake-getvar.
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
>  scripts/oe-find-native-sysroot | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/scripts/oe-find-native-sysroot
> b/scripts/oe-find-native-sysroot
> index 5146bbf9999..6228efcbeec 100755
> --- a/scripts/oe-find-native-sysroot
> +++ b/scripts/oe-find-native-sysroot
> @@ -36,20 +36,9 @@ if [ "$1" = '--help' -o "$1" = '-h' -o $# -ne 1 ] ; then
>  fi
>
>  # Global vars
> -BITBAKE_E=""
>  set_oe_native_sysroot(){
> -    echo "Running bitbake -e $1"
> -    BITBAKE_E="`bitbake -e $1`"
> -    OECORE_NATIVE_SYSROOT=`echo "$BITBAKE_E" | grep ^STAGING_DIR_NATIVE=
> | cut -d '"' -f2`
> -
> -    if [ "x$OECORE_NATIVE_SYSROOT" = "x" ]; then
> -        # This indicates that there was an error running bitbake -e that
> -        # the user needs to be informed of
> -        echo "There was an error running bitbake to determine
> STAGING_DIR_NATIVE"
> -        echo "Here is the output from bitbake -e $1"
> -        echo $BITBAKE_E
> -        exit 1
> -    fi
> +    echo "Getting sysroot..."
> +    OECORE_NATIVE_SYSROOT=$(bitbake-getvar -r $1 --value
> STAGING_DIR_NATIVE)
>

Maybe you should use --quite to silent the logs.

Jose


>  }
>
>  if [ "x$OECORE_NATIVE_SYSROOT" = "x" ]; then
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#187321):
> https://lists.openembedded.org/g/openembedded-core/message/187321
> Mute This Topic: https://lists.openembedded.org/mt/101194938/5052612
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> quaresma.jose@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/scripts/oe-find-native-sysroot b/scripts/oe-find-native-sysroot
index 5146bbf9999..6228efcbeec 100755
--- a/scripts/oe-find-native-sysroot
+++ b/scripts/oe-find-native-sysroot
@@ -36,20 +36,9 @@  if [ "$1" = '--help' -o "$1" = '-h' -o $# -ne 1 ] ; then
 fi
 
 # Global vars
-BITBAKE_E=""
 set_oe_native_sysroot(){
-    echo "Running bitbake -e $1"
-    BITBAKE_E="`bitbake -e $1`"
-    OECORE_NATIVE_SYSROOT=`echo "$BITBAKE_E" | grep ^STAGING_DIR_NATIVE= | cut -d '"' -f2`
-
-    if [ "x$OECORE_NATIVE_SYSROOT" = "x" ]; then
-        # This indicates that there was an error running bitbake -e that
-        # the user needs to be informed of
-        echo "There was an error running bitbake to determine STAGING_DIR_NATIVE"
-        echo "Here is the output from bitbake -e $1"
-        echo $BITBAKE_E
-        exit 1
-    fi
+    echo "Getting sysroot..."
+    OECORE_NATIVE_SYSROOT=$(bitbake-getvar -r $1 --value STAGING_DIR_NATIVE)
 }
 
 if [ "x$OECORE_NATIVE_SYSROOT" = "x" ]; then