diff mbox series

[1/2] meta/classes-recipe/toolchain-scripts.bbclass: eliminate bash-ism

Message ID 20251007182143.1235445-1-alex.kanavin@gmail.com
State Accepted, archived
Commit 933686b7c6307778d171967c49b3a7b6645c31c0
Headers show
Series [1/2] meta/classes-recipe/toolchain-scripts.bbclass: eliminate bash-ism | expand

Commit Message

Alexander Kanavin Oct. 7, 2025, 6:21 p.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

Sourcing a script with arguments is a non-standard bash extension
and doesn't work with other shells (e.g. dash, which is used on
Debian and derivatives). This used to work by coincidence when
running against integrated poky repo without having to separately
specify where bitbake is, but no longer does.

Using set is a POSIX standard.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/classes-recipe/toolchain-scripts.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/toolchain-scripts.bbclass b/meta/classes-recipe/toolchain-scripts.bbclass
index ec040b5ebbe..8c062ef0e74 100644
--- a/meta/classes-recipe/toolchain-scripts.bbclass
+++ b/meta/classes-recipe/toolchain-scripts.bbclass
@@ -92,7 +92,7 @@  toolchain_create_tree_env_script () {
 	touch $script
 	echo 'standalone_sysroot_target="${STAGING_DIR}/${MACHINE}"' >> $script
 	echo 'standalone_sysroot_native="${STAGING_DIR}/${BUILD_ARCH}"' >> $script
-	echo "orig=`pwd`; cd ${COREBASE}; . ./oe-init-build-env ${TOPDIR} $bitbakedir; cd \$orig" >> $script
+	echo "orig=`pwd`; cd ${COREBASE}; set ${TOPDIR} $bitbakedir; . ./oe-init-build-env; cd \$orig" >> $script
 	echo 'export PATH=$standalone_sysroot_native/${bindir_native}:$standalone_sysroot_native/${bindir_native}/${TARGET_SYS}:$PATH' >> $script
 	echo 'export PKG_CONFIG_SYSROOT_DIR=$standalone_sysroot_target' >> $script
 	echo 'export PKG_CONFIG_PATH=$standalone_sysroot_target'"$libdir"'/pkgconfig:$standalone_sysroot_target'"$prefix"'/share/pkgconfig' >> $script