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
This commit is contained in:
Max Zeyen 2022-07-01 04:27:38 +02:00 committed by GitHub
parent 8cd542529a
commit 43654078fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,6 +215,11 @@ def libs(self):
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 @@ def determine_b2_options(self, spec, options):
"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 @@ def _cmake_args(self):
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':