summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--var/spack/repos/builtin.mock/packages/external-buildable-with-variant/package.py15
-rw-r--r--var/spack/repos/builtin.mock/packages/externaltool/package.py1
5 files changed, 42 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
diff --git a/var/spack/repos/builtin.mock/packages/external-buildable-with-variant/package.py b/var/spack/repos/builtin.mock/packages/external-buildable-with-variant/package.py
new file mode 100644
index 0000000000..58de53054a
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/external-buildable-with-variant/package.py
@@ -0,0 +1,15 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+from spack import *
+
+
+class ExternalBuildableWithVariant(Package):
+ homepage = "http://somewhere.com"
+ url = "http://somewhere.com/module-1.0.tar.gz"
+
+ version('1.0', '1234567890abcdef1234567890abcdef')
+
+ variant('baz', default=False, description='nope')
diff --git a/var/spack/repos/builtin.mock/packages/externaltool/package.py b/var/spack/repos/builtin.mock/packages/externaltool/package.py
index 4677dfeda9..114ae2d4a9 100644
--- a/var/spack/repos/builtin.mock/packages/externaltool/package.py
+++ b/var/spack/repos/builtin.mock/packages/externaltool/package.py
@@ -12,5 +12,6 @@ class Externaltool(Package):
version('1.0', '1234567890abcdef1234567890abcdef')
version('0.9', '1234567890abcdef1234567890abcdef')
+ version('0.8.1', '1234567890abcdef1234567890abcdef')
depends_on('externalprereq')