Skip to content

Commit

Permalink
cmake: Introduce a key version to invalidate corrupted caches
Browse files Browse the repository at this point in the history
When a bug in the caching mechanism is detected the cache format must
be bumped to ensure that we no longer get a cache hit on old corrupted
keys.

This fixes zephyrproject-rtos#7246 when the cache is corrupted.

Signed-off-by: Sebastian Bøe <[email protected]>
  • Loading branch information
SebastianBoe authored and Anas Nashif committed May 2, 2018
1 parent 5f08b10 commit aa90d72
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmake/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,15 @@ function(zephyr_check_compiler_flag lang option check)
# We need to create a unique key wrt. testing the toolchain
# capability. This key must be a valid C identifier that includes
# everything that can affect the toolchain test.

# The 'cacheformat' must be bumped if a bug in the caching mechanism
# is detected and all old keys must be invalidated.
set(cacheformat 2)

set(key_string "")
set(key_string "${key_string}ZEPHYR_TOOLCHAIN_CAPABILITY_CACHE_")
set(key_string "${key_string}cacheformat_")
set(key_string "${key_string}${cacheformat}_")
set(key_string "${key_string}${TOOLCHAIN_SIGNATURE}_")
set(key_string "${key_string}${lang}_")
set(key_string "${key_string}${option}_")
Expand Down

0 comments on commit aa90d72

Please sign in to comment.