summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests/setup.py
diff options
context:
space:
mode:
authorYoann Congal <yoann.congal@smile.fr>2025-10-02 12:09:27 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-10-06 17:01:09 +0100
commit4fe429f00f27577d522693861ddd0f41e84a72b7 (patch)
tree4818e0ed9cad236dd377037c1dd9a9ff35acc115 /bitbake/lib/bb/tests/setup.py
parent6bafe1e151279725692fc7df4d0bcdfc43223490 (diff)
downloadpoky-4fe429f00f27577d522693861ddd0f41e84a72b7.tar.gz
bitbake: bitbake-setup: allow using {THISDIR}/my-layer
This implement the ability to use "{THISDIR}/my-layer" in the "bb-layers" list. "{THISDIR}" is remplaced by the directory containing the configuration file. In small projects, we try to keep the setup a simple as possible: a single git repo containing both the build confguration (e.g. a bitbake-setup configuration file) and the meta layer with project recipes/machine/distro. This change allows this kind of setup: ├── meta-my-project/ # the project layer └── my-project.conf.json # the bb-setup configuration file by writing, in my-project.conf.json: "bitbake-setup": { "configurations": [{ "bb-layers": [ "{THISDIR}/meta-my-project" Note: in this case meta-my-project is not present as a "source", so, not handled by bb-setup update/status. It is expected of the user to handle this on their own (is our case, a simple git workflow). (Bitbake rev: 61fbdeb358979bb13c9e50d807f43e554497dc9c) Signed-off-by: Yoann Congal <yoann.congal@smile.fr> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests/setup.py')
-rw-r--r--bitbake/lib/bb/tests/setup.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/bitbake/lib/bb/tests/setup.py b/bitbake/lib/bb/tests/setup.py
index 2076613d9b..747a9b733f 100644
--- a/bitbake/lib/bb/tests/setup.py
+++ b/bitbake/lib/bb/tests/setup.py
@@ -130,6 +130,12 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
130 "description": "Gizmo notemplate build configuration", 130 "description": "Gizmo notemplate build configuration",
131 "bb-layers": ["layerC","layerD/meta-layer"], 131 "bb-layers": ["layerC","layerD/meta-layer"],
132 "oe-fragments": ["test-fragment-2"] 132 "oe-fragments": ["test-fragment-2"]
133 },
134 {
135 "name": "gizmo-notemplate-with-thisdir",
136 "description": "Gizmo notemplate build configuration using THISDIR",
137 "bb-layers": ["layerC","layerD/meta-layer","{THISDIR}/layerE/meta-layer"],
138 "oe-fragments": ["test-fragment-2"]
133 } 139 }
134 ] 140 ]
135 }, 141 },
@@ -174,7 +180,14 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
174 with open(os.path.join(bb_conf_path, 'bblayers.conf')) as f: 180 with open(os.path.join(bb_conf_path, 'bblayers.conf')) as f:
175 bblayers = f.read() 181 bblayers = f.read()
176 for l in bitbake_config["bb-layers"]: 182 for l in bitbake_config["bb-layers"]:
177 self.assertIn(os.path.join(buildpath, 'layers', l), bblayers) 183 if l.startswith('{THISDIR}/'):
184 thisdir_layer = os.path.join(
185 os.path.dirname(json_config["path"]),
186 l.removeprefix("{THISDIR}/"),
187 )
188 self.assertIn(thisdir_layer, bblayers)
189 else:
190 self.assertIn(os.path.join(buildpath, "layers", l), bblayers)
178 191
179 for f in bitbake_config["oe-fragments"]: 192 for f in bitbake_config["oe-fragments"]:
180 self.assertTrue(os.path.exists(os.path.join(bb_conf_path, f))) 193 self.assertTrue(os.path.exists(os.path.join(bb_conf_path, f)))
@@ -235,7 +248,7 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
235 248
236 # test-config-1 is tested as a registry config, test-config-2 as a local file 249 # test-config-1 is tested as a registry config, test-config-2 as a local file
237 test_configurations = {'test-config-1': {'cmdline': 'test-config-1', 'buildconfigs':('gadget','gizmo','gadget-notemplate','gizmo-notemplate')}, 250 test_configurations = {'test-config-1': {'cmdline': 'test-config-1', 'buildconfigs':('gadget','gizmo','gadget-notemplate','gizmo-notemplate')},
238 'test-config-2': {'cmdline': os.path.join(self.registrypath,'config-2/test-config-2.conf.json'), 'buildconfigs': ('gadget','gizmo','gadget-notemplate','gizmo-notemplate') } } 251 'test-config-2': {'cmdline': os.path.join(self.registrypath,'config-2/test-config-2.conf.json'), 'buildconfigs': ('gadget','gizmo','gadget-notemplate','gizmo-notemplate', 'gizmo-notemplate-with-thisdir') } }
239 for cf, v in test_configurations.items(): 252 for cf, v in test_configurations.items():
240 for c in v['buildconfigs']: 253 for c in v['buildconfigs']:
241 out = self.runbbsetup("init --non-interactive {} {}".format(v['cmdline'], c)) 254 out = self.runbbsetup("init --non-interactive {} {}".format(v['cmdline'], c))