Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit 9386b67

Browse files
committed
meson: fix warning about unexpected return code checking for run_command
Recent versions of Meson warn you that the default is to not check the return code, which is a bad default and may eventually change. To suppress this warning, an explicit `check: ` value must be set. Considering the code in play here: - check if git exists - if so, always assume this is running from a git checkout - embed either '()' or '(git describe version)' it seems likely the intention is indeed to have it be `check: false`, but there's some missing error checking here to ensure it. Check the returncode. If git fails, it is surely because there is no git repository and the build is being run from a tarball. In that case, behave as though git wasn't found in the first place, and use the fallback value. Suppressing the warning can be done without bumping the minimum version of meson by only passing it on sufficiently new versions of Meson. This can be simplified by bumping the minimum version of Meson, which may or may not be desirable.
1 parent f92e900 commit 9386b67

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/meson.build

+13-6
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,20 @@ config_file = configure_file(
2020
output : 'config.h',
2121
configuration : config_cfg)
2222

23+
intel_driver_git_version = intel_vaapi_driver_version
2324
if git.found()
24-
git_version = run_command(
25-
git, '--git-dir', join_paths(meson.source_root(), '.git'),
26-
'describe', '--tags')
27-
intel_driver_git_version = git_version.stdout().strip()
28-
else
29-
intel_driver_git_version = intel_vaapi_driver_version
25+
if meson.version().version_compare('>=0.47.0')
26+
git_version = run_command(
27+
git, '--git-dir', join_paths(meson.source_root(), '.git'),
28+
'describe', '--tags', check: false)
29+
else
30+
git_version = run_command(
31+
git, '--git-dir', join_paths(meson.source_root(), '.git'),
32+
'describe', '--tags')
33+
endif
34+
if git_version.returncode() == 0
35+
intel_driver_git_version = git_version.stdout().strip()
36+
endif
3037
endif
3138

3239
version_cfg = configuration_data()

0 commit comments

Comments
 (0)