diff options
author | Ross Burton <ross.burton@arm.com> | 2024-08-07 18:27:31 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-08-09 22:33:38 +0100 |
commit | 478f44650a0a01b59d964a5aa7601027430b7648 (patch) | |
tree | a2538961dc1cdfc2609621bd7823ed4db408ccab /meta/lib | |
parent | 5f273feeba21661fd8038ad58c96f4030fae4d96 (diff) | |
download | poky-478f44650a0a01b59d964a5aa7601027430b7648.tar.gz |
bblayers/machines: add bitbake-layers command to list machines
Add a command to bitbake-layers to list the machines available in the
current configuration.
(From OE-Core rev: 837d32dafc125d58bb11da990ac251bd5aad027e)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/bblayers/machines.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/meta/lib/bblayers/machines.py b/meta/lib/bblayers/machines.py new file mode 100644 index 0000000000..5fd970af0e --- /dev/null +++ b/meta/lib/bblayers/machines.py | |||
@@ -0,0 +1,37 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: GPL-2.0-only | ||
5 | # | ||
6 | |||
7 | import logging | ||
8 | import pathlib | ||
9 | |||
10 | from bblayers.common import LayerPlugin | ||
11 | |||
12 | logger = logging.getLogger('bitbake-layers') | ||
13 | |||
14 | def plugin_init(plugins): | ||
15 | return ShowMachinesPlugin() | ||
16 | |||
17 | class ShowMachinesPlugin(LayerPlugin): | ||
18 | def do_show_machines(self, args): | ||
19 | """List the machines available in the currently configured layers.""" | ||
20 | |||
21 | for layer_dir in self.bblayers: | ||
22 | layer_name = self.get_layer_name(layer_dir) | ||
23 | |||
24 | if args.layer and args.layer != layer_name: | ||
25 | continue | ||
26 | |||
27 | for p in sorted(pathlib.Path(layer_dir).glob("conf/machine/*.conf")): | ||
28 | if args.bare: | ||
29 | logger.plain("%s" % (p.stem)) | ||
30 | else: | ||
31 | logger.plain("%s (%s)" % (p.stem, layer_name)) | ||
32 | |||
33 | |||
34 | def register_commands(self, sp): | ||
35 | parser_show_machines = self.add_command(sp, "show-machines", self.do_show_machines) | ||
36 | parser_show_machines.add_argument('-b', '--bare', help='output just the machine names, not the source layer', action='store_true') | ||
37 | parser_show_machines.add_argument('-l', '--layer', help='Limit to machines in the specified layer') | ||