summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/concretize.py9
-rw-r--r--lib/spack/spack/spec.py2
-rw-r--r--lib/spack/spack/test/concretize.py28
3 files changed, 34 insertions, 5 deletions
diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py
index 01ff163493..c27a023136 100644
--- a/lib/spack/spack/concretize.py
+++ b/lib/spack/spack/concretize.py
@@ -85,8 +85,8 @@ class DefaultConcretizer(object):
provider_cmp = partial(spack.pkgsort.provider_compare, spec_w_preferred_providers.name, spec.name)
packages = sorted(providers, cmp=provider_cmp)
else:
- if not spec_externals(spec) or spec.external:
- return None
+ if spec.external:
+ return False
packages = [spec]
# For each candidate package, if it has externals add those to the candidates
@@ -129,7 +129,7 @@ class DefaultConcretizer(object):
#Try a looser ABI matching
candidate = next((c for c in candidates if spack.abi.compatible(c[0], other_spec, loose=True)), None)
if not candidate:
- #Pick the first choice
+ #No ABI matches. Pick the top choice based on the orignal preferences.
candidate = candidates[0]
external = candidate[1]
candidate_spec = candidate[0]
@@ -144,10 +144,11 @@ class DefaultConcretizer(object):
if not spec.external and external:
spec.external = external
changed = True
+
#If we're external then trim the dependencies
if external and spec.dependencies:
changed = True
- spec.depencencies = DependencyMap()
+ spec.dependencies = DependencyMap()
return changed
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 6984b4a174..49b67cd361 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1022,7 +1022,7 @@ class Spec(object):
# if we descend into a virtual spec, there's nothing more
# to normalize. Concretize will finish resolving it later.
- if self.virtual:
+ if self.virtual or self.external:
return False
# Combine constraints from package deps with constraints from
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index b3a77d076a..f81a2f5af8 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -192,3 +192,31 @@ class ConcretizeTest(MockPackagesTest):
# TODO: not exactly the syntax I would like.
self.assertTrue(spec['libdwarf'].compiler.satisfies('clang'))
self.assertTrue(spec['libelf'].compiler.satisfies('clang'))
+
+
+ def test_external_package(self):
+ spec = Spec('externaltool')
+ spec.concretize()
+
+ self.assertEqual(spec['externaltool'].external, '/path/to/external_tool')
+ self.assertFalse('externalprereq' in spec)
+ self.assertTrue(spec['externaltool'].compiler.satisfies('gcc'))
+
+
+ def test_nobuild_package(self):
+ got_error = False
+ spec = Spec('externaltool%clang')
+ try:
+ spec.concretize()
+ except spack.concretize.NoBuildError:
+ got_error = True
+ self.assertTrue(got_error)
+
+
+ def test_external_and_virtual(self):
+ spec = Spec('externaltest')
+ spec.concretize()
+ self.assertTrue(spec['externaltool'].external, '/path/to/external_tool')
+ self.assertTrue(spec['stuff'].external, '/path/to/external_virtual_gcc')
+ self.assertTrue(spec['externaltool'].compiler.satisfies('gcc'))
+ self.assertTrue(spec['stuff'].compiler.satisfies('gcc'))