summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2020-12-06 10:29:05 +0100
committerGitHub <noreply@github.com>2020-12-06 10:29:05 +0100
commit3843f43e6983d9c513218a2c0e25c27e5be76994 (patch)
treeb9c1e5d2c339928117df012553f9f934cd0284c2 /lib
parentfbb127c46a78493a6204adb74d752939758dbe37 (diff)
downloadspack-3843f43e6983d9c513218a2c0e25c27e5be76994.tar.gz
spack-3843f43e6983d9c513218a2c0e25c27e5be76994.tar.bz2
spack-3843f43e6983d9c513218a2c0e25c27e5be76994.tar.xz
spack-3843f43e6983d9c513218a2c0e25c27e5be76994.zip
concretizer: each external version is allowed by definition (#20247)
Registering external versions among the lists of allowed ones generates the correct rules for `version_satisfies`
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/solver/asp.py1
-rw-r--r--lib/spack/spack/test/concretize.py18
-rw-r--r--lib/spack/spack/test/data/config/packages.yaml7
3 files changed, 26 insertions, 0 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index 56f4ba75a4..7810d35445 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -1060,6 +1060,7 @@ class SpackSolverSetup(object):
for id, spec in enumerate(external_specs):
self.gen.newline()
spec_id = fn.external_spec(pkg_name, id)
+ self.possible_versions[spec.name].add(spec.version)
clauses = self.spec_clauses(spec, body=True)
# This is an iff below, wish it could be written in a
# more compact form
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index 2e96eea4af..f5f4ac4ad9 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -979,3 +979,21 @@ class TestConcretize(object):
def test_dont_select_version_that_brings_more_variants_in(self):
s = Spec('dep-with-variants-if-develop-root').concretized()
assert s['dep-with-variants-if-develop'].satisfies('@1.0')
+
+ @pytest.mark.regression('20244')
+ @pytest.mark.parametrize('spec_str,is_external,expected', [
+ # These are all externals, and 0_8 is a version not in package.py
+ ('externaltool@1.0', True, '@1.0'),
+ ('externaltool@0.9', True, '@0.9'),
+ ('externaltool@0_8', True, '@0_8'),
+ # This external package is buildable, has a custom version
+ # in packages.yaml that is greater than the ones in package.py
+ # and specifies a variant
+ ('external-buildable-with-variant +baz', True, '@1.1.special +baz'),
+ ('external-buildable-with-variant ~baz', False, '@1.0 ~baz'),
+ ('external-buildable-with-variant@1.0: ~baz', False, '@1.0 ~baz'),
+ ])
+ def test_external_package_versions(self, spec_str, is_external, expected):
+ s = Spec(spec_str).concretized()
+ assert s.external == is_external
+ assert s.satisfies(expected)
diff --git a/lib/spack/spack/test/data/config/packages.yaml b/lib/spack/spack/test/data/config/packages.yaml
index 748a46b1a1..6e8752f635 100644
--- a/lib/spack/spack/test/data/config/packages.yaml
+++ b/lib/spack/spack/test/data/config/packages.yaml
@@ -9,6 +9,8 @@ packages:
prefix: /path/to/external_tool
- spec: externaltool@0.9%gcc@4.5.0
prefix: /usr
+ - spec: externaltool@0_8%gcc@4.5.0
+ prefix: /usr
externalvirtual:
buildable: False
externals:
@@ -27,3 +29,8 @@ packages:
externals:
- spec: requires-virtual@2.0
prefix: /usr
+ 'external-buildable-with-variant':
+ buildable: True
+ externals:
+ - spec: external-buildable-with-variant@1.1.special +baz
+ prefix: /usr