diff options
author | BELHADJ SALEM Talel <bhstalel@gmail.com> | 2024-11-20 20:08:21 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-11-21 12:16:28 +0000 |
commit | f0824f9270daf4cb6ecb42b4dd60229c0725f6b6 (patch) | |
tree | ab8e4ede6f5e6dcf06253e78d67c98a7d3e2d4d4 | |
parent | b4bd930fb202d52b328eff6c46f2dd94b3ba46ff (diff) | |
download | poky-f0824f9270daf4cb6ecb42b4dd60229c0725f6b6.tar.gz |
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>
-rwxr-xr-x | bitbake/bin/bitbake-getvar | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bitbake/bin/bitbake-getvar b/bitbake/bin/bitbake-getvar index 20c0b696f7..1719824d95 100755 --- a/bitbake/bin/bitbake-getvar +++ b/bitbake/bin/bitbake-getvar | |||
@@ -16,6 +16,7 @@ bindir = os.path.dirname(__file__) | |||
16 | topdir = os.path.dirname(bindir) | 16 | topdir = os.path.dirname(bindir) |
17 | sys.path[0:0] = [os.path.join(topdir, 'lib')] | 17 | sys.path[0:0] = [os.path.join(topdir, 'lib')] |
18 | 18 | ||
19 | import bb.providers | ||
19 | import bb.tinfoil | 20 | import bb.tinfoil |
20 | 21 | ||
21 | if __name__ == "__main__": | 22 | if __name__ == "__main__": |
@@ -40,7 +41,10 @@ if __name__ == "__main__": | |||
40 | with bb.tinfoil.Tinfoil(tracking=True, setup_logging=not quiet) as tinfoil: | 41 | with bb.tinfoil.Tinfoil(tracking=True, setup_logging=not quiet) as tinfoil: |
41 | if args.recipe: | 42 | if args.recipe: |
42 | tinfoil.prepare(quiet=3 if quiet else 2) | 43 | tinfoil.prepare(quiet=3 if quiet else 2) |
43 | d = tinfoil.parse_recipe(args.recipe) | 44 | try: |
45 | d = tinfoil.parse_recipe(args.recipe) | ||
46 | except bb.providers.NoProvider as e: | ||
47 | sys.exit(str(e)) | ||
44 | else: | 48 | else: |
45 | tinfoil.prepare(quiet=2, config_only=True) | 49 | tinfoil.prepare(quiet=2, config_only=True) |
46 | # Expand keys and run anonymous functions to get identical result to | 50 | # Expand keys and run anonymous functions to get identical result to |