Skip to content

Commit e933e97

Browse files
committed
build: Simplify the version file generation
Remove the gen-dist.sh script and do not add the git sha if we are doing and out-of-tree build. Instead, rely only on the version provided by the meson project. Signed-off-by: Naushir Patuck <[email protected]>
1 parent a29e585 commit e933e97

File tree

3 files changed

+1
-27
lines changed

3 files changed

+1
-27
lines changed

src/meson.build

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,8 @@ add_project_arguments(logging_args, language : 'cpp')
3333
# Needed to avoid (erroneous) warnings on the use of addresses of fields in __attribute__((packed)) structs.
3434
add_project_arguments('-Wno-address-of-packed-member', language : 'cpp')
3535

36-
meson.add_dist_script(meson.project_source_root() / 'utils' / 'gen-dist.sh')
37-
3836
# Generate a version string:
3937
version_cmd = [meson.project_source_root() / 'utils' / 'version.py', meson.project_version()]
40-
41-
# Check if a version.gen file is present.
42-
# This would have been generated from the meson dist command.
43-
fs = import('fs')
44-
dist_version_file = meson.project_source_root() / 'version.gen'
45-
if fs.is_file(dist_version_file)
46-
version_cmd += fs.read(dist_version_file)
47-
endif
48-
4938
version_template = meson.project_source_root() / 'utils' / 'version.cpp.in'
5039
version_cpp = vcs_tag(command : version_cmd,
5140
input : version_template,

utils/gen-dist.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

utils/version.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,13 @@ def generate_version():
3838
if r.returncode:
3939
commit = commit + '-dirty'
4040

41-
elif len(sys.argv) == 3:
42-
commit = sys.argv[2].lower().strip()
43-
if any(c not in hexdigits for c in commit):
44-
raise RuntimeError('Invalid git sha!')
45-
46-
commit = commit[0:digits]
47-
4841
else:
4942
raise RuntimeError('Invalid number of command line arguments')
5043

5144
commit = f'v{sys.argv[1]} {commit}'
5245

5346
except RuntimeError as e:
54-
print(f'ERR: {e}', file=sys.stderr)
55-
commit = '0' * digits + '-invalid'
47+
commit = f'v{sys.argv[1]}'
5648

5749
finally:
5850
date_str = time.strftime(

0 commit comments

Comments
 (0)