On 25/07/18 10:21, Eduardo Lima (Etrunko) wrote: > On 25/07/18 10:16, Frediano Ziglio wrote: >>> On 25/07/18 06:07, Frediano Ziglio wrote: >>>> Check we get correctly project version >>>> --- >>>> meson.build | 9 ++++++--- >>>> 1 file changed, 6 insertions(+), 3 deletions(-) >>>> >>>> diff --git a/meson.build b/meson.build >>>> index c564941b9..360d1a543 100644 >>>> --- a/meson.build >>>> +++ b/meson.build >>>> @@ -1,14 +1,17 @@ >>>> # >>>> # project definition >>>> # >>>> -# TODO: double check meson.project_version() >>>> -# Ideally we would use the output of git-version-gen as input for meson, >>>> because >>>> -# we can not check the result of the command before declaring project(). >>>> # >>>> project('spice', 'c', >>>> version : run_command('build-aux/git-version-gen', >>>> '.tarball-version').stdout().strip(), >>>> license : 'LGPLv2.1', >>>> meson_version : '>= 0.47.0') >>>> +# double check meson.project_version() >>>> +# we can not check the result of the command before declaring project(). >>>> +version = run_command('build-aux/git-version-gen', '.tarball-version', >>>> check : true).stdout().strip() >>>> +if meson.project_version() != version >>>> + error('Wrong project version') >>>> +endif >>>> >>> >>> >>> Thinking better about this one, wouldn't it be enough to add 'check : >>> true' to the run_command in project definition only, instead of running >>> it again? >>> >> >> Would... but not work! Meson die really badly if you try... > > Okay, I tested it and got this long backtrace, looks like we found a bug > in meson. > Filed https://github.com/mesonbuild/meson/issues/3944 > Traceback (most recent call last): > File "/usr/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line > 351, in run > app.generate() > File "/usr/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line > 117, in generate > self._generate(env) > File "/usr/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line > 134, in _generate > intr = interpreter.Interpreter(b) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreter.py", > line 1874, in __init__ > self.parse_project() > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 362, in parse_project > self.evaluate_codeblock(self.ast, end=1) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 401, in evaluate_codeblock > raise e > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 395, in evaluate_codeblock > self.evaluate_statement(cur) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 406, in evaluate_statement > return self.function_call(cur) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 688, in function_call > (posargs, kwargs) = self.reduce_arguments(node.args) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 925, in reduce_arguments > reduced_kw[key] = self.evaluate_statement(a) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 410, in evaluate_statement > return self.method_call(cur) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 706, in method_call > obj = self.evaluate_statement(invokable) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 410, in evaluate_statement > return self.method_call(cur) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 706, in method_call > obj = self.evaluate_statement(invokable) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 406, in evaluate_statement > return self.function_call(cur) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 696, in function_call > return func(node, posargs, kwargs) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 269, in wrapped > FeatureCheckClass(name, self.feature_version).use(subproject) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 178, in use > tv = self.get_target_version(subproject) > File "/usr/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", > line 175, in get_target_version > return mesonlib.project_meson_versions[subproject] > KeyError: '' > > >> >>> >>> diff --git a/meson.build b/meson.build >>> index c564941b..bc5424cc 100644 >>> --- a/meson.build >>> +++ b/meson.build >>> @@ -1,12 +1,8 @@ >>> # >>> # project definition >>> # >>> -# TODO: double check meson.project_version() >>> -# Ideally we would use the output of git-version-gen as input for >>> meson, because >>> -# we can not check the result of the command before declaring project(). >>> -# >>> project('spice', 'c', >>> - version : run_command('build-aux/git-version-gen', >>> '.tarball-version').stdout().strip(), >>> + version : run_command('build-aux/git-version-gen', >>> '.tarball-version', check : true).stdout().strip(), >>> license : 'LGPLv2.1', >>> meson_version : '>= 0.47.0') >>> >>> >>> >>> >>>> spice_server_so_version = '1.12.4' >>>> >>>> > > -- Eduardo de Barros Lima (Etrunko) Software Engineer - RedHat etrunko@xxxxxxxxxx _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel