diff mbox series

oe-setup-build: fix dash support

Message ID 20250926145305.528133-1-yoann.congal@smile.fr
State New
Headers show
Series oe-setup-build: fix dash support | expand

Commit Message

Yoann Congal Sept. 26, 2025, 2:53 p.m. UTC
From: Yoann Congal <yoann.congal@smile.fr>

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 instead use:
  cd <some path>
  set <build dir>       # puts <build dir> in $1
  . ./oe-init-build-env # can only be called from its directory in dash

oe-setup-build generate a sourcable "init-build-env" script, this script
must use the above snippet to be used in dash.

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 scripts/oe-setup-build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Kanavin Sept. 26, 2025, 3:20 p.m. UTC | #1
Thanks, lgtm.

Alex

On Fri, 26 Sept 2025 at 16:53, Yoann Congal via lists.openembedded.org
<yoann.congal=smile.fr@lists.openembedded.org> wrote:
>
> From: Yoann Congal <yoann.congal@smile.fr>
>
> 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 instead use:
>   cd <some path>
>   set <build dir>       # puts <build dir> in $1
>   . ./oe-init-build-env # can only be called from its directory in dash
>
> oe-setup-build generate a sourcable "init-build-env" script, this script
> must use the above snippet to be used in dash.
>
> Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> ---
>  scripts/oe-setup-build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/oe-setup-build b/scripts/oe-setup-build
> index 49603d9fd1..edbcd48355 100755
> --- a/scripts/oe-setup-build
> +++ b/scripts/oe-setup-build
> @@ -89,7 +89,7 @@ def setup_build_env(args):
>      builddir = args.b if args.b else template["buildpath"]
>      no_shell = args.no_shell
>      coredir = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
> -    cmd_base = ". {} {}".format(os.path.join(coredir, 'oe-init-build-env'), os.path.abspath(builddir))
> +    cmd_base = "cd {}\nset {}\n. ./oe-init-build-env\n".format(coredir, os.path.abspath(builddir))
>
>      initbuild = os.path.join(builddir, 'init-build-env')
>      if not os.path.exists(initbuild):
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#224083): https://lists.openembedded.org/g/openembedded-core/message/224083
> Mute This Topic: https://lists.openembedded.org/mt/115450065/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/scripts/oe-setup-build b/scripts/oe-setup-build
index 49603d9fd1..edbcd48355 100755
--- a/scripts/oe-setup-build
+++ b/scripts/oe-setup-build
@@ -89,7 +89,7 @@  def setup_build_env(args):
     builddir = args.b if args.b else template["buildpath"]
     no_shell = args.no_shell
     coredir = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
-    cmd_base = ". {} {}".format(os.path.join(coredir, 'oe-init-build-env'), os.path.abspath(builddir))
+    cmd_base = "cd {}\nset {}\n. ./oe-init-build-env\n".format(coredir, os.path.abspath(builddir))
 
     initbuild = os.path.join(builddir, 'init-build-env')
     if not os.path.exists(initbuild):