aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/interpreter.py
diff options
context:
space:
mode:
authorØyvind Aarrestad Aakre <oyvind.aakre@easee.no>2022-01-09 22:12:52 +0100
committerEli Schwartz <eschwartz93@gmail.com>2022-01-12 14:04:11 -0500
commit5b3094d43bae45b779fcbd859d4a883c8f6c9d77 (patch)
tree23a2322f607ef112ba5a1b9a7d2e67ed5eaabfec /mesonbuild/interpreter/interpreter.py
parentbc8c1f578f635d870d0f03c0a34750212ac4287e (diff)
downloadmeson-5b3094d43bae45b779fcbd859d4a883c8f6c9d77.zip
meson-5b3094d43bae45b779fcbd859d4a883c8f6c9d77.tar.gz
meson-5b3094d43bae45b779fcbd859d4a883c8f6c9d77.tar.bz2
subproject: fix version validation on lookup
Fixes a bug where the subproject version was not validated when the subproject had already been processed. The bug would cause inconsistent build results if the subproject was referenced more than once (diamond) with conflicting version requirements.
Diffstat (limited to 'mesonbuild/interpreter/interpreter.py')
-rw-r--r--mesonbuild/interpreter/interpreter.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 1db0588..a81f986 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -829,6 +829,11 @@ external dependencies (including libraries) must go to "dependencies".''')
subproject = self.subprojects[subp_name]
if required and not subproject.found():
raise InterpreterException(f'Subproject "{subproject.subdir}" required but not found.')
+ if 'version' in kwargs:
+ pv = self.build.subprojects[subp_name]
+ wanted = kwargs['version']
+ if pv == 'undefined' or not mesonlib.version_compare_many(pv, wanted)[0]:
+ raise InterpreterException(f'Subproject {subp_name} version is {pv} but {wanted} required.')
return subproject
r = self.environment.wrap_resolver