summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/selftest/cases/bblayers.py6
-rwxr-xr-xscripts/oe-setup-layers15
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):
testcheckoutdir = os.path.join(self.builddir, 'test-layer-checkout')
result = runCmd('{}/setup-layers --destdir {}'.format(self.testlayer_path, testcheckoutdir))
- # May not necessarily be named 'poky' or 'openembedded-core'
- oecoredir = os.listdir(testcheckoutdir)[0]
- testcheckoutfile = os.path.join(testcheckoutdir, oecoredir, "oe-init-build-env")
- self.assertTrue(os.path.exists(testcheckoutfile), "File {} not found in test layer checkout".format(testcheckoutfile))
+ layers_json = os.path.join(testcheckoutdir, ".oe-layers.json")
+ self.assertTrue(os.path.exists(layers_json), "File {} not found in test layer checkout".format(layers_json))
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):
def _contains_submodules(repodir):
return os.path.exists(os.path.join(repodir,".gitmodules"))
+def _write_layer_list(dest, repodirs):
+ layers = []
+ for r in repodirs:
+ for root, dirs, files in os.walk(r):
+ if os.path.basename(root) == 'conf' and 'layer.conf' in files:
+ layers.append(os.path.relpath(os.path.dirname(root), dest))
+ layers_f = os.path.join(dest, ".oe-layers.json")
+ print("Writing list of layers into {}".format(layers_f))
+ with open(layers_f, 'w') as f:
+ json.dump({"version":"1.0","layers":layers}, f, sort_keys=True, indent=4)
+
def _do_checkout(args, json):
repos = json['sources']
+ repodirs = []
for r_name in repos:
r_data = repos[r_name]
repodir = os.path.abspath(os.path.join(args['destdir'], r_data['path']))
+ repodirs.append(repodir)
if 'contains_this_file' in r_data.keys():
force_arg = 'force_bootstraplayer_checkout'
@@ -96,6 +109,8 @@ def _do_checkout(args, json):
if _contains_submodules(repodir):
print("Repo {} contains submodules, use 'git submodule update' to ensure they are up to date".format(repodir))
+ _write_layer_list(args['destdir'], repodirs)
+
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/")
parser.add_argument('--force-bootstraplayer-checkout', action='store_true',