diff options
| author | Yoann Congal <yoann.congal@smile.fr> | 2025-10-02 12:09:24 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-04 21:33:32 +0100 |
| commit | a26b6368b967dca918346d97f5d0109b500d78c3 (patch) | |
| tree | 7d115bfea7d56a7c8e8e025aed073acb1ab52a93 | |
| parent | 9ccf1a50a41014e803081a24011ef8bec8001f61 (diff) | |
| download | poky-a26b6368b967dca918346d97f5d0109b500d78c3.tar.gz | |
bitbake: bitbake-setup: dash support for init-build-env script
Being minimalist, dash does not support the (non-POSIX) feature of
passing an argument while sourcing a script. Like in
. <some path>/oe-init-build-env <build dir>
With dash, one must use:
set <build dir> # puts <build dir> in $1
cd <some path>
. ./oe-init-build-env # can only be called from its directory in dash
To do this:
* Instead of a symlink to oe-init-build-env, keep a symlink to the
directory containing it (called "oe-init-build-env-dir")
* Generate a init-build-env script that dash can source using the above
snippet.
(Bitbake rev: d77386e6ab155081ff3bef2aab413ff8061e83a5)
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rwxr-xr-x | bitbake/bin/bitbake-setup | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/bitbake/bin/bitbake-setup b/bitbake/bin/bitbake-setup index 51d9503c4a..36a1bbd91a 100755 --- a/bitbake/bin/bitbake-setup +++ b/bitbake/bin/bitbake-setup | |||
| @@ -101,13 +101,13 @@ def checkout_layers(layers, layerdir, d): | |||
| 101 | 101 | ||
| 102 | if os.path.exists(os.path.join(layerdir, repodir, 'scripts/oe-setup-build')): | 102 | if os.path.exists(os.path.join(layerdir, repodir, 'scripts/oe-setup-build')): |
| 103 | oesetupbuild = os.path.join(layerdir, repodir, 'scripts/oe-setup-build') | 103 | oesetupbuild = os.path.join(layerdir, repodir, 'scripts/oe-setup-build') |
| 104 | oeinitbuildenv = os.path.join(layerdir, repodir, 'oe-init-build-env') | 104 | oeinitbuildenvdir = os.path.join(layerdir, repodir) |
| 105 | 105 | ||
| 106 | print(" ") | 106 | print(" ") |
| 107 | _write_layer_list(layerdir, repodirs) | 107 | _write_layer_list(layerdir, repodirs) |
| 108 | 108 | ||
| 109 | if oesetupbuild: | 109 | if oesetupbuild: |
| 110 | links = {'setup-build': oesetupbuild, 'oe-scripts': os.path.dirname(oesetupbuild), 'init-build-env': oeinitbuildenv} | 110 | links = {'setup-build': oesetupbuild, 'oe-scripts': os.path.dirname(oesetupbuild), 'oe-init-build-env-dir': oeinitbuildenvdir} |
| 111 | for l,t in links.items(): | 111 | for l,t in links.items(): |
| 112 | symlink = os.path.join(layerdir, l) | 112 | symlink = os.path.join(layerdir, l) |
| 113 | if os.path.lexists(symlink): | 113 | if os.path.lexists(symlink): |
| @@ -145,8 +145,9 @@ def setup_bitbake_build(bitbake_config, layerdir, builddir): | |||
| 145 | with open(os.path.join(build_conf_dir, "conf-notes.txt"), 'w') as f: | 145 | with open(os.path.join(build_conf_dir, "conf-notes.txt"), 'w') as f: |
| 146 | f.write("") | 146 | f.write("") |
| 147 | 147 | ||
| 148 | def _make_init_build_env(builddir, initbuildenv): | 148 | def _make_init_build_env(builddir, oeinitbuildenvdir): |
| 149 | cmd = ". {} {}".format(initbuildenv, builddir) | 149 | builddir = os.path.realpath(builddir) |
| 150 | cmd = "cd {}\nset {}\n. ./oe-init-build-env\n".format(oeinitbuildenvdir, builddir) | ||
| 150 | initbuild_in_builddir = os.path.join(builddir, 'init-build-env') | 151 | initbuild_in_builddir = os.path.join(builddir, 'init-build-env') |
| 151 | with open(initbuild_in_builddir, 'w') as f: | 152 | with open(initbuild_in_builddir, 'w') as f: |
| 152 | f.write(cmd) | 153 | f.write(cmd) |
| @@ -174,11 +175,11 @@ def setup_bitbake_build(bitbake_config, layerdir, builddir): | |||
| 174 | if template: | 175 | if template: |
| 175 | bb.process.run("{} setup -c {} -b {} --no-shell".format(oesetupbuild, template, bitbake_builddir)) | 176 | bb.process.run("{} setup -c {} -b {} --no-shell".format(oesetupbuild, template, bitbake_builddir)) |
| 176 | else: | 177 | else: |
| 177 | initbuildenv = os.path.join(layerdir, 'init-build-env') | 178 | oeinitbuildenvdir = os.path.join(layerdir, 'oe-init-build-env-dir') |
| 178 | if not os.path.exists(initbuildenv): | 179 | if not os.path.exists(os.path.join(oeinitbuildenvdir, "oe-init-build-env")): |
| 179 | print("Could not find oe-init-build-env in any of the layers; please use another mechanism to initialize the bitbake environment") | 180 | print("Could not find oe-init-build-env in any of the layers; please use another mechanism to initialize the bitbake environment") |
| 180 | return | 181 | return |
| 181 | _make_init_build_env(bitbake_builddir, os.path.realpath(initbuildenv)) | 182 | _make_init_build_env(bitbake_builddir, os.path.realpath(oeinitbuildenvdir)) |
| 182 | 183 | ||
| 183 | siteconf_symlink = os.path.join(bitbake_confdir, "site.conf") | 184 | siteconf_symlink = os.path.join(bitbake_confdir, "site.conf") |
| 184 | siteconf = os.path.normpath(os.path.join(builddir, '..', "site.conf")) | 185 | siteconf = os.path.normpath(os.path.join(builddir, '..', "site.conf")) |
