mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
bitbake: bitbake-setup: replace {THISDIR} token with a keyword: bb-layers-relative
{THISDIR} is a special value token that can be used in the list of enabled
layers to specify the layer location relative to the confguration file:
https://git.openembedded.org/bitbake/commit/?id=b3153be29de8b8570b0c184369bd41f4c646cf92
This replaces the token with an explicit separate keyword for such layers:
so that special processing to determine the final value can be avoided, and
the feature can be formalized in the json schema:
instead of
"bb-layers": [
"{THISDIR}/meta-my-project"
]
this allows
"bb-layers-relative": [
"meta-my-project"
Going forward I think we should strive to avoid any further special value tokens.
(Bitbake rev: 90da82bd2bfcfd5590c9ae06015737b616074b56)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
9780ec24d0
commit
516039e609
@@ -129,21 +129,24 @@ def checkout_layers(layers, layerdir, d):
|
|||||||
return layers_fixed_revisions
|
return layers_fixed_revisions
|
||||||
|
|
||||||
def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir):
|
def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir):
|
||||||
def _setup_build_conf(layers, build_conf_dir):
|
def _setup_build_conf(layers, relative_layers, build_conf_dir):
|
||||||
os.makedirs(build_conf_dir)
|
os.makedirs(build_conf_dir)
|
||||||
layers_s = []
|
layers_s = []
|
||||||
|
|
||||||
for l in layers:
|
for l in layers:
|
||||||
if l.startswith("{THISDIR}/"):
|
l = os.path.join(layerdir, l)
|
||||||
if thisdir:
|
|
||||||
l = l.format(THISDIR=thisdir)
|
|
||||||
else:
|
|
||||||
raise Exception("Configuration is using {THISDIR} to specify " \
|
|
||||||
"a layer path relative to itself. This can be done only " \
|
|
||||||
"when the configuration is specified by its path on local " \
|
|
||||||
"disk, not when it's in a registry or is fetched over http.")
|
|
||||||
if not os.path.isabs(l):
|
|
||||||
l = os.path.join(layerdir, l)
|
|
||||||
layers_s.append(" {} \\".format(l))
|
layers_s.append(" {} \\".format(l))
|
||||||
|
|
||||||
|
for l in relative_layers:
|
||||||
|
if thisdir:
|
||||||
|
l = os.path.join(thisdir, l)
|
||||||
|
else:
|
||||||
|
raise Exception("Configuration is using bb-layers-relative to specify " \
|
||||||
|
"a layer path relative to itself. This can be done only " \
|
||||||
|
"when the configuration is specified by its path on local " \
|
||||||
|
"disk, not when it's in a registry or is fetched over http.")
|
||||||
|
layers_s.append(" {} \\".format(l))
|
||||||
|
|
||||||
layers_s = "\n".join(layers_s)
|
layers_s = "\n".join(layers_s)
|
||||||
bblayers_conf = """BBLAYERS ?= " \\
|
bblayers_conf = """BBLAYERS ?= " \\
|
||||||
{}
|
{}
|
||||||
@@ -220,7 +223,8 @@ def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir):
|
|||||||
os.rename(bitbake_confdir, backup_bitbake_confdir)
|
os.rename(bitbake_confdir, backup_bitbake_confdir)
|
||||||
|
|
||||||
if layers:
|
if layers:
|
||||||
_setup_build_conf(layers, bitbake_confdir)
|
relative_layers = bitbake_config.get("bb-layers-relative") or []
|
||||||
|
_setup_build_conf(layers, relative_layers, bitbake_confdir)
|
||||||
|
|
||||||
if template:
|
if template:
|
||||||
bb.process.run("{} setup -c {} -b {} --no-shell".format(oesetupbuild, template, bitbake_builddir))
|
bb.process.run("{} setup -c {} -b {} --no-shell".format(oesetupbuild, template, bitbake_builddir))
|
||||||
|
|||||||
@@ -148,9 +148,10 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
|
|||||||
"oe-fragments": ["test-fragment-2"]
|
"oe-fragments": ["test-fragment-2"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gizmo-notemplate-with-thisdir",
|
"name": "gizmo-notemplate-with-relative-layers",
|
||||||
"description": "Gizmo notemplate configuration using THISDIR",
|
"description": "Gizmo notemplate configuration using relative layers",
|
||||||
"bb-layers": ["layerC","layerD/meta-layer","{THISDIR}/layerE/meta-layer"],
|
"bb-layers": ["layerC","layerD/meta-layer"],
|
||||||
|
"bb-layers-relative": ["layerE/meta-layer"],
|
||||||
"oe-fragments": ["test-fragment-2"]
|
"oe-fragments": ["test-fragment-2"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -204,14 +205,13 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
|
|||||||
with open(os.path.join(bb_conf_path, 'bblayers.conf')) as f:
|
with open(os.path.join(bb_conf_path, 'bblayers.conf')) as f:
|
||||||
bblayers = f.read()
|
bblayers = f.read()
|
||||||
for l in bitbake_config["bb-layers"]:
|
for l in bitbake_config["bb-layers"]:
|
||||||
if l.startswith('{THISDIR}/'):
|
self.assertIn(os.path.join(setuppath, "layers", l), bblayers)
|
||||||
thisdir_layer = os.path.join(
|
for l in bitbake_config.get("bb-layers-relative") or []:
|
||||||
|
relative_layer = os.path.join(
|
||||||
os.path.dirname(config_upstream["path"]),
|
os.path.dirname(config_upstream["path"]),
|
||||||
l.removeprefix("{THISDIR}/"),
|
l,
|
||||||
)
|
)
|
||||||
self.assertIn(thisdir_layer, bblayers)
|
self.assertIn(relative_layer, bblayers)
|
||||||
else:
|
|
||||||
self.assertIn(os.path.join(setuppath, "layers", l), bblayers)
|
|
||||||
|
|
||||||
if 'oe-fragment' in bitbake_config.keys():
|
if 'oe-fragment' in bitbake_config.keys():
|
||||||
for f in bitbake_config["oe-fragments"]:
|
for f in bitbake_config["oe-fragments"]:
|
||||||
@@ -298,7 +298,7 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
|
|||||||
'gizmo-env-passthrough',
|
'gizmo-env-passthrough',
|
||||||
'gizmo-no-fragment',
|
'gizmo-no-fragment',
|
||||||
'gadget-notemplate','gizmo-notemplate',
|
'gadget-notemplate','gizmo-notemplate',
|
||||||
'gizmo-notemplate-with-thisdir')}
|
'gizmo-notemplate-with-relative-layers')}
|
||||||
}
|
}
|
||||||
for cf, v in test_configurations.items():
|
for cf, v in test_configurations.items():
|
||||||
for c in v['buildconfigs']:
|
for c in v['buildconfigs']:
|
||||||
|
|||||||
Reference in New Issue
Block a user