Constrain abstract specs rather than concatenating strings in the "when" context manager (#26700)

Using the Spec.constrain method doesn't work since it might
trigger a repository lookup which could break our directives
and triggers a circular import error.

To fix that we introduce a function to merge abstract anonymous
specs, based only on package names, which does not perform any
lookup in the repository.
This commit is contained in:
Massimiliano Culpo
2021-10-14 12:33:10 +02:00
committed by GitHub
parent 2c3ea68dd1
commit 949094544e
7 changed files with 77 additions and 12 deletions

View File

@@ -17,4 +17,7 @@ class WithConstraintMet(Package):
with when('@1.0'):
depends_on('b')
conflicts('%gcc')
conflicts('%gcc', when='+foo')
with when('@0.14: ^b@:4.0'):
depends_on('c', when='@:15 ^b@3.8:')