diff mbox series

scripts/oe-find-native-sysroot: fix get sysroot failed

Message ID 20250611122339.2893630-1-hongxu.jia@windriver.com
State New
Headers show
Series scripts/oe-find-native-sysroot: fix get sysroot failed | expand

Commit Message

Hongxu Jia June 11, 2025, 12:23 p.m. UTC
Calling oe-debuginfod in a build failed:
...
$ oe-debuginfod
|Getting sysroot...
|Error: NOTE: Reconnecting to bitbake server...
|NOTE: Retrying server connection (#1)... (18:55:53.009687)
|path-to-build/tmp/work/x86_64-linux/elfutils-native/0.192/recipe-sysroot-native doesn't exist.
|Have you run 'bitbake elfutils-native -caddto_recipe_sysroot'?
...

While calling bitbake-getvar to get sysroot, the output of bitbake-getvar
was mixed with output from bitbake
...
NOTE: Reconnecting to bitbake server...
...

Improve the output of bitbake-getvar, filter out unrelated message

BTW: bitbake-getvar --quiet (Silence bitbake server logging) could not
skip above "NOTE: Reconnecting to bitbake server..." message from bitbake

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 scripts/oe-find-native-sysroot | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Kanavin June 11, 2025, 1:14 p.m. UTC | #1
On Wed, 11 Jun 2025 at 14:23, hongxu via lists.openembedded.org
<hongxu.jia=eng.windriver.com@lists.openembedded.org> wrote:
> BTW: bitbake-getvar --quiet (Silence bitbake server logging) could not
> skip above "NOTE: Reconnecting to bitbake server..." message from bitbake

But it should, and it's better to fix that. Otherwise we have to
plaster similar workarounds everywhere where bitbake-getvar is used in
scripts.

I see e.g. 'bitbake-getvar --value BBLAYERS | tail -1' is used
elsewhere, presumably for similar reasons.

Alex
hongxu June 12, 2025, 5:10 a.m. UTC | #2
On Wed, Jun 11, 2025 at 06:14 AM, Alexander Kanavin wrote:

> 
> 
>> BTW: bitbake-getvar --quiet (Silence bitbake server logging) could not
>> skip above "NOTE: Reconnecting to bitbake server..." message from bitbake
> 
> But it should, and it's better to fix that. Otherwise we have to
> plaster similar workarounds everywhere where bitbake-getvar is used in
> scripts.

Sure, submitted patch to bitbake to skip noisy output for bitbake-getvar

https://lists.openembedded.org/g/bitbake-devel/message/17694?p=%2C%2C%2C20%2C0%2C0%2C0%3A%3ACreated%2C%2C%2C20%2C2%2C0%2C113601893%2Cd%253D3&d=3

Please ignore this patch

//Hongxu

> 
> I see e.g. 'bitbake-getvar --value BBLAYERS | tail -1' is used
> elsewhere, presumably for similar reasons.
> 
> Alex
diff mbox series

Patch

diff --git a/scripts/oe-find-native-sysroot b/scripts/oe-find-native-sysroot
index 6228efcbeec..778c16f5db8 100755
--- a/scripts/oe-find-native-sysroot
+++ b/scripts/oe-find-native-sysroot
@@ -38,7 +38,7 @@  fi
 # Global vars
 set_oe_native_sysroot(){
     echo "Getting sysroot..."
-    OECORE_NATIVE_SYSROOT=$(bitbake-getvar -r $1 --value STAGING_DIR_NATIVE)
+    OECORE_NATIVE_SYSROOT=$(bitbake-getvar -r $1 STAGING_DIR_NATIVE |grep '^STAGING_DIR_NATIVE='|sed -e 's/^STAGING_DIR_NATIVE=//' -e 's/"//g')
 }
 
 if [ "x$OECORE_NATIVE_SYSROOT" = "x" ]; then