zephyr/scripts
Martí Bolívar f752c5eeec west build: fix --pristine on early build system failure
The west build command has historically tried not to rm -rf
directories that don't look like zephyr build directories. The way it
does this is by checking for the presence of a CMake cache
with a Zephyr-specific variable (ZEPHYR_TOOLCHAIN_VARIANT) in it.

The problem with this approach is that if the build system fails
before this cache variable is set, the directory doesn't look like a
zephyr build directory, and therefore west build won't make it
pristine even with --pristine=always, even though build directories
resulting from failed runs like that are almost certainly
irrecoverably broken and need to be made pristine before anything will
work.

This leads to users having to rm -rf their directories manually, which
is not so nice.

To avoid this from happening, just check for ZEPHYR_BASE, which is
set early on in ZephyrConfig.cmake in 'modern' zephyr build systems.
Keep the ZEPHYR_TOOLCHAIN_VARIANT check in place for compatibility.

We could consider being less selective and just using shutil.rmtree()
whenever we have --pristine=always, but that would be a bigger
behavioral change than I'm comfortable doing without a good reason.

Fixes: #28876
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-14 07:22:32 -05:00
..
checkpatch
ci
coccinelle
coredump
dts dts: remove legacy macro support 2020-10-09 08:45:38 -05:00
footprint
gitlint
kconfig dts: remove legacy macro support 2020-10-09 08:45:38 -05:00
net
release
sanity_chk sanitycheck: Fix results for --cmake-only 2020-10-13 13:13:21 +02:00
support
tests
tracing
west_commands west build: fix --pristine on early build system failure 2020-10-14 07:22:32 -05:00
.gitignore
checkpatch.pl
checkstack.pl
coccicheck
dir_is_writeable.py
file2hex.py
filter-known-issues.py
gen_app_partitions.py
gen_cfb_font_header.py
gen_gcov_files.py
gen_kobject_list.py
gen_offset_header.py
gen_relocate_app.py
gen_syscalls.py
get_maintainer.py
mergehex.py
parse_syscalls.py
process_gperf.py
requirements-base.txt
requirements-build-test.txt
requirements-compliance.txt
requirements-doc.txt
requirements-extras.txt
requirements-run-test.txt
requirements.txt
sanitycheck
series-push-hook.sh
spelling.txt
subfolder_list.py
tags.sh
user_wordsize.py
valgrind.supp
west-commands.yml
zephyr_module.py