X Tutup
Skip to content

Commit c1f8fdd

Browse files
authored
Add documentation for chaining Spack instances (spack#11152)
Add documentation for the Spack chain feature added in spack#8772
1 parent a5315f3 commit c1f8fdd

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed

lib/spack/docs/chain.rst

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
.. Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
2+
Spack Project Developers. See the top-level COPYRIGHT file for details.
3+
4+
SPDX-License-Identifier: (Apache-2.0 OR MIT)
5+
6+
.. chain:
7+
8+
============================
9+
Chaining Spack Installations
10+
============================
11+
12+
You can point your Spack installation to another installation to use any
13+
packages that are installed there. To register the other Spack instance,
14+
you can add it as an entry to ``config.yaml``:
15+
16+
.. code-block:: yaml
17+
18+
config:
19+
upstreams:
20+
spack-instance-1:
21+
install_tree: /path/to/other/spack/opt/spack
22+
spack-instance-2:
23+
install_tree: /path/to/another/spack/opt/spack
24+
25+
``install_tree`` must point to the ``opt/spack`` directory inside of the
26+
Spack base directory.
27+
28+
Once the upstream Spack instance has been added, ``spack find`` will
29+
automatically check the upstream instance when querying installed packages,
30+
and new package installations for the local Spack install will use any
31+
dependencies that are installed in the upstream instance.
32+
33+
This other instance of Spack has no knowledge of the local Spack instance
34+
and may not have the same permissions or ownership as the local Spack instance.
35+
This has the following consequences:
36+
37+
#. Upstream Spack instances are not locked. Therefore it is up to users to
38+
make sure that the local instance is not using an upstream instance when it
39+
is being modified.
40+
41+
#. Users should not uninstall packages from the upstream instance. Since the
42+
upstream instance doesn't know about the local instance, it cannot prevent
43+
the uninstallation of packages which the local instance depends on.
44+
45+
Other details about upstream installations:
46+
47+
#. If a package is installed both locally and upstream, the local installation
48+
will always be used as a dependency. This can occur if the local Spack
49+
installs a package which is not present in the upstream, but later on the
50+
upstream Spack instance also installs that package.
51+
52+
#. If an upstream Spack instance registers and installs an external package,
53+
the local Spack instance will treat this the same as a Spack-installed
54+
package. This feature will only work if the upstream Spack instance
55+
includes the upstream functionality (i.e. if its commit is after March
56+
27, 2019).
57+
58+
---------------------------------------
59+
Using Multiple Upstream Spack Instances
60+
---------------------------------------
61+
62+
A single Spack instance can use multiple upstream Spack installations. Spack
63+
will search upstream instances in the order you list them in your
64+
configuration. If your installation refers to instances X and Y, in that order,
65+
then instance X must list Y as an upstream in its own ``config.yaml``.
66+
67+
-----------------------------------
68+
Using Modules for Upstream Packages
69+
-----------------------------------
70+
71+
The local Spack instance does not generate modules for packages which are
72+
installed upstream. The local Spack instance can be configured to use the
73+
modules generated by the upstream Spack instance.
74+
75+
There are two requirements to use the modules created by an upstream Spack
76+
instance: firstly the upstream instance must do a ``spack module tcl refresh``,
77+
which generates an index file that maps installed packages to their modules;
78+
secondly, the local Spack instance must add a ``modules`` entry to the
79+
configuration:
80+
81+
.. code-block:: yaml
82+
83+
config:
84+
upstreams:
85+
spack-instance-1:
86+
install_tree: /path/to/other/spack/opt/spack
87+
modules:
88+
tcl: /path/to/other/spack/share/spack/modules
89+
90+
Each time new packages are installed in the upstream Spack instance, the
91+
upstream Spack maintainer should run ``spack module tcl refresh`` (or the
92+
corresponding command for the type of module they intend to use).
93+
94+
.. note::
95+
96+
Spack can generate modules that :ref:`automatically load
97+
<autoloading-dependencies>` the modules of dependency packages. Spack cannot
98+
currently do this for modules in upstream packages.

lib/spack/docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ or refer to the full manual below.
7171
binary_caches
7272
command_index
7373
package_list
74+
chain
7475

7576
.. toctree::
7677
:maxdepth: 2

lib/spack/docs/module_file_support.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,9 @@ The configuration above will generate dotkit module files that will not contain
600600
modifications to either ``CPATH`` or ``LIBRARY_PATH`` and environment module
601601
files that instead will contain these modifications.
602602

603+
604+
.. _autoloading-dependencies:
605+
603606
"""""""""""""""""""""
604607
Autoload dependencies
605608
"""""""""""""""""""""

0 commit comments

Comments
 (0)
X Tutup