The "set" command in Windows has some unfortunate behaviors that can
frequently make it look like the toolchain script had an error. This
makes automated testing of the SDK more difficult, so add a line to the
environment setup script that ensures the script exits with success.

[YOCTO #13020]

Signed-off-by: Joshua Watt <jpewhac...@gmail.com>
---
 classes/toolchain-scripts-mingw32.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/classes/toolchain-scripts-mingw32.bbclass 
b/classes/toolchain-scripts-mingw32.bbclass
index a64f5f5..32493d7 100644
--- a/classes/toolchain-scripts-mingw32.bbclass
+++ b/classes/toolchain-scripts-mingw32.bbclass
@@ -81,6 +81,17 @@ toolchain_shared_env_script_sdkmingw32 () {
    FOR %%x IN (%OECORE_NATIVE_SYSROOT%\\environment-setup.d\\*.bat) DO call 
"%%x"
 )
 EOF
+
+       # set has some annoying properties:
+       # 1) If it is successful %ERRORLEVEL% is unchanged (as opposed to being 
set
+       #        to 0 to indicate success)
+       # 2) Making an assignment like "set A=" is considered an error and sets
+       #        %ERRORLEVEL% to 1.
+       #
+       # Practically, this means that if any of the set calls make an empty
+       # assignment that error will be propagated. To prevent this, a command 
is
+       # run to ensure that the "exit code" of this script is 0
+       echo "@%COMSPEC% /C exit 0 > NUL" >> $script
 }
 
 toolchain_create_sdk_siteconfig_append_sdkmingw32 () {
-- 
2.19.1

-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to