diff options
-rw-r--r-- | meta/lib/oeqa/selftest/cases/bblayers.py | 6 | ||||
-rwxr-xr-x | scripts/oe-setup-layers | 15 |
2 files changed, 17 insertions, 4 deletions
diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py index 2475a79468..34363cd791 100644 --- a/meta/lib/oeqa/selftest/cases/bblayers.py +++ b/meta/lib/oeqa/selftest/cases/bblayers.py | |||
@@ -163,7 +163,5 @@ class BitbakeLayers(OESelftestTestCase): | |||
163 | 163 | ||
164 | testcheckoutdir = os.path.join(self.builddir, 'test-layer-checkout') | 164 | testcheckoutdir = os.path.join(self.builddir, 'test-layer-checkout') |
165 | result = runCmd('{}/setup-layers --destdir {}'.format(self.testlayer_path, testcheckoutdir)) | 165 | result = runCmd('{}/setup-layers --destdir {}'.format(self.testlayer_path, testcheckoutdir)) |
166 | # May not necessarily be named 'poky' or 'openembedded-core' | 166 | layers_json = os.path.join(testcheckoutdir, ".oe-layers.json") |
167 | oecoredir = os.listdir(testcheckoutdir)[0] | 167 | self.assertTrue(os.path.exists(layers_json), "File {} not found in test layer checkout".format(layers_json)) |
168 | testcheckoutfile = os.path.join(testcheckoutdir, oecoredir, "oe-init-build-env") | ||
169 | self.assertTrue(os.path.exists(testcheckoutfile), "File {} not found in test layer checkout".format(testcheckoutfile)) | ||
diff --git a/scripts/oe-setup-layers b/scripts/oe-setup-layers index 6d49688a32..bee4ef0fec 100755 --- a/scripts/oe-setup-layers +++ b/scripts/oe-setup-layers | |||
@@ -49,11 +49,24 @@ def _is_repo_at_remote_uri(repodir, remote, uri): | |||
49 | def _contains_submodules(repodir): | 49 | def _contains_submodules(repodir): |
50 | return os.path.exists(os.path.join(repodir,".gitmodules")) | 50 | return os.path.exists(os.path.join(repodir,".gitmodules")) |
51 | 51 | ||
52 | def _write_layer_list(dest, repodirs): | ||
53 | layers = [] | ||
54 | for r in repodirs: | ||
55 | for root, dirs, files in os.walk(r): | ||
56 | if os.path.basename(root) == 'conf' and 'layer.conf' in files: | ||
57 | layers.append(os.path.relpath(os.path.dirname(root), dest)) | ||
58 | layers_f = os.path.join(dest, ".oe-layers.json") | ||
59 | print("Writing list of layers into {}".format(layers_f)) | ||
60 | with open(layers_f, 'w') as f: | ||
61 | json.dump({"version":"1.0","layers":layers}, f, sort_keys=True, indent=4) | ||
62 | |||
52 | def _do_checkout(args, json): | 63 | def _do_checkout(args, json): |
53 | repos = json['sources'] | 64 | repos = json['sources'] |
65 | repodirs = [] | ||
54 | for r_name in repos: | 66 | for r_name in repos: |
55 | r_data = repos[r_name] | 67 | r_data = repos[r_name] |
56 | repodir = os.path.abspath(os.path.join(args['destdir'], r_data['path'])) | 68 | repodir = os.path.abspath(os.path.join(args['destdir'], r_data['path'])) |
69 | repodirs.append(repodir) | ||
57 | 70 | ||
58 | if 'contains_this_file' in r_data.keys(): | 71 | if 'contains_this_file' in r_data.keys(): |
59 | force_arg = 'force_bootstraplayer_checkout' | 72 | force_arg = 'force_bootstraplayer_checkout' |
@@ -96,6 +109,8 @@ def _do_checkout(args, json): | |||
96 | if _contains_submodules(repodir): | 109 | if _contains_submodules(repodir): |
97 | print("Repo {} contains submodules, use 'git submodule update' to ensure they are up to date".format(repodir)) | 110 | print("Repo {} contains submodules, use 'git submodule update' to ensure they are up to date".format(repodir)) |
98 | 111 | ||
112 | _write_layer_list(args['destdir'], repodirs) | ||
113 | |||
99 | parser = argparse.ArgumentParser(description="A self contained python script that fetches all the needed layers and sets them to correct revisions using data in a json format from a separate file. The json data can be created from an active build directory with 'bitbake-layers create-layers-setup destdir' and there's a sample file and a schema in meta/files/") | 114 | parser = argparse.ArgumentParser(description="A self contained python script that fetches all the needed layers and sets them to correct revisions using data in a json format from a separate file. The json data can be created from an active build directory with 'bitbake-layers create-layers-setup destdir' and there's a sample file and a schema in meta/files/") |
100 | 115 | ||
101 | parser.add_argument('--force-bootstraplayer-checkout', action='store_true', | 116 | parser.add_argument('--force-bootstraplayer-checkout', action='store_true', |