summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/solver/asp.py4
-rw-r--r--lib/spack/spack/test/cmd/dependents.py6
-rw-r--r--lib/spack/spack/test/concretize.py8
-rw-r--r--var/spack/repos/builtin.mock/packages/conditionally-patch-dependency/package.py16
-rw-r--r--var/spack/repos/builtin.mock/packages/conditionally-patch-dependency/uuid.patch1
5 files changed, 31 insertions, 4 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index f4b2da319a..05e7036713 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -1827,8 +1827,8 @@ class SpecBuilder(object):
# fix flags after all specs are constructed
self.reorder_flags()
- for s in self._specs.values():
- spack.spec.Spec.inject_patches_variant(s)
+ for root in set([spec.root for spec in self._specs.values()]):
+ spack.spec.Spec.inject_patches_variant(root)
# Add external paths to specs with just external modules
for s in self._specs.values():
diff --git a/lib/spack/spack/test/cmd/dependents.py b/lib/spack/spack/test/cmd/dependents.py
index 681b255d05..bd87f92a65 100644
--- a/lib/spack/spack/test/cmd/dependents.py
+++ b/lib/spack/spack/test/cmd/dependents.py
@@ -23,7 +23,8 @@ def test_immediate_dependents(mock_packages):
'libdwarf',
'patch-a-dependency',
'patch-several-dependencies',
- 'quantum-espresso'
+ 'quantum-espresso',
+ 'conditionally-patch-dependency'
])
@@ -38,7 +39,8 @@ def test_transitive_dependents(mock_packages):
'multivalue-variant',
'singlevalue-variant-dependent',
'patch-a-dependency', 'patch-several-dependencies',
- 'quantum-espresso'
+ 'quantum-espresso',
+ 'conditionally-patch-dependency'
])
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index 8366ecca14..fed0432f91 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -967,3 +967,11 @@ class TestConcretize(object):
s = Spec('a %gcc@foo os=redhat6').concretized()
assert '%gcc@foo' in s
+
+ def test_all_patches_applied(self):
+ uuidpatch = 'a60a42b73e03f207433c5579de207c6ed61d58e4d12dd3b5142eb525728d89ea'
+ localpatch = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
+ spec = spack.spec.Spec('conditionally-patch-dependency+jasper')
+ spec.concretize()
+ assert ((uuidpatch, localpatch) ==
+ spec['libelf'].variants['patches'].value)
diff --git a/var/spack/repos/builtin.mock/packages/conditionally-patch-dependency/package.py b/var/spack/repos/builtin.mock/packages/conditionally-patch-dependency/package.py
new file mode 100644
index 0000000000..7321d5bbd4
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/conditionally-patch-dependency/package.py
@@ -0,0 +1,16 @@
+# 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)
+
+
+class ConditionallyPatchDependency(Package):
+ """Package that conditionally requries a patched version
+ of a dependency."""
+
+ homepage = "http://www.example.com"
+ url = "http://www.example.com/patch-a-dependency-1.0.tar.gz"
+
+ version('1.0', '0123456789abcdef0123456789abcdef')
+ variant('jasper', default=False)
+ depends_on('libelf@0.8.10', patches=[patch('uuid.patch')], when='+jasper')
diff --git a/var/spack/repos/builtin.mock/packages/conditionally-patch-dependency/uuid.patch b/var/spack/repos/builtin.mock/packages/conditionally-patch-dependency/uuid.patch
new file mode 100644
index 0000000000..bc9de1f3a4
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/conditionally-patch-dependency/uuid.patch
@@ -0,0 +1 @@
+patchadep