diff options
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 |