scripts: support propagating workspace status to zephyr revision

The PR #39382 raised a discussion on build reproducibility and knowledge
of west projects being out of sync with the west manifest.

Similar to how `git submodules` will report the working tree dirty if
any of the submodules HEAD points to a SHA different than the one
recorded in the super project.

Based on this discussion this commit extends the Zephyr and manifest
repo (when `west` is used) revisions to include the concatenated states
of the workspace.

The workspace states are:
>  dirty: false / true
>  extra: false / true
>  off:   false / true

the final revision will become: <SHA>-<state1>-<state2>-<state3>

For example:
> zephyr:
>  path: /.../zephyr
>  revision: <SHA>-dirty-extra-off

or
> zephyr:
>  path: /.../zephyr
>  revision: <SHA>-extra

The `BUILD_OUTPUT_META_STATE_PROPAGATE` Kconfig setting is introduced
to provide user control of this behavior.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2021-11-04 18:35:50 +01:00 committed by Carles Cufí
commit 1a51993192
3 changed files with 44 additions and 2 deletions

View file

@ -1470,6 +1470,7 @@ if(CONFIG_BUILD_OUTPUT_META)
${ZEPHYR_MODULES_ARG}
${ZEPHYR_EXTRA_MODULES_ARG}
--meta-out ${KERNEL_META_NAME}
$<$<BOOL:${CONFIG_BUILD_OUTPUT_META_STATE_PROPAGATE}>:--meta-state-propagate>
)
list(APPEND
post_build_byproducts