summaryrefslogtreecommitdiffstats
path: root/bitbake/bin
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-04 15:16:03 +0100
commit6c422e911f41ec865ba235100443aa15566f76af (patch)
tree43a477f650451bd778bbc1283b043a8604abc6db /bitbake/bin
parentf7e90d293ce3c5c6f7f859ec3299fdb86d1abb4f (diff)
downloadpoky-6c422e911f41ec865ba235100443aa15566f76af.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/bin')
-rwxr-xr-xbitbake/bin/bitbake-setup20
1 files changed, 17 insertions, 3 deletions
diff --git a/bitbake/bin/bitbake-setup b/bitbake/bin/bitbake-setup
index 36a1bbd91a..de83d780bf 100755
--- a/bitbake/bin/bitbake-setup
+++ b/bitbake/bin/bitbake-setup
@@ -114,10 +114,23 @@ def checkout_layers(layers, layerdir, d):
114 os.remove(symlink) 114 os.remove(symlink)
115 os.symlink(os.path.relpath(t,layerdir),symlink) 115 os.symlink(os.path.relpath(t,layerdir),symlink)
116 116
117def setup_bitbake_build(bitbake_config, layerdir, builddir): 117def setup_bitbake_build(bitbake_config, layerdir, builddir, thisdir):
118 def _setup_build_conf(layers, build_conf_dir): 118 def _setup_build_conf(layers, build_conf_dir):
119 os.makedirs(build_conf_dir) 119 os.makedirs(build_conf_dir)
120 layers_s = "\n".join([" {} \\".format(os.path.join(layerdir,l)) for l in layers]) 120 layers_s = []
121 for l in layers:
122 if l.startswith("{THISDIR}/"):
123 if thisdir:
124 l = l.format(THISDIR=thisdir)
125 else:
126 raise Exception("Configuration is using {THISDIR} to specify " \
127 "a layer path relative to itself. This can be done only " \
128 "when the configuration is specified by its path on local " \
129 "disk, not when it's in a registry or is fetched over http.")
130 if not os.path.isabs(l):
131 l = os.path.join(layerdir, l)
132 layers_s.append(" {} \\".format(l))
133 layers_s = "\n".join(layers_s)
121 bblayers_conf = """BBLAYERS ?= " \\ 134 bblayers_conf = """BBLAYERS ?= " \\
122{} 135{}
123 " 136 "
@@ -237,7 +250,8 @@ def update_build(config, confdir, builddir, layerdir, d):
237 layer_config[k]["git-remote"] = v["git-remote"] 250 layer_config[k]["git-remote"] = v["git-remote"]
238 checkout_layers(layer_config, layerdir, d) 251 checkout_layers(layer_config, layerdir, d)
239 bitbake_config = config["bitbake-config"] 252 bitbake_config = config["bitbake-config"]
240 setup_bitbake_build(bitbake_config, layerdir, builddir) 253 thisdir = os.path.dirname(config["path"]) if config["type"] == 'local' else None
254 setup_bitbake_build(bitbake_config, layerdir, builddir, thisdir)
241 255
242def int_input(allowed_values): 256def int_input(allowed_values):
243 n = None 257 n = None