diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2020-12-06 10:29:05 +0100 |
---|---|---|
committer | Tamara Dahlgren <dahlgren1@llnl.gov> | 2021-02-17 17:07:22 -0800 |
commit | ecfba13d890e907e5fd2f0445404182e78bb48ee (patch) | |
tree | a27887a11be2229b3486666e76be9d8281190dae /lib | |
parent | a6d433b937ee7d418289b23585a6d53343f1f14e (diff) | |
download | spack-ecfba13d890e907e5fd2f0445404182e78bb48ee.tar.gz spack-ecfba13d890e907e5fd2f0445404182e78bb48ee.tar.bz2 spack-ecfba13d890e907e5fd2f0445404182e78bb48ee.tar.xz spack-ecfba13d890e907e5fd2f0445404182e78bb48ee.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.py | 1 | ||||
-rw-r--r-- | lib/spack/spack/test/concretize.py | 18 | ||||
-rw-r--r-- | lib/spack/spack/test/data/config/packages.yaml | 7 |
3 files changed, 26 insertions, 0 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 05e7036713..890411e9e3 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 |