xtensa-build-zephyr: fix DEFAULT_TOOLCHAIN_VARIANT spill on next platf #7254
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
xtensa-build-zephyr.py has always defined XTENSA_ and other environment variables in the current environment shared by all platforms. This was always bad but apparently never a problem until the addition of the new DEFAULT_TOOLCHAIN_VARIANT (xcc or clang) variable.
Before DEFAULT_TOOLCHAIN_VARIANT, each platform's environment would simply override the previous one. However with the new DEFAULT_TOOLCHAIN_VARIANT, the current environment has precedence for more flexibility. This makes each platform "spill" onto the next one and
xtensa-build-zephyr.py -p tgl mtlfail like this:To fix this, stop modifying the current os.environ and use a new, fresh os.environ.copy() for each platform instead.
Fixes commit 309fa26 ("xtensa-build-zephyr.py: upgraded Xtensa toolchain for MTL")
History repeats itself: commit 6bedd8e ("xtensa-build-zephyr: fix RIMAGE_KEY when building multiple platforms") fixed the same logical error months ago in a different script.