Skip to content

Commit

Permalink
update_build_version.py: support an envvar to force the description
Browse files Browse the repository at this point in the history
FORCED_BUILD_VERSION_DESCRIPTION envvar can be used to force a version
description instead of resorting to git describe which can change for a
given commit if multiple lightweight commits point ot it.

Signed-off-by: Yoann Congal <[email protected]>
  • Loading branch information
ycongal-smile committed Sep 5, 2024
1 parent 61d6952 commit e2c57ca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions utils/update_build_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
# - The software version deduced from the given CHANGES file.
# - A longer string with the project name, the software version number, and
# git commit information for the CHANGES file's directory. The commit
# information is the output of "git describe" if that succeeds, or "git
# rev-parse HEAD" if that succeeds, or otherwise a message containing the
# phrase "unknown hash".
# information is the content of the FORCED_BUILD_VERSION_DESCRIPTION
# environement variable is it exists, else the output of "git describe" if
# that succeeds, or "git rev-parse HEAD" if that succeeds, or otherwise a
# message containing the phrase "unknown hash".
# The string contents are escaped as necessary.

import datetime
Expand Down Expand Up @@ -150,7 +151,7 @@ def main():
sys.exit(1)

repo_path = os.path.dirname(changes_file_path)
description = describe(repo_path)
description = os.getenv("FORCED_BUILD_VERSION_DESCRIPTION", describe(repo_path))
content = OUTPUT_FORMAT.format(version_tag=version, description=description)

# Escape file content.
Expand Down

0 comments on commit e2c57ca

Please sign in to comment.