diff options
| author | Alexander Kanavin <alex.kanavin@gmail.com> | 2024-03-05 08:37:49 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-04-12 18:04:02 +0100 |
| commit | ced1868d2edce09c57602a4601012d8bcceddf38 (patch) | |
| tree | aa6ce2ea9ab0f4bc5cca0e567b6a35f93e988004 | |
| parent | 7544ef4c4955782692189371803da07549f63d15 (diff) | |
| download | poky-ced1868d2edce09c57602a4601012d8bcceddf38.tar.gz | |
scripts/oe-setup-build: write a build environment initialization one-liner into the build directory
With this, users no longer have to know where oe-init-build-env is relative to the
build directory; that information is contained in the one liner and then
it's possible to simply use that:
. /path/to/build/init-build-env
This will particularly help with initializing builds in unpacked
build bundles, as users won't have to know where oe-init-build-env
is in the bundle directory tree - similar to esdk initialization.
(From OE-Core rev: 3cea5365b2a813a10b28ab6e647df192d28eb4e5)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rwxr-xr-x | scripts/oe-setup-build | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/oe-setup-build b/scripts/oe-setup-build index 5364f2b481..c0476992a2 100755 --- a/scripts/oe-setup-build +++ b/scripts/oe-setup-build | |||
| @@ -91,7 +91,16 @@ def setup_build_env(args): | |||
| 91 | builddir = args.b if args.b else template["buildpath"] | 91 | builddir = args.b if args.b else template["buildpath"] |
| 92 | no_shell = args.no_shell | 92 | no_shell = args.no_shell |
| 93 | coredir = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')) | 93 | coredir = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')) |
| 94 | cmd = "TEMPLATECONF={} . {} {}".format(template["templatepath"], os.path.join(coredir, 'oe-init-build-env'), builddir) | 94 | cmd_base = ". {} {}".format(os.path.join(coredir, 'oe-init-build-env'), os.path.abspath(builddir)) |
| 95 | |||
| 96 | initbuild = os.path.join(builddir, 'init-build-env') | ||
| 97 | if not os.path.exists(initbuild): | ||
| 98 | os.makedirs(builddir, exist_ok=True) | ||
| 99 | with open(initbuild, 'w') as f: | ||
| 100 | f.write(cmd_base) | ||
| 101 | print("\nRun '. {}' to initialize the build in a current shell session.\n".format(initbuild)) | ||
| 102 | |||
| 103 | cmd = "TEMPLATECONF={} {}".format(template["templatepath"], cmd_base) | ||
| 95 | if not no_shell: | 104 | if not no_shell: |
| 96 | cmd = cmd + " && {}".format(os.environ['SHELL']) | 105 | cmd = cmd + " && {}".format(os.environ['SHELL']) |
| 97 | print("Running:", cmd) | 106 | print("Running:", cmd) |
