mirror of https://github.com/thesofproject/sof.git
version.cmake: more robust logging of the current git commit and parents
execute_process() runs in the current directory of the process invoking
cmake. This can be completely outside the git repo.
Fixes commit a5899812b7
("version.cmake: don't trust CI to record time
and versions and log ourselves")
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
parent
805e57b28f
commit
58d3551960
|
@ -27,10 +27,11 @@ message(STATUS "version.cmake starting SOF build at ${build_start_time} UTC")
|
|||
# moving target: the latest target branch. In that case the SHA version
|
||||
# gathered by git describe is disposable hence useless. Only the
|
||||
# --parents SHA are useful.
|
||||
message(STATUS "Building git commit with parent(s):")
|
||||
message(STATUS "Building SOF git commit with parent(s):")
|
||||
# Note execute_process() failures are ignored by default (missing git...)
|
||||
execute_process(
|
||||
COMMAND git log --parents --oneline --decorate -n 1 HEAD
|
||||
COMMAND git -C "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
log --parents --oneline --decorate -n 1 HEAD
|
||||
)
|
||||
|
||||
|
||||
|
@ -134,6 +135,7 @@ function(sof_check_version_h)
|
|||
"#define SOF_SRC_HASH 0x${SOF_SRC_HASH}\n"
|
||||
)
|
||||
|
||||
# Regenerating the same file would cause a full rebuild.
|
||||
if(EXISTS "${VERSION_H_PATH}")
|
||||
file(READ "${VERSION_H_PATH}" old_version_content)
|
||||
if("${header_content}" STREQUAL "${old_version_content}")
|
||||
|
|
Loading…
Reference in New Issue