Commit Graph

10 Commits

Author SHA1 Message Date
hongxu
8bd8461212 bitbake: bitbake-getvar: skip info output of bitbake for quiet
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'?
...

The script oe-debuginfod calls bitbake-getvar to get sysroot, the
output of bitbake-getvar was mixed with info output of bitbake
...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)... (18:55:53.009687)
...

Set logger level to logging.WARNING to skip info output
for quiet

(Bitbake rev: 873c524e1a33846df8f34b7c87b298349277b3d5)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-06-16 22:23:18 +01:00
BELHADJ SALEM Talel
f0824f9270 bitbake: bitbake-getvar: Catch NoProvider exception
When the recipe provided by (-r, --recipe) is not found
tinfoil raises an exception that is not catched for
readability, example:

Traceback (most recent call last):
  File "/.../poky/bitbake/bin/bitbake-getvar", line 45, in <module>
    d = tinfoil.parse_recipe(args.recipe)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../poky/bitbake/lib/bb/tinfoil.py", line 633, in parse_recipe
    fn = self.get_recipe_file(pn)
         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../poky/bitbake/lib/bb/tinfoil.py", line 550, in get_recipe_file
    raise bb.providers.NoProvider('Unable to find any recipe file matching "%s"' % pn)
bb.providers.NoProvider: Unable to find any recipe file matching "aaa"

(Bitbake rev: 06aa6c292813a28c84736193b550fb2d18884d43)

Signed-off-by: Talel BELHAJSALEM <bhstalel@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-11-21 12:16:28 +00:00
Yoann Congal
4be9d61225 bitbake: bitbake-getvar: use finalizeData tinfoil API to get identical result to "bitbake -e"
Fixes [YOCTO #15638]

(Bitbake rev: 68ae81dc93f86eab378fec2276561c5062263d7e)

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-11-18 13:41:38 +00:00
Peter Kjellerstedt
3b46d6a41a bitbake: bitbake-getvar: Treat undefined variables as empty with --value
Rather than outputting the string "None" for undefined variables, output
only a linefeed (the same as for variables that are defined to the empty
string).

(Bitbake rev: f3ba9c3726ec7b38b557100d8a2d4b6a1446a968)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-28 12:38:26 +01:00
Peter Kjellerstedt
826807785e bitbake: bitbake-getvar: Add a (suppressable) error for undefined variables
If an undefined variable or variable flag is specified, bitbake-getvar
will now fail with an error message indicating this.

The error can be supressed with --ignore-undefined, which matches the
previous behavior.

This also changes the errors related to specifying --flag or --unexpand
without --value so that they are sent to stderr rather than stdout.

(Bitbake rev: 136b8dda4e8b6f4d7e45a552c2d2e278b3ae1b7d)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-28 12:38:26 +01:00
Peter Kjellerstedt
0dbc45e52f bitbake: bitbake-getvar: Make --value imply --quiet
It does not make any sense to get log output from bitbake-getvar when
the --value option is used as the log output is sent to stdout and thus
interferes with the output of the variable's value.

(Bitbake rev: 6b7883533af9c14d80a9f1ae5142644f155b5dee)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-26 10:37:17 +01:00
Peter Kjellerstedt
874e8bb159 bitbake: bitbake-getvar: Make --quiet work with --recipe
Initializing Tinfoil with setup_logging = False only has an effect when
recipe parsing is not needed. To make it work regardless of if --recipe
is used, manipulate the quiet parameter to Tinfoil.prepare() instead.

(Bitbake rev: 71ee69a20f21f3d37f4f060a7d8e87d9f1dc6aa1)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-26 10:37:17 +01:00
Paulo Neves
f98bf56074 bitbake: bitbake-getvar: Add a quiet command line argument
bitbake-getvar does not have a way to silence bitbake
server's logger and that makes the tool hard to use for
text processing. This is especially true when one wants to
get a bitbake value to be piped to some other utility and
instead we get uncontrolled logging messages or warnings
together with bitbake's variable value.

Example without quiet:
bitbake-getvar --value MACHINE
NOTE: Starting bitbake server...
qemux86-64

With quiet:
bitbake-getvar --value MACHINE --quiet
qemux86-64

(Bitbake rev: af354e975d0b4c26d0e91e3c82946b093bc11b45)

Signed-off-by: Paulo Neves <ptsneves@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-01-26 21:50:31 +00:00
Alexander Kanavin
2b399a01b5 bitbake: bitbake: enable python warnings at the first opportunity
We really do want to see those, as they tend to turn into
hard errors eventually, as what happened with collections
vs collections.abc in python 3.10.

(Bitbake rev: bc43fbb86361a21dc2d5deb910810c5a77fdabe8)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-09-19 11:33:14 +01:00
Richard Purdie
7bbeddeee1 bitbake: bin/bitbake-getvar: Add a new command to query a variable value (with history)
We've talked about having this for long enough. Add a command which queries a single
variable value with history. This saves "bitbake -e | grep" and avoids the
various pitfalls that has.

It also provides a neat example of using tinfoil to make such a query.

Parameters to limit the output to just the value, to limit to a variable flag
and to not expand the output are provided.

[YOCTO #10748]

(Bitbake rev: 4c1881b620e885f55d7772f8626b8a76c2828333)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-05-06 11:08:08 +01:00