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

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.
  • Loading branch information
eli-schwartz committed May 2, 2022
1 parent f92e900 commit cb5ffa1
Showing 1 changed file with 5 additions and 4 deletions.
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 cb5ffa1

Please sign in to comment.