1 From 39b6385454d705128e684ed779ba9620e2ead1e2 Mon Sep 17 00:00:00 2001
2 From: Yoann Congal <yoann.congal@smile.fr>
3 Date: Thu, 1 Aug 2024 18:58:04 +0200
4 Subject: [PATCH] update_build_version.py: support an envvar to force the
7 FORCED_BUILD_VERSION_DESCRIPTION envvar can be used to force a version
8 description instead of resorting to git describe which can change for a
9 given commit if multiple lightweight commits point ot it.
11 Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
12 Upstream-Status: Submitted [https://github.com/KhronosGroup/SPIRV-Tools/pull/5758]
14 utils/update_build_version.py | 9 +++++----
15 1 file changed, 5 insertions(+), 4 deletions(-)
17 diff --git a/utils/update_build_version.py b/utils/update_build_version.py
18 index bb66e18a..9115cab1 100755
19 --- a/utils/update_build_version.py
20 +++ b/utils/update_build_version.py
22 # - The software version deduced from the given CHANGES file.
23 # - A longer string with the project name, the software version number, and
24 # git commit information for the CHANGES file's directory. The commit
25 -# information is the output of "git describe" if that succeeds, or "git
26 -# rev-parse HEAD" if that succeeds, or otherwise a message containing the
27 -# phrase "unknown hash".
28 +# information is the content of the FORCED_BUILD_VERSION_DESCRIPTION
29 +# environement variable is it exists, else the output of "git describe" if
30 +# that succeeds, or "git rev-parse HEAD" if that succeeds, or otherwise a
31 +# message containing the phrase "unknown hash".
32 # The string contents are escaped as necessary.
35 @@ -150,7 +151,7 @@ def main():
38 repo_path = os.path.dirname(changes_file_path)
39 - description = describe(repo_path)
40 + description = os.getenv("FORCED_BUILD_VERSION_DESCRIPTION", describe(repo_path))
41 content = OUTPUT_FORMAT.format(version_tag=version, description=description)
43 # Escape file content.