summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbitbake/bin/bitbake-setup28
-rw-r--r--bitbake/lib/bb/tests/setup.py20
2 files changed, 26 insertions, 22 deletions
diff --git a/bitbake/bin/bitbake-setup b/bitbake/bin/bitbake-setup
index 47de4654e3..29fdf11892 100755
--- a/bitbake/bin/bitbake-setup
+++ b/bitbake/bin/bitbake-setup
@@ -129,21 +129,24 @@ def checkout_layers(layers, layerdir, d):
129 return layers_fixed_revisions 129 return layers_fixed_revisions
130 130
131def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir): 131def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir):
132 def _setup_build_conf(layers, build_conf_dir): 132 def _setup_build_conf(layers, relative_layers, build_conf_dir):
133 os.makedirs(build_conf_dir) 133 os.makedirs(build_conf_dir)
134 layers_s = [] 134 layers_s = []
135
135 for l in layers: 136 for l in layers:
136 if l.startswith("{THISDIR}/"): 137 l = os.path.join(layerdir, l)
137 if thisdir: 138 layers_s.append(" {} \\".format(l))
138 l = l.format(THISDIR=thisdir) 139
139 else: 140 for l in relative_layers:
140 raise Exception("Configuration is using {THISDIR} to specify " \ 141 if thisdir:
141 "a layer path relative to itself. This can be done only " \ 142 l = os.path.join(thisdir, l)
142 "when the configuration is specified by its path on local " \ 143 else:
143 "disk, not when it's in a registry or is fetched over http.") 144 raise Exception("Configuration is using bb-layers-relative to specify " \
144 if not os.path.isabs(l): 145 "a layer path relative to itself. This can be done only " \
145 l = os.path.join(layerdir, l) 146 "when the configuration is specified by its path on local " \
147 "disk, not when it's in a registry or is fetched over http.")
146 layers_s.append(" {} \\".format(l)) 148 layers_s.append(" {} \\".format(l))
149
147 layers_s = "\n".join(layers_s) 150 layers_s = "\n".join(layers_s)
148 bblayers_conf = """BBLAYERS ?= " \\ 151 bblayers_conf = """BBLAYERS ?= " \\
149{} 152{}
@@ -220,7 +223,8 @@ def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir):
220 os.rename(bitbake_confdir, backup_bitbake_confdir) 223 os.rename(bitbake_confdir, backup_bitbake_confdir)
221 224
222 if layers: 225 if layers:
223 _setup_build_conf(layers, bitbake_confdir) 226 relative_layers = bitbake_config.get("bb-layers-relative") or []
227 _setup_build_conf(layers, relative_layers, bitbake_confdir)
224 228
225 if template: 229 if template:
226 bb.process.run("{} setup -c {} -b {} --no-shell".format(oesetupbuild, template, bitbake_builddir)) 230 bb.process.run("{} setup -c {} -b {} --no-shell".format(oesetupbuild, template, bitbake_builddir))
diff --git a/bitbake/lib/bb/tests/setup.py b/bitbake/lib/bb/tests/setup.py
index 767a6298da..ba2a90009d 100644
--- a/bitbake/lib/bb/tests/setup.py
+++ b/bitbake/lib/bb/tests/setup.py
@@ -148,9 +148,10 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
148 "oe-fragments": ["test-fragment-2"] 148 "oe-fragments": ["test-fragment-2"]
149 }, 149 },
150 { 150 {
151 "name": "gizmo-notemplate-with-thisdir", 151 "name": "gizmo-notemplate-with-relative-layers",
152 "description": "Gizmo notemplate configuration using THISDIR", 152 "description": "Gizmo notemplate configuration using relative layers",
153 "bb-layers": ["layerC","layerD/meta-layer","{THISDIR}/layerE/meta-layer"], 153 "bb-layers": ["layerC","layerD/meta-layer"],
154 "bb-layers-relative": ["layerE/meta-layer"],
154 "oe-fragments": ["test-fragment-2"] 155 "oe-fragments": ["test-fragment-2"]
155 } 156 }
156 ] 157 ]
@@ -204,14 +205,13 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
204 with open(os.path.join(bb_conf_path, 'bblayers.conf')) as f: 205 with open(os.path.join(bb_conf_path, 'bblayers.conf')) as f:
205 bblayers = f.read() 206 bblayers = f.read()
206 for l in bitbake_config["bb-layers"]: 207 for l in bitbake_config["bb-layers"]:
207 if l.startswith('{THISDIR}/'): 208 self.assertIn(os.path.join(setuppath, "layers", l), bblayers)
208 thisdir_layer = os.path.join( 209 for l in bitbake_config.get("bb-layers-relative") or []:
210 relative_layer = os.path.join(
209 os.path.dirname(config_upstream["path"]), 211 os.path.dirname(config_upstream["path"]),
210 l.removeprefix("{THISDIR}/"), 212 l,
211 ) 213 )
212 self.assertIn(thisdir_layer, bblayers) 214 self.assertIn(relative_layer, bblayers)
213 else:
214 self.assertIn(os.path.join(setuppath, "layers", l), bblayers)
215 215
216 if 'oe-fragment' in bitbake_config.keys(): 216 if 'oe-fragment' in bitbake_config.keys():
217 for f in bitbake_config["oe-fragments"]: 217 for f in bitbake_config["oe-fragments"]:
@@ -298,7 +298,7 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
298 'gizmo-env-passthrough', 298 'gizmo-env-passthrough',
299 'gizmo-no-fragment', 299 'gizmo-no-fragment',
300 'gadget-notemplate','gizmo-notemplate', 300 'gadget-notemplate','gizmo-notemplate',
301 'gizmo-notemplate-with-thisdir')} 301 'gizmo-notemplate-with-relative-layers')}
302 } 302 }
303 for cf, v in test_configurations.items(): 303 for cf, v in test_configurations.items():
304 for c in v['buildconfigs']: 304 for c in v['buildconfigs']: