summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorNathan Hanford <8302958+nhanford@users.noreply.github.com>2021-02-23 13:56:00 -0800
committerGitHub <noreply@github.com>2021-02-23 13:56:00 -0800
commit8ef67e2b159e86332de2498561122f8b3ec3dd87 (patch)
tree167c5176fffb2639a51bfbd5d36b993db076d7a0 /var
parent21349a4d25ea0e4c3022fde9fd244f1e3179ebfd (diff)
downloadspack-8ef67e2b159e86332de2498561122f8b3ec3dd87.tar.gz
spack-8ef67e2b159e86332de2498561122f8b3ec3dd87.tar.bz2
spack-8ef67e2b159e86332de2498561122f8b3ec3dd87.tar.xz
spack-8ef67e2b159e86332de2498561122f8b3ec3dd87.zip
New splice method in class Spec. (#20262)
* Spec.splice feature Construct a new spec with a dependency swapped out. Currently can only swap dependencies of the same name, and can only apply to concrete specs. This feature is not yet attached to any install functionality, but will eventually allow us to "rewire" a package to depend on a different set of dependencies. Docstring is reformatted for git below Splices dependency "other" into this ("target") Spec, and return the result as a concrete Spec. If transitive, then other and its dependencies will be extrapolated to a list of Specs and spliced in accordingly. For example, let there exist a dependency graph as follows: T | \ Z<-H In this example, Spec T depends on H and Z, and H also depends on Z. Suppose, however, that we wish to use a differently-built H, known as H'. This function will splice in the new H' in one of two ways: 1. transitively, where H' depends on the Z' it was built with, and the new T* also directly depends on this new Z', or 2. intransitively, where the new T* and H' both depend on the original Z. Since the Spec returned by this splicing function is no longer deployed the same way it was built, any such changes are tracked by setting the build_spec to point to the corresponding dependency from the original Spec. Co-authored-by: Nathan Hanford <hanford1@llnl.gov>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin.mock/packages/splice-h/package.py22
-rw-r--r--var/spack/repos/builtin.mock/packages/splice-t/package.py18
-rw-r--r--var/spack/repos/builtin.mock/packages/splice-z/package.py18
3 files changed, 58 insertions, 0 deletions
diff --git a/var/spack/repos/builtin.mock/packages/splice-h/package.py b/var/spack/repos/builtin.mock/packages/splice-h/package.py
new file mode 100644
index 0000000000..79b91bc963
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/splice-h/package.py
@@ -0,0 +1,22 @@
+# Copyright 2013-2021 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 SpliceH(AutotoolsPackage):
+ """Simple package with one optional dependency"""
+
+ homepage = "http://www.example.com"
+ url = "http://www.example.com/splice-h-1.0.tar.gz"
+
+ version('1.0', '0123456789abcdef0123456789abcdef')
+
+ variant('foo', default=False, description='nope')
+ variant('bar', default=False, description='nope')
+ variant('baz', default=False, description='nope')
+
+ depends_on('splice-z')
+ depends_on('splice-z+foo', when='+foo')
diff --git a/var/spack/repos/builtin.mock/packages/splice-t/package.py b/var/spack/repos/builtin.mock/packages/splice-t/package.py
new file mode 100644
index 0000000000..ec27fd28b6
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/splice-t/package.py
@@ -0,0 +1,18 @@
+# Copyright 2013-2021 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 SpliceT(AutotoolsPackage):
+ """Simple package with one optional dependency"""
+
+ homepage = "http://www.example.com"
+ url = "http://www.example.com/splice-t-1.0.tar.gz"
+
+ version('1.0', '0123456789abcdef0123456789abcdef')
+
+ depends_on('splice-h')
+ depends_on('splice-z')
diff --git a/var/spack/repos/builtin.mock/packages/splice-z/package.py b/var/spack/repos/builtin.mock/packages/splice-z/package.py
new file mode 100644
index 0000000000..e28d359b66
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/splice-z/package.py
@@ -0,0 +1,18 @@
+# Copyright 2013-2021 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 SpliceZ(AutotoolsPackage):
+ """Simple package with one optional dependency"""
+
+ homepage = "http://www.example.com"
+ url = "http://www.example.com/splice-z-1.0.tar.gz"
+
+ version('1.0', '0123456789abcdef0123456789abcdef')
+
+ variant('foo', default=False, description='nope')
+ variant('bar', default=False, description='nope')