From 43654078fc1700114e7c0c2596204fb950552fdf Mon Sep 17 00:00:00 2001 From: Max Zeyen Date: Fri, 1 Jul 2022 04:27:38 +0200 Subject: boost: do not add the context-impl option for version below 1.65.0 (#30719) * boost: do not access the context-impl variant for versions below 1.65.0 * boost: check if spec.variants contains context-impl * boost: improve error message when the context-impl variant causes a conflict Executing spack solve boost@1.63.0 +context context-impl=fcontext triggers the following error message: ==> Error: No version for 'boost' satisfies '@1.63.0' and '@1.79.0' With this change, the error message becomes the following: ==> Error: Cannot set variant 'context-impl' for package 'boost' because the variant condition cannot be satisfied for the given spec --- var/spack/repos/builtin/packages/boost/package.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py index ae42e4f26b..2badcfd26c 100644 --- a/var/spack/repos/builtin/packages/boost/package.py +++ b/var/spack/repos/builtin/packages/boost/package.py @@ -215,6 +215,11 @@ class Boost(Package): depends_on('zlib', when='+iostreams') depends_on('py-numpy', when='+numpy', type=('build', 'run')) + # Improve the error message when the context-impl variant is conflicting + conflicts('context-impl=fcontext', when='@:1.65.0') + conflicts('context-impl=ucontext', when='@:1.65.0') + conflicts('context-impl=winfib', when='@:1.65.0') + # Coroutine, Context, Fiber, etc., are not straightforward. conflicts('+context', when='@:1.50') # Context since 1.51.0. conflicts('cxxstd=98', when='+context') # Context requires >=C++11. @@ -489,7 +494,7 @@ class Boost(Package): "multithreaded} must be enabled") # If we are building context, tell b2 which backend to use - if '+context' in spec: + if '+context' in spec and 'context-impl' in spec.variants: options.extend(['context-impl=%s' % spec.variants['context-impl'].value]) if '+taggedlayout' in spec: @@ -680,7 +685,7 @@ class Boost(Package): type(dependent_spec.package).cmake_args = _cmake_args def setup_dependent_build_environment(self, env, dependent_spec): - if '+context' in self.spec: + if '+context' in self.spec and 'context-impl' in self.spec.variants: context_impl = self.spec.variants['context-impl'].value # fcontext, as the default, has no corresponding macro if context_impl == 'ucontext': -- cgit v1.2.3-60-g2f50