cmake: Re-write the capability database to avoid file appends
cmake: Re-write the capability database to avoid file appends

CI sometimes fails with a temporarily corrupted toolchain capabilitiy
database file. Although not proven, there is evidence that CMake's
file(APPEND does not work atomically when there are concurrent writes
and reads of a certain size.

To avoid file appending, we re-write the key-value database
implementation to store keys in filenames and values in individual
single-byte files.

This is (most likely) fixes #9992.

NB: Users that have been overriding the database file location with
the CMake variable ZEPHYR_TOOLCHAIN_CAPABILITY_CACHE must now specify
a directory with the variable ZEPHYR_TOOLCHAIN_CAPABILITY_CACHE_DIR.

Signed-off-by: Sebastian Bøe <edee888afd63e94916688495334700803eba20a0@nordicsemi.no>

ldts/zephyr,finikorg/zephyr,nashif/zephyr,GiulianoFranchetto/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,nashif/zephyr,galak/zephyr,galak/zephyr,Vudentz/zephyr,explora26/zephyr,finikorg/zephyr,zephyrproject-rtos/zephyr,finikorg/zephyr,finikorg/zephyr,Vudentz/zephyr,GiulianoFranchetto/zephyr,ldts/zephyr,nashif/zephyr,punitvara/zephyr,GiulianoFranchetto/zephyr,explora26/zephyr,Vudentz/zephyr,galak/zephyr,ldts/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr,punitvara/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr,explora26/zephyr,punitvara/zephyr,punitvara/zephyr,ldts/zephyr,finikorg/zephyr,punitvara/zephyr,GiulianoFranchetto/zephyr,GiulianoFranchetto/zephyr,Vudentz/zephyr,explora26/zephyr,nashif/zephyr,galak/zephyr,explora26/zephyr,nashif/zephyr,ldts/zephyr,galak/zephyr