diff options
Diffstat (limited to 'meta/lib/bblayers')
-rw-r--r-- | meta/lib/bblayers/machines.py | 37 | ||||
-rw-r--r-- | meta/lib/bblayers/makesetup.py | 9 | ||||
-rw-r--r-- | meta/lib/bblayers/setupwriters/oe-setup-layers.py | 5 |
3 files changed, 46 insertions, 5 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') | ||
diff --git a/meta/lib/bblayers/makesetup.py b/meta/lib/bblayers/makesetup.py index 99d5973760..4199b5f069 100644 --- a/meta/lib/bblayers/makesetup.py +++ b/meta/lib/bblayers/makesetup.py | |||
@@ -48,8 +48,9 @@ class MakeSetupPlugin(LayerPlugin): | |||
48 | if l_name == 'workspace': | 48 | if l_name == 'workspace': |
49 | continue | 49 | continue |
50 | if l_ismodified: | 50 | if l_ismodified: |
51 | logger.error("Layer {name} in {path} has uncommitted modifications or is not in a git repository.".format(name=l_name,path=l_path)) | 51 | e = "Layer {name} in {path} has uncommitted modifications or is not in a git repository.".format(name=l_name,path=l_path) |
52 | return | 52 | logger.error(e) |
53 | raise Exception(e) | ||
53 | repo_path = oe.buildcfg.get_metadata_git_toplevel(l_path) | 54 | repo_path = oe.buildcfg.get_metadata_git_toplevel(l_path) |
54 | 55 | ||
55 | if self._is_submodule(repo_path): | 56 | if self._is_submodule(repo_path): |
@@ -62,9 +63,6 @@ class MakeSetupPlugin(LayerPlugin): | |||
62 | 'describe':oe.buildcfg.get_metadata_git_describe(repo_path)}} | 63 | 'describe':oe.buildcfg.get_metadata_git_describe(repo_path)}} |
63 | if repo_path == destdir_repo: | 64 | if repo_path == destdir_repo: |
64 | repos[repo_path]['contains_this_file'] = True | 65 | repos[repo_path]['contains_this_file'] = True |
65 | if not repos[repo_path]['git-remote']['remotes'] and not repos[repo_path]['contains_this_file']: | ||
66 | logger.error("Layer repository in {path} does not have any remotes configured. Please add at least one with 'git remote add'.".format(path=repo_path)) | ||
67 | return | ||
68 | 66 | ||
69 | top_path = os.path.commonpath([os.path.dirname(r) for r in repos.keys()]) | 67 | top_path = os.path.commonpath([os.path.dirname(r) for r in repos.keys()]) |
70 | 68 | ||
@@ -74,6 +72,7 @@ class MakeSetupPlugin(LayerPlugin): | |||
74 | repos_nopaths[r_nopath] = repos[r] | 72 | repos_nopaths[r_nopath] = repos[r] |
75 | r_relpath = os.path.relpath(r, top_path) | 73 | r_relpath = os.path.relpath(r, top_path) |
76 | repos_nopaths[r_nopath]['path'] = r_relpath | 74 | repos_nopaths[r_nopath]['path'] = r_relpath |
75 | repos_nopaths[r_nopath]['originpath'] = r | ||
77 | return repos_nopaths | 76 | return repos_nopaths |
78 | 77 | ||
79 | def do_make_setup(self, args): | 78 | def do_make_setup(self, args): |
diff --git a/meta/lib/bblayers/setupwriters/oe-setup-layers.py b/meta/lib/bblayers/setupwriters/oe-setup-layers.py index 59ca968ff3..8faeabfabc 100644 --- a/meta/lib/bblayers/setupwriters/oe-setup-layers.py +++ b/meta/lib/bblayers/setupwriters/oe-setup-layers.py | |||
@@ -85,6 +85,11 @@ class OeSetupLayersWriter(): | |||
85 | if not os.path.exists(args.destdir): | 85 | if not os.path.exists(args.destdir): |
86 | os.makedirs(args.destdir) | 86 | os.makedirs(args.destdir) |
87 | repos = parent.make_repo_config(args.destdir) | 87 | repos = parent.make_repo_config(args.destdir) |
88 | for r in repos.values(): | ||
89 | if not r['git-remote']['remotes'] and not r.get('contains_this_file', False): | ||
90 | e = "Layer repository in {path} does not have any remotes configured. Please add at least one with 'git remote add'.".format(path=r['originpath']) | ||
91 | raise Exception(e) | ||
92 | del r['originpath'] | ||
88 | json = {"version":"1.0","sources":repos} | 93 | json = {"version":"1.0","sources":repos} |
89 | if not repos: | 94 | if not repos: |
90 | err = "Could not determine layer sources" | 95 | err = "Could not determine layer sources" |