Skip to content

Commit

Permalink
meson: fix warning about unexpected return code checking for run_command
Browse files Browse the repository at this point in the history
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 means bumping the minimum version of Meson. This
can be safely done since both the previous and new minimums are quite
old, and libva already depends on a much newer version.

Signed-off-by: Eli Schwartz <[email protected]>
  • Loading branch information
eli-schwartz committed May 3, 2022
1 parent 67f619a commit 46898db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project(
'intel-vaapi-driver', 'c',
version : '2.4.0.1',
meson_version : '>= 0.43.0',
meson_version : '>= 0.47.0',
default_options : [ 'warning_level=1',
'buildtype=debugoptimized' ])

Expand Down
9 changes: 5 additions & 4 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ config_file = configure_file(
output : 'config.h',
configuration : config_cfg)

intel_driver_git_version = intel_vaapi_driver_version
if git.found()
git_version = run_command(
git, '--git-dir', join_paths(meson.source_root(), '.git'),
'describe', '--tags')
intel_driver_git_version = git_version.stdout().strip()
else
intel_driver_git_version = intel_vaapi_driver_version
'describe', '--tags', check: false)
if git_version.returncode() == 0
intel_driver_git_version = git_version.stdout().strip()
endif
endif

version_cfg = configuration_data()
Expand Down

0 comments on commit 46898db

Please sign in to comment.