summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew W Elble <aweits@rit.edu>2020-12-03 10:28:34 -0500
committerGitHub <noreply@github.com>2020-12-03 16:28:34 +0100
commit09aae616c760a3abb782aa3353c3476851b6a590 (patch)
treed6a154a3836a5ee92c3ef96c9dde1c3b9404236d
parent39be60ab929c90ce9c1c459d3511454efab04b92 (diff)
downloadspack-09aae616c760a3abb782aa3353c3476851b6a590.tar.gz
spack-09aae616c760a3abb782aa3353c3476851b6a590.tar.bz2
spack-09aae616c760a3abb782aa3353c3476851b6a590.tar.xz
spack-09aae616c760a3abb782aa3353c3476851b6a590.zip
concretizer: call inject_patches_variants() on the roots of the specs (#20203)
As was done in the old concretizer. Fixes an issue where conditionally patched dependencies did not show up in spec (gdal+jasper)
-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 b15c4826be..56f4ba75a4 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -1826,8 +1826,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