aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2024-01-31 18:59:22 -0800
committerAndersBroman <a.broman58@gmail.com>2024-02-01 09:12:38 +0000
commit8a54995b1c3ca70575045ba9c59e7df9cbd1233a (patch)
tree1393b9326e892acb15ef42c0e67c1f2da775f13f /tools
parentee90fb0f4160cbafa85bcc405c4d7f26991e8114 (diff)
wsutil+tools: Version info updates
Define VCS_NUM_COMMITS and VCS_COMMIT_ID in vcs_version.h. Use them to return the Logray version in get_lr_vcs_version_info and use that where appropriate. Rename VCSVERSION to VCS_VERSION.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/make-version.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/tools/make-version.py b/tools/make-version.py
index fdb4ff3a32..763bbc3476 100755
--- a/tools/make-version.py
+++ b/tools/make-version.py
@@ -184,33 +184,44 @@ def update_versioned_files(src_dir, set_version, repo_data):
def generate_version_h(repo_data):
# Generate new contents of version.h from repository data
+ num_commits_line = '#define VCS_NUM_COMMITS "0"\n'
+
+ commit_id_line = '/* #undef VCS_COMMIT_ID */\n'
+
if not repo_data.get('enable_vcsversion'):
- return "/* #undef VCSVERSION */\n"
+ return '/* #undef VCS_VERSION */\n' + num_commits_line + commit_id_line
+
+ if repo_data.get('num_commits'):
+ num_commits_line = f'#define VCS_NUM_COMMITS "{int(repo_data["num_commits"])}"\n'
+
+ if repo_data.get('commit_id'):
+ commit_id_line = f'#define VCS_COMMIT_ID "{repo_data["commit_id"]}"'
if repo_data.get('git_description'):
# Do not bother adding the git branch, the git describe output
# normally contains the base tag and commit ID which is more
# than sufficient to determine the actual source tree.
- return f'#define VCSVERSION "{repo_data["git_description"]}"\n'
+ return f'#define VCS_VERSION "{repo_data["git_description"]}"\n' + num_commits_line + commit_id_line
if repo_data.get('last_change') and repo_data.get('num_commits'):
version_string = f"v{repo_data['version_major']}.{repo_data['version_minor']}.{repo_data['version_patch']}"
- vcs_line = f'#define VCSVERSION "{version_string}-Git-{repo_data["num_commits"]}"\n'
- return vcs_line
+ vcs_line = f'#define VCS_VERSION "{version_string}-Git-{repo_data["num_commits"]}"\n'
+ return vcs_line + num_commits_line + commit_id_line
if repo_data.get('commit_id'):
- vcs_line = f'#define VCSVERSION "Git commit {repo_data["commit_id"]}"\n'
- return vcs_line
+ vcs_line = f'#define VCS_VERSION "Git commit {repo_data["commit_id"]}"\n'
+ return vcs_line + num_commits_line + commit_id_line
+
+ vcs_line = '#define VCS_VERSION "Git Rev Unknown from unknown"\n'
- vcs_line = '#define VCSVERSION "Git Rev Unknown from unknown"\n'
- return vcs_line
+ return vcs_line + num_commits_line + commit_id_line
def print_VCS_REVISION(version_file, repo_data, set_vcs):
# Write the version control system's version to $version_file.
# Don't change the file if it is not needed.
#
- # XXX - We might want to add VCSVERSION to CMakeLists.txt so that it can
+ # XXX - We might want to add VCS_VERSION to CMakeLists.txt so that it can
# generate vcs_version.h independently.
new_version_h = generate_version_h(repo_data)