- Update to version v0.23.0. This is a major release.
* Features in this Release + Spec splicing To make binary installation more seamless in Spack, `v0.23` introduces "splicing", which allows users to deploy binaries using local, optimized versions of a binary interface, even if they were not built with that interface. For example, this would allow you to build binaries in the cloud using `mpich` and install them on a system using a local, optimized version of `mvapich2` *without rebuilding*. Spack preserves full provenance for the installed packages and knows that they were built one way but deployed another. The intent is to leverage this across many key HPC binary packages, e.g. MPI, CUDA, ROCm, and libfabric. Fundamentally, splicing allows Spack to redeploy an existing spec with different dependencies than how it was built. There are two interfaces to splicing. a. Explicit Splicing In the concretizer config, you can specify a target spec and a replacement by hash. ```yaml concretizer: splice: explicit: - target: mpi replacement: mpich/abcdef ``` Here, every installation that would normally use the target spec will instead use its replacement. Above, any spec using *any* `mpi` will be spliced to depend on the specific `mpich` OBS-URL: https://build.opensuse.org/package/show/network:cluster/spack?expand=0&rev=111
This commit is contained in:
commit
56ffc9a15e
25
.gitattributes
vendored
Normal file
25
.gitattributes
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
## Specific LFS patterns
|
||||
objects.inv filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
@ -0,0 +1,156 @@
|
||||
From 360dd5abda2e7f14c87ace831ff4c9756c9d0444 Mon Sep 17 00:00:00 2001
|
||||
From: Egbert Eich <eich@suse.com>
|
||||
Date: Wed, 10 Nov 2021 13:01:17 +0100
|
||||
Subject: [PATCH] Adapt shell scripts that set up the environment for different
|
||||
shells
|
||||
|
||||
Signed-off-by: Egbert Eich <eich@suse.com>
|
||||
Signed-off-by: Egbert Eich <eich@suse.de>
|
||||
---
|
||||
share/spack/setup-env.csh | 5 +++-
|
||||
share/spack/setup-env.fish | 15 +---------
|
||||
share/spack/setup-env.sh | 61 ++------------------------------------
|
||||
3 files changed, 7 insertions(+), 74 deletions(-)
|
||||
|
||||
diff --git a/share/spack/setup-env.csh b/share/spack/setup-env.csh
|
||||
index ad20d346d1..91c48ecae9 100755
|
||||
--- a/share/spack/setup-env.csh
|
||||
+++ b/share/spack/setup-env.csh
|
||||
@@ -12,6 +12,10 @@
|
||||
#
|
||||
|
||||
# prevent infinite recursion when spack shells out (e.g., on cray for modules)
|
||||
+if ($?SPACK_ROOT == 0) then
|
||||
+ setenv SPACK_ROOT = @@_prefix@@
|
||||
+endif
|
||||
+
|
||||
if ($?_sp_initializing) then
|
||||
exit 0
|
||||
endif
|
||||
@@ -71,7 +75,6 @@ foreach cmd ("$SPACK_PYTHON" python3 python python2)
|
||||
end
|
||||
|
||||
# Set variables needed by this script
|
||||
-_spack_pathadd PATH "$SPACK_ROOT/bin"
|
||||
eval `spack --print-shell-vars csh`
|
||||
|
||||
# Set up module search paths in the user environment
|
||||
diff --git a/share/spack/setup-env.fish b/share/spack/setup-env.fish
|
||||
index e00d8e76bb..961ec39015 100755
|
||||
--- a/share/spack/setup-env.fish
|
||||
+++ b/share/spack/setup-env.fish
|
||||
@@ -671,12 +671,6 @@ end
|
||||
|
||||
|
||||
|
||||
-#
|
||||
-# Figure out where this file is. Below code only needs to work in fish
|
||||
-#
|
||||
-set -l sp_source_file (status -f) # name of current file
|
||||
-
|
||||
-
|
||||
|
||||
#
|
||||
# Identify and lock the python interpreter
|
||||
@@ -691,14 +685,7 @@ end
|
||||
|
||||
|
||||
|
||||
-#
|
||||
-# Find root directory and add bin to path.
|
||||
-#
|
||||
-set -l sp_share_dir (realpath (dirname $sp_source_file))
|
||||
-set -l sp_prefix (realpath (dirname (dirname $sp_share_dir)))
|
||||
-spack_pathadd PATH "$sp_prefix/bin"
|
||||
-set -xg SPACK_ROOT $sp_prefix
|
||||
-
|
||||
+set -xg SPACK_ROOT @@_prefix@@
|
||||
|
||||
|
||||
#
|
||||
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
|
||||
index d3a97d9af6..45195fb36f 100755
|
||||
--- a/share/spack/setup-env.sh
|
||||
+++ b/share/spack/setup-env.sh
|
||||
@@ -249,64 +249,6 @@ _sp_shell=$(_spack_determine_shell)
|
||||
|
||||
alias spacktivate="spack env activate"
|
||||
|
||||
-#
|
||||
-# Figure out where this file is.
|
||||
-#
|
||||
-if [ "$_sp_shell" = bash ]; then
|
||||
- _sp_source_file="${BASH_SOURCE[0]:-}"
|
||||
-elif [ "$_sp_shell" = zsh ]; then
|
||||
- _sp_source_file="${(%):-%N}"
|
||||
-else
|
||||
- # Try to read the /proc filesystem (works on linux without lsof)
|
||||
- # In dash, the sourced file is the last one opened (and it's kept open)
|
||||
- _sp_source_file_fd="$(\ls /proc/$$/fd 2>/dev/null | sort -n | tail -1)"
|
||||
- if ! _sp_source_file="$(readlink /proc/$$/fd/$_sp_source_file_fd)"; then
|
||||
- # Last resort: try lsof. This works in dash on macos -- same reason.
|
||||
- # macos has lsof installed by default; some linux containers don't.
|
||||
- _sp_lsof_output="$(lsof -p $$ -Fn0 | tail -1)"
|
||||
- _sp_source_file="${_sp_lsof_output#*n}"
|
||||
- fi
|
||||
-
|
||||
- # If we can't find this script's path after all that, bail out with
|
||||
- # plain old $0, which WILL NOT work if this is sourced indirectly.
|
||||
- if [ ! -f "$_sp_source_file" ]; then
|
||||
- _sp_source_file="$0"
|
||||
- fi
|
||||
-fi
|
||||
-
|
||||
-#
|
||||
-# Find root directory and add bin to path.
|
||||
-#
|
||||
-# We send cd output to /dev/null to avoid because a lot of users set up
|
||||
-# their shell so that cd prints things out to the tty.
|
||||
-if [ "$_sp_shell" = zsh ]; then
|
||||
- _sp_share_dir="${_sp_source_file:A:h}"
|
||||
- _sp_prefix="${_sp_share_dir:h:h}"
|
||||
-else
|
||||
- _sp_share_dir="$(cd "$(dirname $_sp_source_file)" > /dev/null && pwd)"
|
||||
- _sp_prefix="$(cd "$(dirname $(dirname $_sp_share_dir))" > /dev/null && pwd)"
|
||||
-fi
|
||||
-if [ -x "$_sp_prefix/bin/spack" ]; then
|
||||
- export SPACK_ROOT="${_sp_prefix}"
|
||||
-else
|
||||
- # If the shell couldn't find the sourced script, fall back to
|
||||
- # whatever the user set SPACK_ROOT to.
|
||||
- if [ -n "$SPACK_ROOT" ]; then
|
||||
- _sp_prefix="$SPACK_ROOT"
|
||||
- _sp_share_dir="$_sp_prefix/share/spack"
|
||||
- fi
|
||||
-
|
||||
- # If SPACK_ROOT didn't work, fail. We should need this rarely, as
|
||||
- # the tricks above for finding the sourced file are pretty robust.
|
||||
- if [ ! -x "$_sp_prefix/bin/spack" ]; then
|
||||
- echo "==> Error: SPACK_ROOT must point to spack's prefix when using $_sp_shell"
|
||||
- echo "Run this with the correct prefix before sourcing setup-env.sh:"
|
||||
- echo " export SPACK_ROOT=</path/to/spack>"
|
||||
- return 1
|
||||
- fi
|
||||
-fi
|
||||
-_spack_pathadd PATH "${_sp_prefix%/}/bin"
|
||||
-
|
||||
#
|
||||
# Check whether a function of the given name is defined
|
||||
#
|
||||
@@ -387,11 +329,12 @@ if [ -z "${SPACK_SKIP_MODULES+x}" ]; then
|
||||
}
|
||||
_sp_multi_pathadd MODULEPATH "$_sp_tcl_roots"
|
||||
fi
|
||||
+export SPACK_ROOT=@@_prefix@@
|
||||
|
||||
# Add programmable tab completion for Bash
|
||||
#
|
||||
if test "$_sp_shell" = bash || test -n "${ZSH_VERSION:-}"; then
|
||||
- source $_sp_share_dir/spack-completion.bash
|
||||
+ source $SPACK_ROOT/share/spack/spack-completion.bash
|
||||
fi
|
||||
|
||||
# done: unset sentinel variable as we're no longer initializing
|
||||
--
|
||||
2.40.1
|
||||
|
@ -0,0 +1,37 @@
|
||||
From 6bb3cfbfe614556b3a24fb832bf672b5b2352f3b Mon Sep 17 00:00:00 2001
|
||||
From: Egbert Eich <eich@suse.com>
|
||||
Date: Wed, 12 Jan 2022 13:51:57 +0100
|
||||
Subject: [PATCH] Add support for container building using a SLE base container
|
||||
|
||||
Signed-off-by: Egbert Eich <eich@suse.com>
|
||||
---
|
||||
lib/spack/spack/container/images.json | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
diff --git a/lib/spack/spack/container/images.json b/lib/spack/spack/container/images.json
|
||||
index 296658fe5e..a8be14610c 100644
|
||||
--- a/lib/spack/spack/container/images.json
|
||||
+++ b/lib/spack/spack/container/images.json
|
||||
@@ -133,6 +133,19 @@
|
||||
"image": "opensuse/leap:latest"
|
||||
}
|
||||
},
|
||||
+ "suse/sle:15": {
|
||||
+ "bootstrap": {
|
||||
+ "template": "container/sle15.dockerfile"
|
||||
+ },
|
||||
+ "os_package_manager": "zypper",
|
||||
+ "build": "spack/leap15",
|
||||
+ "build_tags": {
|
||||
+ "develop": "latest"
|
||||
+ },
|
||||
+ "final": {
|
||||
+ "image": "registry.suse.com/suse/sle15:latest"
|
||||
+ }
|
||||
+ },
|
||||
"nvidia/cuda:11.2.1": {
|
||||
"bootstrap": {
|
||||
"template": "container/cuda_11_2_1.dockerfile",
|
||||
--
|
||||
2.40.1
|
||||
|
35
Fix-Spinx-configuration-to-avoid-throwing-errors.patch
Normal file
35
Fix-Spinx-configuration-to-avoid-throwing-errors.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 223f11bab87c9f5915ef7146b26d0935c7ff18e3 Mon Sep 17 00:00:00 2001
|
||||
From: Egbert Eich <eich@suse.com>
|
||||
Date: Wed, 10 Nov 2021 16:30:14 +0100
|
||||
Subject: [PATCH] Fix Spinx configuration to avoid throwing errors
|
||||
|
||||
- Ignore certain variables
|
||||
- Don't attempt downloading ntersphinx inventory
|
||||
|
||||
Signed-off-by: Egbert Eich <eich@suse.com>
|
||||
Signed-off-by: Egbert Eich <eich@suse.de>
|
||||
---
|
||||
lib/spack/docs/conf.py | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py
|
||||
index 8ba6717147..521511db2f 100644
|
||||
--- a/lib/spack/docs/conf.py
|
||||
+++ b/lib/spack/docs/conf.py
|
||||
@@ -133,7 +133,6 @@ def setup(sphinx):
|
||||
"sphinx.ext.napoleon",
|
||||
"sphinx.ext.todo",
|
||||
"sphinx.ext.viewcode",
|
||||
- "sphinx_design",
|
||||
"sphinxcontrib.programoutput",
|
||||
]
|
||||
|
||||
@@ -418,4 +417,4 @@ class SpackStyle(DefaultStyle):
|
||||
# -- Extension configuration -------------------------------------------------
|
||||
|
||||
# sphinx.ext.intersphinx
|
||||
-intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
|
||||
+intersphinx_mapping = {"python": ("https://docs.python.org/3", "objects.inv")}
|
||||
--
|
||||
2.40.1
|
||||
|
@ -0,0 +1,27 @@
|
||||
From c24349cb54442da8e49fd40a299453e56b404a90 Mon Sep 17 00:00:00 2001
|
||||
From: Egbert Eich <eich@suse.com>
|
||||
Date: Thu, 7 Apr 2022 20:25:46 +0200
|
||||
Subject: [PATCH] Fix error during documentation build due to recursive module
|
||||
inclusion
|
||||
|
||||
Signed-off-by: Egbert Eich <eich@suse.com>
|
||||
Signed-off-by: Egbert Eich <eich@suse.de>
|
||||
---
|
||||
lib/spack/spack/environment/environment.py | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
Index: spack-0.20.3/lib/spack/spack/environment/environment.py
|
||||
===================================================================
|
||||
--- spack-0.20.3.orig/lib/spack/spack/environment/environment.py
|
||||
+++ spack-0.20.3/lib/spack/spack/environment/environment.py
|
||||
@@ -40,6 +40,10 @@ import spack.stage
|
||||
import spack.store
|
||||
import spack.subprocess_context
|
||||
import spack.user_environment as uenv
|
||||
+try:
|
||||
+ import spack.user_environment as uenv
|
||||
+except AttributeError:
|
||||
+ pass
|
||||
import spack.util.cpus
|
||||
import spack.util.environment
|
||||
import spack.util.hash
|
48
Make-spack-paths-compliant-to-distro-installation.patch
Normal file
48
Make-spack-paths-compliant-to-distro-installation.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From a91079b55fa90142d9de03ffe219812a26937959 Mon Sep 17 00:00:00 2001
|
||||
From: Egbert Eich <eich@suse.com>
|
||||
Date: Wed, 11 Jan 2023 14:30:19 +0100
|
||||
Subject: [PATCH] Make spack paths compliant to distro installation
|
||||
|
||||
Spack is particular about the choice of 'prefix' which will
|
||||
replace $spack. 'prefix' is the 4th ancestor of paths.py, so
|
||||
it is relative to the spack installation.
|
||||
This will only change the coded setups of
|
||||
var_path -> /var/lib/spack
|
||||
opt_path -> /opt/spack
|
||||
repo_path -> /usr/share/spack/repos
|
||||
|
||||
Signed-off-by: Egbert Eich <eich@suse.com>
|
||||
Signed-off-by: Egbert Eich <eich@suse.de>
|
||||
---
|
||||
lib/spack/spack/paths.py | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/spack/spack/paths.py b/lib/spack/spack/paths.py
|
||||
index 18656b76c2..f0e9cb587c 100644
|
||||
--- a/lib/spack/spack/paths.py
|
||||
+++ b/lib/spack/spack/paths.py
|
||||
@@ -41,7 +41,7 @@
|
||||
operating_system_path = os.path.join(module_path, "operating_systems")
|
||||
test_path = os.path.join(module_path, "test")
|
||||
hooks_path = os.path.join(module_path, "hooks")
|
||||
-opt_path = os.path.join(prefix, "opt")
|
||||
+opt_path = os.path.join("/", "opt")
|
||||
share_path = os.path.join(prefix, "share", "spack")
|
||||
etc_path = os.path.join(prefix, "etc", "spack")
|
||||
|
||||
@@ -53,10 +53,10 @@
|
||||
#
|
||||
# Things in $spack/var/spack
|
||||
#
|
||||
-var_path = os.path.join(prefix, "var", "spack")
|
||||
+var_path = os.path.join("/", "var", "lib", "spack")
|
||||
|
||||
# read-only things in $spack/var/spack
|
||||
-repos_path = os.path.join(var_path, "repos")
|
||||
+repos_path = os.path.join(share_path, "repos")
|
||||
packages_path = os.path.join(repos_path, "builtin")
|
||||
mock_packages_path = os.path.join(repos_path, "builtin.mock")
|
||||
|
||||
--
|
||||
2.40.1
|
||||
|
46
Move-site-config-scope-before-system-scope.patch
Normal file
46
Move-site-config-scope-before-system-scope.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From: Egbert Eich <eich@suse.com>
|
||||
Date: Thu May 16 18:34:42 2024 +0200
|
||||
Subject: Move 'site' config scope before 'system' scope
|
||||
Patch-mainline: Not yet
|
||||
Git-commit: 55febdb317328ac0e60cb486eac27fe1371cf120
|
||||
References:
|
||||
|
||||
For spack, the 'site' scope if meant for the Spack installation
|
||||
which a system may have multiple of. Therefore, it lives in
|
||||
the Spack installation it is meant for. It should override the
|
||||
'system-wide' settings from the 'system' scope which is usually
|
||||
located in /etc/spack.
|
||||
Our Spack package is meant to be system wide, the site scope
|
||||
will therefore host vendor provided or generated configs which
|
||||
a local admin should therefore be able to override.
|
||||
It must therefore have a lower priority that the system scope.
|
||||
|
||||
Signed-off-by: Egbert Eich <eich@suse.com>
|
||||
Signed-off-by: Egbert Eich <eich@suse.de>
|
||||
---
|
||||
lib/spack/spack/config.py | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py
|
||||
index 2a2f180f..3eac8542 100644
|
||||
--- a/lib/spack/spack/config.py
|
||||
+++ b/lib/spack/spack/config.py
|
||||
@@ -832,15 +832,15 @@ def create() -> Configuration:
|
||||
|
||||
disable_local_config = "SPACK_DISABLE_LOCAL_CONFIG" in os.environ
|
||||
|
||||
+ # Site configuration is per spack instance, for sites or projects
|
||||
+ # No site-level configs should be checked into spack by default.
|
||||
+ configuration_paths.append(("site", os.path.join(spack.paths.etc_path)))
|
||||
+
|
||||
# System configuration is per machine.
|
||||
# This is disabled if user asks for no local configuration.
|
||||
if not disable_local_config:
|
||||
configuration_paths.append(("system", spack.paths.system_config_path))
|
||||
|
||||
- # Site configuration is per spack instance, for sites or projects
|
||||
- # No site-level configs should be checked into spack by default.
|
||||
- configuration_paths.append(("site", os.path.join(spack.paths.etc_path)))
|
||||
-
|
||||
# Python package's can register configuration scopes via entry_points
|
||||
configuration_paths.extend(config_paths_from_entry_points())
|
||||
|
116
README-oo-wiki
Normal file
116
README-oo-wiki
Normal file
@ -0,0 +1,116 @@
|
||||
spack ([https://github.com/spack/spack https://github.com/spack/spack]) is a tool to compile HPC software and its dependencies.
|
||||
The compiled software is available as environment [[modules]], so that several versions an application can coexist.
|
||||
Most relevant CPU architectures are detected and the compiled software is automatically optimized to it.
|
||||
|
||||
For openSUSE Leap, Tumbelweed and SLES a [https://build.opensuse.org/package/show/network:cluster/spack system package] is available which has the advantage that it installs all necessary dependencies and makes core tools available for ''spack''. Other system packages which are also relevant for ''spack'' will also be added to the ''spack'' configuration after installation.
|
||||
|
||||
Additionally ''spack'' behaves differently when called as ''root'' as when its called as normal user. All the packages which are build as ''root'' user are available for all users of the system, whereas the packages build as normal user, are only available for this user.
|
||||
|
||||
== Quick Start ==
|
||||
''spack'' can be installed with
|
||||
|
||||
sudo zypper install spack
|
||||
|
||||
In order to load all relevant environment variables one should relogin and source the ''spack'' environment with
|
||||
|
||||
source /usr/share/spack/setup-env.sh
|
||||
|
||||
The installation can be checked with the command
|
||||
|
||||
spack spec netcdf-c
|
||||
|
||||
which shows all the packages which will be installed in order to compile ''netccdf-c'' from its sources. The circumeflex '^' in the output indicates the dependency on a specific package and can be changed on the command line. For example
|
||||
|
||||
spack spec netcdf-c^mpich
|
||||
|
||||
will display all the packages which are needed to build ''netcdf-c'' not with ''openmpi'' which is the default, but with ''mpich''.
|
||||
|
||||
The installation of the package can now be done with
|
||||
|
||||
spack install netcdf-c^mpich
|
||||
|
||||
which builds and installs the package with all its needed dependencies.
|
||||
The resulting package can be used/loaded with the command
|
||||
|
||||
spack load netcdf-c@4.7.4
|
||||
|
||||
or by using environment modules with
|
||||
|
||||
module load netcdf-c-4.7.4-gcc-11.1.1-tlfohef
|
||||
|
||||
where the exact name of the module can be displayed with
|
||||
|
||||
module av
|
||||
|
||||
== SUSE package ==
|
||||
There are a few differences between the SUSE package and the standard installation.
|
||||
# When a user can write to ''/usr/lib/spack'', the packages and generated modules are stored under that location. This holds true if the user is ''root'' or in the ''spack'' group. The generated modules are installed under ''/usr/share/spack/modules/linux-<distribution>-<arch>''
|
||||
# external packages, like ''M4'' or ''autoconf'' are detected at installtion time of ''spack'', but also when a relevant package is installed, like a new ''gcc'' version
|
||||
== Package search and information==
|
||||
The installed packages installed with ''spack'' can be displayed with
|
||||
|
||||
spack find
|
||||
|
||||
and '''all''' available packages with the command
|
||||
|
||||
spack list [regexp]
|
||||
|
||||
Detailed information about a package can be obtained with the command
|
||||
|
||||
spack info <packagename>
|
||||
|
||||
which will print all versions and options for building the package.
|
||||
|
||||
== Package building ==
|
||||
|
||||
Package compilation and installation is done with the 'install' command. But its advisable to list all the dependency of package with command 'spec' beforehand. So the command
|
||||
|
||||
spack install/spec <package-name>
|
||||
|
||||
will install/list all the packages needed for <package-name>.
|
||||
The package version can be set with '@'
|
||||
|
||||
spack install/spec <package-name>@<version>
|
||||
|
||||
and the compile can be set with '%'
|
||||
|
||||
spack install/spec <package-name>@<version>%gcc@7.5.0
|
||||
|
||||
will build the package with 'gcc7'.
|
||||
Binary build and install options for a package are enabled with '+' and disabled with '~'.
|
||||
The build dependencies are set with '^'.
|
||||
|
||||
=== Examples ===
|
||||
hdf5 hdf5 configuration, when used as depdency
|
||||
hdf5 @1.10.1 hdf5 version 1.10.1
|
||||
hdf5 @1.8: hdf5 1.8 or higher
|
||||
hdf5 @1.8: %gcc hdf5 1.8 or higher built with gcc
|
||||
hdf5 +mpi hdf5 with mpi enabled
|
||||
hdf5 ~mpi hdf5 with mpi disabled
|
||||
hdf5 +mpi ^mpich hdf5 with mpi, using mpich
|
||||
hdf5 +mpi ^openmpi@1.7 hdf5 with mpi, using openmpi 1.7
|
||||
boxlib dim=2 boxlib built for 2 dimensions
|
||||
libdwarf %intel ^libelf%gcc
|
||||
libdwarf, built with intel compiler, linked to libelf built with gcc
|
||||
mvapich2 %gcc fabrics=psm,mrail,sock
|
||||
mvapich2, built with gcc compiler, with support for multiple fabrics, default version
|
||||
|
||||
== Compiler ==
|
||||
|
||||
Compilers are not treated as normal dependency, so that one must enforce the use a specific compiler with '%' and not with '^' like a normal dependency.
|
||||
The compilers which can be use by 'spack' can be listed with
|
||||
|
||||
spack compiler list
|
||||
|
||||
When a new compiler is installed or compiled with spack it has to be made known to ''spack'' with the command
|
||||
|
||||
spack compiler find
|
||||
|
||||
Please not that the compiler must be within ''$PATH'', so when the compiler was build with ''spack'', the module has to be loaded before the ''find'' command
|
||||
|
||||
== External programms ==
|
||||
External programs like ''autoconf'', ''cmake'' can be found by ''spack'' with the command
|
||||
|
||||
spack external find
|
||||
|
||||
The external find is executed by ''rpm'' when ''spack'' is installed or a new relevant package is installed.
|
21
README.SUSE
Normal file
21
README.SUSE
Normal file
@ -0,0 +1,21 @@
|
||||
openSUSE/SUSE specific Settings =============================================
|
||||
|
||||
The packages build by a regular user are stored in the home directory and so
|
||||
only available for this user. When the packages should be available for all
|
||||
users on a system, the user who builds the packages, must be able to write to
|
||||
the global spack user directories under /usr/lib/spack/ Packages stored under
|
||||
this path are available for all user via lmod.
|
||||
|
||||
To add a user to the group spack so that he can write to the global spack
|
||||
directory, execute (as root):
|
||||
|
||||
# usermod -a -G spack <user_login>
|
||||
|
||||
and change the setting for 'install_tree:' to the global spack directory in the
|
||||
configuration '~/.spack/config.yaml' for this user.
|
||||
|
||||
|
||||
NOTE:
|
||||
|
||||
As the recipes are contributed by the spack community and rely also on external
|
||||
packages, a signification part of the recipes may fail to create packages.
|
28
Set-modules-default-to-lmod.patch
Normal file
28
Set-modules-default-to-lmod.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From 1e351fa2c0f93ad119d4e5c61ea4307b9522c22e Mon Sep 17 00:00:00 2001
|
||||
From: Egbert Eich <eich@suse.com>
|
||||
Date: Wed, 10 Nov 2021 20:28:29 +0100
|
||||
Subject: [PATCH] Set modules default to lmod
|
||||
|
||||
Signed-off-by: Egbert Eich <eich@suse.com>
|
||||
Signed-off-by: Egbert Eich <eich@suse.de>
|
||||
---
|
||||
etc/spack/defaults/modules.yaml | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/etc/spack/defaults/modules.yaml b/etc/spack/defaults/modules.yaml
|
||||
index 75ec366117..16212b4e9b 100644
|
||||
--- a/etc/spack/defaults/modules.yaml
|
||||
+++ b/etc/spack/defaults/modules.yaml
|
||||
@@ -41,7 +41,8 @@ modules:
|
||||
tcl: $spack/share/spack/modules
|
||||
lmod: $spack/share/spack/lmod
|
||||
# What type of modules to use ("tcl" and/or "lmod")
|
||||
- enable: []
|
||||
+ enable:
|
||||
+ - lmod
|
||||
|
||||
tcl:
|
||||
all:
|
||||
--
|
||||
2.40.1
|
||||
|
11
_constraints
Normal file
11
_constraints
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<constraints>
|
||||
<hardware>
|
||||
<memory>
|
||||
<size unit="G">8</size>
|
||||
</memory>
|
||||
<disk>
|
||||
<size unit="G">8</size>
|
||||
</disk>
|
||||
</hardware>
|
||||
</constraints>
|
3
_multibuild
Normal file
3
_multibuild
Normal file
@ -0,0 +1,3 @@
|
||||
<multibuild>
|
||||
<package>doc</package>
|
||||
</multibuild>
|
69
added-target-and-os-calls-to-output-of-spack-spec-co.patch
Normal file
69
added-target-and-os-calls-to-output-of-spack-spec-co.patch
Normal file
@ -0,0 +1,69 @@
|
||||
From 1221c1f6b68cbba3a14592a686aec742b5fd02d2 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Goll <cgoll@suse.de>
|
||||
Date: Fri, 11 Dec 2020 15:37:48 +0100
|
||||
Subject: [PATCH] added target and os calls to output of spack spec commands
|
||||
|
||||
---
|
||||
lib/spack/docs/developer_guide.rst | 2 +-
|
||||
lib/spack/docs/getting_started.rst | 2 +-
|
||||
lib/spack/docs/packaging_guide.rst | 6 +++---
|
||||
3 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/lib/spack/docs/developer_guide.rst b/lib/spack/docs/developer_guide.rst
|
||||
index 4dc8d1249d..42b67425ab 100644
|
||||
--- a/lib/spack/docs/developer_guide.rst
|
||||
+++ b/lib/spack/docs/developer_guide.rst
|
||||
@@ -758,7 +758,7 @@ supply ``--profile`` to Spack on the command line, before any subcommands.
|
||||
|
||||
``spack --profile`` output looks like this:
|
||||
|
||||
-.. command-output:: spack --profile graph hdf5
|
||||
+.. command-output:: spack --profile graph hdf5 os=SUSE target=x86_64
|
||||
:ellipsis: 25
|
||||
|
||||
The bottom of the output shows the top most time consuming functions,
|
||||
diff --git a/lib/spack/docs/getting_started.rst b/lib/spack/docs/getting_started.rst
|
||||
index 3c077490a2..0a0a0d0913 100644
|
||||
--- a/lib/spack/docs/getting_started.rst
|
||||
+++ b/lib/spack/docs/getting_started.rst
|
||||
@@ -204,7 +204,7 @@ Check Installation
|
||||
With Spack installed, you should be able to run some basic Spack
|
||||
commands. For example:
|
||||
|
||||
-.. command-output:: spack spec netcdf-c
|
||||
+.. command-output:: spack spec netcdf-c target=x86_64 os=SUSE
|
||||
|
||||
In theory, Spack doesn't need any additional installation; just
|
||||
download and run! But in real life, additional steps are usually
|
||||
diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst
|
||||
index 586fdcec6e..1a7e23c426 100644
|
||||
--- a/lib/spack/docs/packaging_guide.rst
|
||||
+++ b/lib/spack/docs/packaging_guide.rst
|
||||
@@ -6382,13 +6382,13 @@ Spack provides the ``spack graph`` command for graphing dependencies.
|
||||
The command by default generates an ASCII rendering of a spec's
|
||||
dependency graph. For example:
|
||||
|
||||
-.. command-output:: spack graph hdf5
|
||||
+.. command-output:: spack graph hdf5 target=x86_64 os=SUSE
|
||||
|
||||
At the top is the root package in the DAG, with dependency edges emerging
|
||||
from it. On a color terminal, the edges are colored by which dependency
|
||||
they lead to.
|
||||
|
||||
-.. command-output:: spack graph --deptype=link hdf5
|
||||
+.. command-output:: spack graph --deptype=link hdf5 target=x86_64 os=SUSE
|
||||
|
||||
The ``deptype`` argument tells Spack what types of dependencies to graph.
|
||||
By default it includes link and run dependencies but not build
|
||||
@@ -6403,7 +6403,7 @@ dependencies. The default is ``--deptype=all``, which is equivalent to
|
||||
You can also use ``spack graph`` to generate graphs in the widely used
|
||||
`Dot <http://www.graphviz.org/doc/info/lang.html>`_ format. For example:
|
||||
|
||||
-.. command-output:: spack graph --dot hdf5
|
||||
+.. command-output:: spack graph --dot hdf5 target=x86_64 os=SUSE
|
||||
|
||||
This graph can be provided as input to other graphing tools, such as
|
||||
those in `Graphviz <http://www.graphviz.org>`_. If you have graphviz
|
||||
--
|
||||
2.40.1
|
||||
|
3
objects.inv
Normal file
3
objects.inv
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0b998c03bef7cf55e5250558c76a6c4b4f9d8d1d861ac3e46b34057c4bbda28f
|
||||
size 112726
|
96
run-find-external.sh.in
Normal file
96
run-find-external.sh.in
Normal file
@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
|
||||
scope=system
|
||||
what=$1
|
||||
|
||||
addpath() {
|
||||
path=$1
|
||||
shift
|
||||
while [ -n "$1" ]; do
|
||||
eval "${path}"=${1}:${!path}
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
find_packages() {
|
||||
if [ $scope = user ]; then
|
||||
# In case a packages.yaml is left in the system scope
|
||||
# from an old installation get it out of the way.
|
||||
if [ ! -e /usr/etc/spack/packages.yaml ]; then
|
||||
test -e /etc/spack/packages.yaml -a ! -e /etc/packages.yaml.rpmsave && \
|
||||
mv /etc/spack/packages.yaml /etc/spack/packages.yaml.rpmsave
|
||||
rm -f /etc/spack/packages.yaml
|
||||
fi
|
||||
test -e /usr/etc/spack/packages.yaml -a ! -e /usr/etc/packages.yaml.rpmsave && \
|
||||
mv /usr/etc/spack/packages.yaml /usr/etc/spack/packages.yaml.rpmsave
|
||||
# drop all root rights, when calling external find
|
||||
sudo -u nobody PATH=${mypath}:${PATH} spack external find --scope user --all #--exclude 'installdbgsymbols'
|
||||
if [ -e /var/lib/nobody/.spack/packages.yaml ] ; then
|
||||
chown root:root /var/lib/nobody/.spack/packages.yaml
|
||||
mv -v /var/lib/nobody/.spack/packages.yaml /usr/etc/spack/packages.yaml
|
||||
rm -rf /var/lib/nobody/.spack
|
||||
fi
|
||||
else
|
||||
# May run in a container...
|
||||
PATH=${mypath}:${PATH} spack external find --scope system --all #--exclude 'installdbgsymbols'
|
||||
fi
|
||||
test -e /usr/etc/spack/packages.yaml.rpmsave && \
|
||||
{ diff -q /usr/etc/spack/packages.yaml.rpmsave /usr/etc/spack/packages.yaml &> /dev/null && \
|
||||
rm /usr/etc/spack/packages.yaml.rpmsave; } || true
|
||||
}
|
||||
|
||||
find_compilers() {
|
||||
if [ $scope = user ]; then
|
||||
test -e /etc/spack/compilers.yaml \
|
||||
-a ! -e /etc/spack/compilers.yaml.rpmsave && \
|
||||
mv /etc/spack/compilers.yaml /etc/spack/compilers.yaml.rpmsave
|
||||
rm -f /etc/spack/compilers.yaml
|
||||
fi
|
||||
diff -q /etc/spack/compilers.yaml.rpmsave /etc/spack/compilers.yaml &> /dev/null \
|
||||
&& rm /etc/spack/compilers.yaml.rpmsave
|
||||
test -e /etc/spack/compilers.yaml.rpmsave && \
|
||||
echo -e "/etc/spack/compilers.yaml.rpmsave exists,\n"\
|
||||
" compilers are handled in /etc/spack/packages.yaml, now.\n"\
|
||||
" Please check files for compilers you may have added manually" || true
|
||||
}
|
||||
|
||||
if [ -e /etc/spack/no_rpm_trigger ] ; then
|
||||
exit 0
|
||||
fi
|
||||
if [ "x$(id -u)" != "x0" ] ; then
|
||||
echo "Must run as root, in order to copy back the configuration files and use sudo"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Create /etc/spack/no_rpm_trigger to stop spack to search for new packages after a rpm install"
|
||||
# save old packages.yml, it has to be removed as when not
|
||||
# the new and old packages.yaml files would have to be
|
||||
# combined
|
||||
|
||||
|
||||
# prepare the path
|
||||
shopt -s nullglob
|
||||
addpath mypath /usr/lib64/mpi/gcc/openmpi4/bin
|
||||
addpath mypath /usr/lib64/mpi/gcc/openmpi3/bin
|
||||
addpath mypath /usr/lib64/mpi/gcc/openmpi2/bin
|
||||
addpath mypath /usr/lib64/mpi/gcc/openmpi1/bin
|
||||
addpath mypath /usr/lib64/mpi/gcc/mvapich2/bin
|
||||
addpath mypath /usr/lib64/mpi/gcc/mpich/bin
|
||||
addpath mypath /usr/lib/hpc/gnu*/mpi/openmpi/[2-9].*/bin
|
||||
addpath mypath /usr/lib/hpc/gnu*/mpi/mpich/[3-9].*/bin
|
||||
addpath mypath /usr/lib/hpc/gnu*/mpi/mvapich2/[2-9].*/bin
|
||||
addpath cpath /usr/lib/hpc/compiler/gnu/*/bin
|
||||
|
||||
# test if we can run as nobody
|
||||
getent passwd nobody &> /dev/null
|
||||
if [ "x$?" == "x0" ] ; then
|
||||
scope=user
|
||||
fi
|
||||
|
||||
case $what in
|
||||
packages) find_packages $scope ;;
|
||||
compilers) find_compilers $scope ;;
|
||||
'') find_packages $scope
|
||||
find_compilers $scope ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
3
spack-0.22.0.tar.gz
Normal file
3
spack-0.22.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:81d0d25ba022d5a8b2f4852cefced92743fe0cae8c18a54e82bd0ec67ee96cac
|
||||
size 11101704
|
3
spack-0.22.1.tar.gz
Normal file
3
spack-0.22.1.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:374968461ea95fcf22f230aa818cf99cd79af4cd3d28fb0927d5444525b143b3
|
||||
size 11108002
|
3
spack-0.22.2.tar.gz
Normal file
3
spack-0.22.2.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:aef1a5ce16fe1a8bcced54c40012b19a0f4ade1cd9c5379aca081e96ec5b18ac
|
||||
size 11117111
|
3
spack-0.23.0.tar.gz
Normal file
3
spack-0.23.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ddb8220c46743e45c9484622370a1e17e193acba6a43230868c2dbc717e88b56
|
||||
size 11847230
|
27
spack-rpmlintrc
Normal file
27
spack-rpmlintrc
Normal file
@ -0,0 +1,27 @@
|
||||
# Fully intentional
|
||||
addFilter("hidden-file-or-dir /etc/skel/.spack")
|
||||
# These files are patches and not to be run directly
|
||||
addFilter("script-without-shebang")
|
||||
# These files are installed as part of the spack recipes
|
||||
# and shouldn't be in a devel package
|
||||
addFilter("devel-file-in-non-devel-package*")
|
||||
# The spack group needs to be added to the list of known groups
|
||||
addFilter("non-standard-group Unspecified")
|
||||
addFilter("non-standard-gid .* spack")
|
||||
# Spurious self-applying patches from an upstream source.
|
||||
# These are part of recipes and not intended to run as scripts.
|
||||
addFilter("non-executable-script /var/lib/spack/repos.*")
|
||||
# Spack is used for building other software, so when it finds e.g
|
||||
# the bzip binary it assumes that the devel libraries are also installed.
|
||||
# So ignore the warnings:
|
||||
addFilter("devel-dependency libbz2-devel")
|
||||
addFilter("explicit-lib-dependency libbz2-devel")
|
||||
# Non executible scripts are expected in recipes. These will be installed
|
||||
# with the final software that Spack builds.
|
||||
addFilter("spack-recipes.noarch: .* non-executable-script")
|
||||
# 3rd party modules - not used stand-alone
|
||||
addFilter(".* non-executable-script /usr/lib/spack/external/_vendoring")
|
||||
addFilter(".* non-executable-script /usr/share/spack/gitlab/cloud_pipelines/scripts/common/aggregate_package_logs.spack.py")
|
||||
# We need to test doc builds for SLE in OBS which depend in spack being built:
|
||||
# for this, we need to defeat the 'backport policy'.
|
||||
addFilter(".* E: SUSE_Backports_policy-SLE_conflict .*")
|
1362
spack.changes
Normal file
1362
spack.changes
Normal file
File diff suppressed because it is too large
Load Diff
544
spack.spec
Normal file
544
spack.spec
Normal file
@ -0,0 +1,544 @@
|
||||
#
|
||||
# spec file for package spack
|
||||
#
|
||||
# Copyright (c) 2025 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
%global flavor @BUILD_FLAVOR@%{?nil}
|
||||
%if "%{flavor}" == "doc"
|
||||
%bcond_without doc
|
||||
%endif
|
||||
|
||||
ExcludeArch: i586 %arm s390 s390x %power64 ppc
|
||||
|
||||
%if %{with doc} && (0%{?sle_version} > 0) && (150200 >= 0%{?sle_version})
|
||||
ExclusiveArch: do_not_build
|
||||
%endif
|
||||
|
||||
%define spack_dir %_prefix/lib/spack/
|
||||
%define spack_group spack
|
||||
# These packages are missing from a BCI-style base container but may
|
||||
# be used by Spack for building. To avoid unresolved libraries, make
|
||||
# sure these are installed in the runtime container.
|
||||
%if 0%{suse_version} == 1500
|
||||
%define spack_container_packages libgfortran4 libfl2 libzip5
|
||||
%else
|
||||
%if 0%{suse_version} > 1600
|
||||
%define spack_container_packages libgfortran5 libfl2 libzip5
|
||||
%endif
|
||||
%endif
|
||||
|
||||
# These packages are found and can be used by spack, %{_sysconfdir}/spack/packages-yaml
|
||||
# needs to be updated when one of these packages is updated or uninstalled.
|
||||
# Distinguish between packages we recommend and packages which
|
||||
%define spack_trigger_recommended_packages autoconf bash bison bzip2 libzip-devel cmake-full ccache cpio diffutils findutils flex git-lfs info make makeinfo m4 ncurses-devel libtool libcurl-devel libopenssl-devel perl-base pkgconf pkg-config python3-base tar xz xz-devel
|
||||
|
||||
%define spack_trigger_recommended_compilers gcc gcc-c++ gcc-fortran
|
||||
|
||||
# packages recognized by spack, but not recommended
|
||||
%define spack_trigger_packages ghostscript go fish fzf hwloc-devel hugo java-11-openjdk-devel java-14-openjdk-devel java-15-openjdk-devel java-16-openjdk-devel java-1_8_0-openjdk-devel ruby sqlite3 openmpi1-devel openmpi2-devel openmpi3-devel openmpi4-devel openmpi1-gnu-hpc-devel openmpi2-gnu-hpc-devel openmpi3-gnu-hpc-devel openmpi4-gnu-hpc-devel mpich-gnu-hpc-devel mvapich2-devel mpich-devel
|
||||
|
||||
%define spack_trigger_compilers gcc7 gcc8 gcc9 gcc10 gcc11 gcc12 gcc13 gcc7-c++ gcc8-c++ gcc9-c++ gcc10-c++ gcc11-c++ gcc12-c++ gcc13-c++ gcc7-fortran gcc8-fortran gcc9-fortran gcc10-fortran gcc11-fortran gcc12-fortran gcc13-fortran
|
||||
|
||||
# non oss packages
|
||||
%define spack_trigger_external cuda-nvcc
|
||||
|
||||
%if 0%{?sle_version} <= 120500 && !0%{?is_opensuse}
|
||||
%define __python3 python3
|
||||
%endif
|
||||
|
||||
%define mypyver 3
|
||||
%define mypython python%{?mypyver}
|
||||
|
||||
Name: spack
|
||||
Version: 0.23.0
|
||||
Release: 0
|
||||
Summary: Package manager for HPC systems
|
||||
License: Apache-2.0 AND MIT AND Python-2.0 AND BSD-3-Clause
|
||||
URL: https://spack.io
|
||||
Source0: https://github.com/spack/spack/archive/v%{version}.tar.gz#/spack-%{version}.tar.gz
|
||||
Source1: README.SUSE
|
||||
Source2: spack-rpmlintrc
|
||||
Source3: run-find-external.sh.in
|
||||
# without `--header "Accept-Language: en" en.opensuse.org returns 406
|
||||
#Source4: https://en.opensuse.org/index.php?title=Spack&action=raw&ref=157522#/README-oo-wiki
|
||||
Source4: README-oo-wiki
|
||||
# Source5 is from https://docs.python.org/3/objects.inv, but has permanent changes so using a static version
|
||||
Source5: objects.inv
|
||||
Source6: spack_get_libs.sh
|
||||
Patch2: Adapt-shell-scripts-that-set-up-the-environment-for-different-shells.patch
|
||||
Patch4: added-target-and-os-calls-to-output-of-spack-spec-co.patch
|
||||
Patch5: Make-spack-paths-compliant-to-distro-installation.patch
|
||||
Patch7: Fix-Spinx-configuration-to-avoid-throwing-errors.patch
|
||||
Patch8: Set-modules-default-to-lmod.patch
|
||||
Patch9: Add-support-for-container-building-using-a-SLE-base-container.patch
|
||||
Patch10: Move-site-config-scope-before-system-scope.patch
|
||||
%if %{without doc}
|
||||
BuildRequires: %{mypython}-urllib3
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: lua-lmod
|
||||
BuildRequires: polkit
|
||||
BuildRequires: sudo
|
||||
BuildRequires: sysuser-tools
|
||||
Requires: %{mypython}-clingo
|
||||
Requires: %{name}-recipes = %{version}
|
||||
Requires: awk
|
||||
Requires: bzip2
|
||||
Requires: coreutils
|
||||
Requires: curl
|
||||
Requires: gcc-c++
|
||||
Requires: gcc-fortran
|
||||
Requires: git
|
||||
Requires: gpg2
|
||||
Requires: gzip
|
||||
Requires: libbz2-devel
|
||||
Requires: lsb-release
|
||||
Requires: make
|
||||
Requires: patch
|
||||
Requires: polkit
|
||||
Requires: sudo
|
||||
Requires: system-user-nobody
|
||||
Requires: tar
|
||||
Requires: unzip
|
||||
Requires: xz
|
||||
Requires: zstd
|
||||
Requires: (patchelf if (product(SUSE_SLE) >= 15.6 or product(Leap) or product(openSUSE)))
|
||||
Recommends: %spack_trigger_recommended_packages %spack_trigger_recommended_compilers
|
||||
Recommends: lua-lmod
|
||||
Recommends: patchelf
|
||||
Requires: (hwloc if hwloc-devel)
|
||||
Requires: (hwloc-devel if hwloc)
|
||||
%else
|
||||
BuildRequires: git
|
||||
BuildRequires: makeinfo
|
||||
# Hardcode this - there is no python2 version of this around any more.
|
||||
BuildRequires: %{mypython}-Sphinx >= 3.4
|
||||
BuildRequires: %{mypython}-sphinxcontrib-programoutput
|
||||
BuildRequires: spack
|
||||
# html
|
||||
BuildRequires: graphviz
|
||||
# info
|
||||
BuildRequires: graphviz-gnome
|
||||
## pdf
|
||||
# BuildRequires: %{mypython}-Sphinx-latex
|
||||
Recommends: spack
|
||||
%endif
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
Spack is a configurable Python-based HPC package manager, automating
|
||||
the installation and fine-tuning of simulations and libraries.
|
||||
It operates on a wide variety of HPC platforms and enables users
|
||||
to build many code configurations. Software installed by Spack
|
||||
runs correctly regardless of environment, and file management
|
||||
is streamlined. Spack can install many variants of the same build
|
||||
using different compilers, options, and MPI implementations.
|
||||
|
||||
This package provides a module file that must be loaded to use spack.
|
||||
|
||||
%package recipes
|
||||
Summary: Spack built-in package recipes
|
||||
Requires: %{name} = %version
|
||||
|
||||
%description recipes
|
||||
Spack is a configurable Python-based HPC package manager, automating
|
||||
the installation and fine-tuning of simulations and libraries.
|
||||
It operates on a wide variety of HPC platforms and enables users
|
||||
to build many code configurations. Software installed by Spack
|
||||
runs correctly regardless of environment, and file management
|
||||
is streamlined. Spack can install many variants of the same build
|
||||
using different compilers, options, and MPI implementations.
|
||||
|
||||
This package contains the built-in package recipes.
|
||||
|
||||
%package man
|
||||
Summary: Man Page for Spack - Package manager for HPC systems
|
||||
Requires: man
|
||||
|
||||
%description man
|
||||
Spack is a configurable Python-based HPC package manager, automating
|
||||
the installation and fine-tuning of simulations and libraries.
|
||||
It operates on a wide variety of HPC platforms and enables users
|
||||
to build many code configurations. Software installed by Spack
|
||||
runs correctly regardless of environment, and file management
|
||||
is streamlined. Spack can install many variants of the same build
|
||||
using different compilers, options, and MPI implementations.
|
||||
|
||||
This package contains the man page.
|
||||
|
||||
%package info
|
||||
Summary: Info Page for Spack - Package manager for HPC systems
|
||||
Requires: info
|
||||
%if 0%{?suse_version} <= 1500
|
||||
Requires(post): %{install_info_prereq}
|
||||
Requires(pre): %{install_info_prereq}
|
||||
%endif
|
||||
|
||||
%description info
|
||||
Spack is a configurable Python-based HPC package manager, automating
|
||||
the installation and fine-tuning of simulations and libraries.
|
||||
It operates on a wide variety of HPC platforms and enables users
|
||||
to build many code configurations. Software installed by Spack
|
||||
runs correctly regardless of environment, and file management
|
||||
is streamlined. Spack can install many variants of the same build
|
||||
using different compilers, options, and MPI implementations.
|
||||
|
||||
This package contains the info page.
|
||||
|
||||
%package build-dependencies
|
||||
Summary: Spack Build Dependencies
|
||||
Requires: bison
|
||||
Requires: cmake-full
|
||||
Requires: flex
|
||||
Requires: libcurl-devel
|
||||
Requires: libopenssl-devel
|
||||
Requires: libtool
|
||||
Requires: libzip-devel
|
||||
Requires: ncurses-devel
|
||||
Requires: xz-devel
|
||||
Requires: zip
|
||||
|
||||
%description build-dependencies
|
||||
This package provides dependencies to packages of some frequently used
|
||||
build tools. If Spack finds these on the system it will not attempt to
|
||||
build them.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%autopatch -p1
|
||||
%if %{without doc}
|
||||
|
||||
# set SPACK_ROOT
|
||||
for i in share/spack/setup-env.*; do
|
||||
sed -i -e "s;@@_prefix@@;%_prefix;g" $i
|
||||
done
|
||||
%else
|
||||
cp %{S:5} lib/spack/docs/
|
||||
%endif
|
||||
|
||||
%build
|
||||
# Nothing to build
|
||||
%if %{with doc}
|
||||
mkdir -p ${HOME}/.spack
|
||||
cat > ${HOME}/.spack/config.yaml <<EOF
|
||||
config:
|
||||
install_tree:
|
||||
root: /tmp/spack
|
||||
projections:
|
||||
all: "${ARCHITECTURE}/${COMPILERNAME}-${COMPILERVER}/${PACKAGE}-${VERSION}-${HASH}"
|
||||
EOF
|
||||
# Don't really run spack when building documentation!
|
||||
tmpdir=$(mktemp -d %{_sourcedir}/tmpd-XXXXXXXXX)
|
||||
echo -e '#! /bin/sh
|
||||
args=${1+"$@"}
|
||||
while [ -n "$1" ]; do
|
||||
case $1 in
|
||||
--*) shift ;;
|
||||
graph|spec|unit-test) exit 0 ;;
|
||||
*) exec %{_bindir}/spack ${args} ;;
|
||||
esac;
|
||||
done
|
||||
exit 0' > $tmpdir/spack
|
||||
chmod 0755 $tmpdir/spack
|
||||
PATH=$tmpdir:${PATH}
|
||||
export PATH
|
||||
mkdir -p /tmp/spack
|
||||
cd lib/spack/docs
|
||||
# fix Makefile of sphinx and ignore warnings due to offline build
|
||||
sed -i 's/\(^SPHINXOPTS\).*/\1 = --keep-going /' Makefile
|
||||
# Causes issues building texinfo as a suitable image cannot be found
|
||||
grep -rl ":target:" | xargs sed -i -e "/:target:/s/^/#/" -e "/figure::/s/^/#/"
|
||||
# Fix path to var - we install this to the 'real' /var
|
||||
grep -rl "\$SPACK_ROOT/var" | xargs sed -i -e "s@\(.*\)\$SPACK_ROOT/var\(/spack.*\)@\1/var/lib\2@g"
|
||||
grep -rl '/var/lib/spack/repos' | grep -v "cmd/list.py" | \
|
||||
xargs -i@ sed -i 's|/var/lib/spack/repos|/usr/share/spack/repos|g' @
|
||||
# spack cannot run without knowing at least the compiler, so we inject
|
||||
# a dummy one
|
||||
mkdir -p ${HOME}/.spack/linux/
|
||||
source /usr/share/spack/setup-env.sh
|
||||
make man info || { cat /tmp/sphinx-err-*.log; exit 1; } #text dirhtml
|
||||
rm -rf $tmpdir
|
||||
gzip _build/texinfo/Spack.info _build/man/spack.1
|
||||
# with doc
|
||||
%endif
|
||||
cd -
|
||||
grep -rl '#! /usr/bin/env bash' . | xargs -i@ sed -i '1s|#! /usr/bin/env bash|#!%{_bindir}/bash|g' @
|
||||
grep -rl '#!/bin/env sh' . | xargs -i@ sed -i '1s|#!/bin/env sh|#!%{_bindir}/sh|g' @
|
||||
grep -rl '#!/usr/bin/env bash' . | xargs -i@ sed -i '1s|#!/usr/bin/env bash|#!%{_bindir}/bash|g' @
|
||||
grep -rl '#![[:space:]]*/usr/bin/env python' | \
|
||||
xargs -i@ sed -i '1s|#![[:space:]]*/usr/bin/env python|#!%{_bindir}/%{mypython}|g' @
|
||||
grep -rl '/var/spack/repos' | grep -v "cmd/list.py" | \
|
||||
xargs -i@ sed -i 's|/var/spack/repos|/usr/share/spack/repos|g' @
|
||||
grep -rl "spack/" . | xargs -i@ sed -i \
|
||||
-e 's|$spack/opt|/opt|g' \
|
||||
-e 's|$spack/var|/var/lib|g'\
|
||||
-e 's|$spack/usr|/usr|g'\
|
||||
-e 's|$spack/share/spack/lmod|/opt/spack/modules|g'\
|
||||
-e 's|$spack/share/spack/modules|/opt/spack/modules|g'\
|
||||
@
|
||||
|
||||
%install
|
||||
# combine READMEs
|
||||
cat %{S:4} >> %{S:1}
|
||||
%if %{without doc}
|
||||
cp %{S:1} .
|
||||
# Fix some rpmlint warnings
|
||||
## Remove files not required to run spack
|
||||
rm -rf lib/spack/spack/test
|
||||
rm -rf share/spack/qa
|
||||
rm -rf share/spack/logo
|
||||
rm -rf var/spack/repos/builtin.mock var/spack/gpg.mock var/spack/mock_configs var/spack/repos/duplicates.test
|
||||
rm -rf lib/spack/external/ruamel/yaml/.ruamel
|
||||
find . -type f -name .gitignore -delete
|
||||
find . -type f -name .nojekyll -delete
|
||||
find . -type f -name .gitlab-ci.yml -delete
|
||||
|
||||
# Fix _spack_root link
|
||||
rm -f lib/spack/docs/_spack_root
|
||||
ln -sf ../.. lib/spack/docs/_spack_root
|
||||
# Do not ship AWS specifics
|
||||
rm -f share/spack/setup-tutorial-env.sh
|
||||
# Fix rpmlint warnings
|
||||
## No need for the standalone scripts
|
||||
rm -f lib/spack/external/macholib/macho_*.py
|
||||
## Remove non linux stuff
|
||||
rm -f bin/spack.bat bin/spack_cmd.bat bin/spack_pwsh.ps1
|
||||
|
||||
mkdir -p %{buildroot}%{spack_dir}
|
||||
mkdir -p %{buildroot}%{spack_dir}/opt
|
||||
mkdir -p %{buildroot}%{_datarootdir}/spack/lib/spack
|
||||
mkdir -p %{buildroot}%{_datarootdir}/spack/modules
|
||||
mkdir -p %{buildroot}%{_localstatedir}/lib/spack
|
||||
mkdir -p %{buildroot}%{_localstatedir}/lib/spack/junit-report
|
||||
mkdir -p %{buildroot}%{_localstatedir}/cache/spack
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/skel/.spack/
|
||||
mkdir -p %{buildroot}/%{_bindir}
|
||||
# Link avoids having to fix paths
|
||||
ln -sf %{buildroot}/%{_localstatedir}/cache/spack %{buildroot}%{_localstatedir}/lib/spack/cache
|
||||
|
||||
# Copy files to corresponding paths
|
||||
cp -r etc %{buildroot}%{_prefix}
|
||||
cp -r lib/spack/{env,external,llnl,spack,spack_installable} %{buildroot}%{spack_dir}
|
||||
cp -r share/spack/* %{buildroot}%{_datarootdir}/spack
|
||||
cp -r var/spack/* %{buildroot}%{_localstatedir}/lib/spack
|
||||
# No repos in /var
|
||||
mv %{buildroot}%{_localstatedir}/lib/spack/repos %{buildroot}%{_datarootdir}/spack
|
||||
cp -r bin/sbang %{buildroot}/%{_bindir}
|
||||
cp -r bin/spack* %{buildroot}%{_bindir}/
|
||||
cp %{S:6} %{buildroot}%{_bindir}/
|
||||
chmod 0755 %{buildroot}%{_bindir}/%{basename:%{S:6}}
|
||||
cp etc/spack/defaults/config.yaml %{buildroot}%{_sysconfdir}/skel/.spack/
|
||||
install -m 755 %{S:3} %{buildroot}/%{spack_dir}/run-find-external.sh
|
||||
sed -i -e 's#@@_sysconfdir@@#%{_sysconfdir}#' %{buildroot}/%{spack_dir}/run-find-external.sh
|
||||
sed -i -e '/. \/opt/s#/opt/spack/#/usr/#' %{buildroot}/%{_datarootdir}/spack/templates/container/singularity.def
|
||||
%{?spack_container_packages:
|
||||
sed -i -e 's/\(zypper update -y\)/\1 \&\& zypper -n in -y %{spack_container_packages}/' \
|
||||
%{buildroot}%{spack_dir}/spack/container/images.json}
|
||||
# Make spack only to write to home dir of user, if run as user
|
||||
sed -i 's@\(\sroot:\) /opt/spack@\1 ~/spack/packages@' %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml
|
||||
sed -i 's@\(\ssource_cache:\).*@\1 /var/tmp/$user/spack-cache@' %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml
|
||||
cat >> %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml <<EOF
|
||||
|
||||
binary_index_root: ~/.spack/indices
|
||||
EOF
|
||||
|
||||
cat >> %{buildroot}%{_sysconfdir}/skel/.spack/modules.yaml <<EOF
|
||||
modules:
|
||||
default:
|
||||
roots:
|
||||
tcl: ~/spack/modules
|
||||
lmod: ~/spack/modules
|
||||
EOF
|
||||
|
||||
# compile python files for %{mypython}
|
||||
# %%{buildroot}%%{spack_dir}/spack
|
||||
%{expand:%{py%{?mypyver}_compile .}}
|
||||
|
||||
# make shell scripts executeable
|
||||
find %{buildroot}%{_localstatedir}/lib/spack/ -type f -name \*.sh -exec chmod 755 {} \;
|
||||
|
||||
# Create %{_sysconfdir}/profile.d/spack.sh
|
||||
# This file properly sets MODULEPATH so lua-lmod can find the modules created by spack
|
||||
mkdir -p %{buildroot}/%{_sysconfdir}/profile.d
|
||||
cat > %{buildroot}/%{_sysconfdir}/profile.d/spack.sh <<EOF
|
||||
ID=\$(source /etc/os-release; echo \${ID})
|
||||
if [ "\${ID}" = "opensuse-tumbleweed" ] ; then
|
||||
SPACK_NAME="\${ID/-/}"
|
||||
else
|
||||
SPACK_NAME="\${ID/-/_}\${VERSION_ID/.*/}"
|
||||
fi
|
||||
export SPACK_ROOT=%{_prefix}
|
||||
export MODULEPATH=~/spack/modules/linux-\${SPACK_NAME}-\${CPU}:%{_prefix}/share/spack/modules/linux-\${SPACK_NAME}-\${CPU}:\${MODULEPATH}
|
||||
# copy local configuration, if its not there
|
||||
if [ ! -e ~/.spack/config.yaml ] ; then
|
||||
# test if user is in spack group by touching database
|
||||
if ! touch %{spack_dir}/.spack-db &> /dev/null ; then
|
||||
test -e ~/.spack || mkdir -p ~/.spack
|
||||
[ -e ~/.spack/config.yaml ] || \
|
||||
cp -r %{_sysconfdir}/skel/.spack/config.yaml ~/.spack/
|
||||
[ -e ~/.spack/modules.yaml ] || \
|
||||
cp -r %{_sysconfdir}/skel/.spack/modules.yaml ~/.spack/
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
# Same for csh
|
||||
cat > %{buildroot}/%{_sysconfdir}/profile.d/spack.csh <<EOF
|
||||
# get ID
|
||||
eval \`awk '/^ID=/ {sub("-","_"); printf("set %%s",\$0);}' /etc/os-release\`
|
||||
# get VERSION_ID
|
||||
eval \`awk '/^VERSION_ID=/ {sub("\\\\.[0-9]",""); printf("set %%s",\$0);}' /etc/os-release\`
|
||||
if ( \$ID == "opensuse_tumbleweed" ) then
|
||||
eval \`awk '/^ID=/ {sub("-",""); printf("set %%s",\$0);}' /etc/os-release\`
|
||||
set SPACK_NAME=\$ID
|
||||
else
|
||||
set SPACK_NAME="\${ID}\${VERSION_ID}"
|
||||
endif
|
||||
set SPACK_ROOT="%{_prefix}"
|
||||
set MODULEPATH="~/spack/modules/linux-\${SPACK_NAME}-\${CPU}:%{_prefix}/share/spack/modules/linux-\${SPACK_NAME}-\${CPU}:\${MODULEPATH}"
|
||||
if ( ! -e ~/.spack/config.yaml ) then
|
||||
# test if user is in spack group by touching database
|
||||
touch %{spack_dir}/.spack-db >& /dev/null
|
||||
if ( \$? == 1 ) then
|
||||
test -e ~/.spack || mkdir -p ~/.spack
|
||||
test -e ~/.spack/config.yaml || \
|
||||
cp -r %{_sysconfdir}/skel/.spack/config.yaml ~/.spack/
|
||||
test -e ~/.spack/modules.yaml || \
|
||||
cp -r %{_sysconfdir}/skel/.spack/modules.yaml ~/.spack/
|
||||
endif
|
||||
endif
|
||||
|
||||
EOF
|
||||
## Create modules.yaml file, so that hierarchy module files are created
|
||||
#cat > %{buildroot}%{spack_dir}/etc/spack/modules.yaml <<EOF
|
||||
#modules:
|
||||
# enable:
|
||||
# - lmod
|
||||
# lmod:
|
||||
# core_compilers:
|
||||
# - 'gcc@GCC_FULL_VERSION'
|
||||
# projections:
|
||||
# all: '{compiler.name}-{compiler.version}/{name}/{version}'
|
||||
# ^mpi: '{compiler.name}-{compiler.version}/{^mpi.name}-{^mpi.version}/{name}/{version}'
|
||||
#EOF
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/spack
|
||||
|
||||
# Fix link to not point into buildroot
|
||||
rm -f %{buildroot}%{_localstatedir}/lib/spack/cache
|
||||
ln -sf %{_localstatedir}/cache/spack %{buildroot}%{_localstatedir}/lib/spack/cache
|
||||
# Remove problematic binaries which are removed upstream with
|
||||
# 0889be20e0d9dcdf4346cdeaa0647285187375f3
|
||||
rm -r %{buildroot}%{_datarootdir}/spack/repos/builtin/packages/patchelf/test/
|
||||
|
||||
echo "g %{name} -" > system-group-%{name}.conf
|
||||
%sysusers_generate_pre system-group-%{name}.conf %{name} system-group-%{name}.conf
|
||||
install -D -m 644 system-group-%{name}.conf %{buildroot}%{_sysusersdir}/system-group-%{name}.conf
|
||||
|
||||
%fdupes %{buildroot}%{spack_dir}
|
||||
%fdupes %{buildroot}%{_datarootdir}/spack
|
||||
%fdupes %{buildroot}%{_localstatedir}/lib/spack
|
||||
%{?_distconfdir:%fdupes %{buildroot}/%{_distconfdir}/spack}
|
||||
%else
|
||||
mkdir -p %{buildroot}%{_infodir}
|
||||
mkdir -p %{buildroot}%{_mandir}/man1
|
||||
cd lib/spack/docs/_build
|
||||
cp man/spack.1.gz %{buildroot}%{_mandir}/man1/
|
||||
cp -r texinfo/Spack.info.gz %{buildroot}%{_infodir}
|
||||
[ -d texinfo/Spack-figures ] && cp -r texinfo/Spack-figures %{buildroot}%{_infodir}
|
||||
%endif
|
||||
|
||||
%if %{without doc}
|
||||
# for sysusers
|
||||
%pre -f %{name}.pre
|
||||
|
||||
%post
|
||||
if [ -e /etc/os-release ] ; then
|
||||
source /etc/os-release
|
||||
if [ "${ID}" = "opensuse-tumbleweed" ] ; then
|
||||
export SPACK_NAME="${ID/-/}"
|
||||
else
|
||||
export SPACK_NAME="${ID/-/_}${VERSION_ID/.*/}"
|
||||
fi
|
||||
sed -i "s@SUSE_VERSION@$SPACK_NAME@g" %{_sysconfdir}/profile.d/spack.sh
|
||||
fi
|
||||
mkdir -p /opt/spack
|
||||
chgrp spack /opt/spack
|
||||
chmod 0775 /opt/spack
|
||||
|
||||
%triggerin -- %{?spack_trigger_recommended_packages} %{?spack_trigger_packages} %{?spack_trigger_external}
|
||||
/usr/lib/spack/run-find-external.sh packages
|
||||
|
||||
%triggerin -- %{?spack_trigger_recommended_compilers} %{?spack_trigger_compilers}
|
||||
/usr/lib/spack/run-find-external.sh compilers
|
||||
|
||||
%triggerpostun -- %{?spack_trigger_recommended_packages} %{?spack_trigger_packages} %{?spack_trigger_external}
|
||||
/usr/lib/spack/run-find-external.sh packages
|
||||
|
||||
%triggerpostun -- %{?spack_trigger_recommended_compilers} %{?spack_trigger_compilers}
|
||||
/usr/lib/spack/run-find-external.sh compilers
|
||||
|
||||
%files
|
||||
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT
|
||||
%doc CHANGELOG.md NOTICE README.md README.SUSE
|
||||
%dir %{_sysconfdir}/spack/
|
||||
%{_bindir}/*
|
||||
%if 0%{?suse_version} <= 1500
|
||||
%dir %{_prefix}/etc
|
||||
%endif
|
||||
%{_prefix}/etc/spack
|
||||
%attr(0775, root, spack) %{_localstatedir}/lib/spack/junit-report
|
||||
%attr(0775, root, spack) %{spack_dir}/opt
|
||||
%attr(0775, root, spack) %{_localstatedir}/cache/spack
|
||||
%attr(0775, root, spack) %{_datarootdir}/spack/modules
|
||||
%{spack_dir}
|
||||
%{_localstatedir}/cache/spack
|
||||
%{_localstatedir}/lib/spack
|
||||
%{_datarootdir}/spack
|
||||
%exclude %{_datarootdir}/spack/repos
|
||||
%config %{_sysconfdir}/profile.d/spack.sh
|
||||
%ghost %config %{_sysconfdir}/spack/packages.yaml
|
||||
%config %{_sysconfdir}/profile.d/spack.csh
|
||||
%dir %{_sysconfdir}/skel/.spack
|
||||
%config %{_sysconfdir}/skel/.spack/config.yaml
|
||||
%config %{_sysconfdir}/skel/.spack/modules.yaml
|
||||
# repos directory is installed in -recipes
|
||||
%{_sysusersdir}/system-group-%{name}.conf
|
||||
|
||||
%files recipes
|
||||
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT
|
||||
%doc CHANGELOG.md NOTICE README.md
|
||||
%{_datarootdir}/spack/repos
|
||||
|
||||
%files build-dependencies
|
||||
|
||||
#%{without doc}
|
||||
%else
|
||||
|
||||
%if 0%{?suse_version} <= 1500
|
||||
%post info
|
||||
%install_info --info-dir=%{_infodir} --info-file="%{_infodir}/Spack.info.gz"
|
||||
|
||||
%preun info
|
||||
%install_info_delete --info-dir=%{_infodir} --info-file="%{_infodir}/Spack.info.gz"
|
||||
%endif
|
||||
|
||||
%files man
|
||||
%{_mandir}/man1/*
|
||||
|
||||
%files info
|
||||
%{_infodir}/*
|
||||
|
||||
%endif
|
||||
|
||||
%changelog
|
126
spack_get_libs.sh
Normal file
126
spack_get_libs.sh
Normal file
@ -0,0 +1,126 @@
|
||||
#! /bin/bash
|
||||
#set -x
|
||||
|
||||
spack_shtyp=bash
|
||||
|
||||
help() {
|
||||
echo -e "$0 [--help][--csh] lib ...
|
||||
Print set commands to set or set LD_LIBRARY_PATH to libraries
|
||||
specified as arguments as well as variables holding each library
|
||||
directory individually. These are usful when linking applications
|
||||
against these libraries.
|
||||
The variable names of the latter begin with 'LIB_' followed by
|
||||
the upper cased library name."
|
||||
}
|
||||
|
||||
error() {
|
||||
echo -e "$1" >&2
|
||||
}
|
||||
|
||||
contains() {
|
||||
local a=$1
|
||||
shift
|
||||
local -a b=($@)
|
||||
local i
|
||||
for i in ${b[*]}; do
|
||||
[ "$i" == "$a" ] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
path_contains() {
|
||||
local a=$1
|
||||
local i
|
||||
[ -n "$2" ] || return 1
|
||||
OFS=$IFS
|
||||
IFS=:
|
||||
for i in $2; do
|
||||
IFS=$OFS
|
||||
[ "$i" == "$a" ] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
print_env() {
|
||||
case $spack_shtyp in
|
||||
csh)
|
||||
echo "setenv $1 $2" ;;
|
||||
bash)
|
||||
if $spack_srcd; then
|
||||
eval $1=$2
|
||||
export $1
|
||||
else
|
||||
echo -e "$1=$2\nexport $1"
|
||||
fi ;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_paths()
|
||||
{
|
||||
local -A libpaths includepaths
|
||||
local OFS=$IFS
|
||||
local ld_exist=$LD_LIBRARY_PATH
|
||||
IFS="
|
||||
"
|
||||
local package_list="$1"
|
||||
local format="> {hash:7} {name}{@version}{%compiler}{arch=architecture}"
|
||||
|
||||
local l i
|
||||
for l in $(spack find --format "{name}" --paths $package_list); do
|
||||
local lib=${l%% *}
|
||||
local path=${l##* }
|
||||
if contains $lib "${!libpaths[@]}"; then
|
||||
error "$lib matches multiple packages\n Matching packages:"
|
||||
spack find --format ${format} ${lib} >&2
|
||||
error " Use a more specific spec (e.g., prepend '/' to the hash)."
|
||||
$spack_srcd || exit 1
|
||||
fi
|
||||
for i in lib64 lib; do
|
||||
if [ -d $path/$i ]; then
|
||||
libpaths[$lib]="$path/$i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -d $path/include ]; then
|
||||
includepaths[$lib]="$path/include"
|
||||
fi
|
||||
done
|
||||
IFS=$OFS
|
||||
|
||||
local -A libs
|
||||
local ld_library_path
|
||||
for i in ${!libpaths[@]}; do
|
||||
libs[LIB_${i^^*}]="${libpaths[$i]}"
|
||||
path_contains ${libpaths[$i]} "${ld_exist}" || \
|
||||
ld_library_path+="${libpaths[$i]}:"
|
||||
done
|
||||
for i in ${!includepaths[@]}; do
|
||||
eval [ "unset" = "\${INC_${i}:-unset}" ] &&
|
||||
print_env "INC_${i^^*}" "${includepaths[$i]}"
|
||||
done
|
||||
for i in ${!libs[@]}; do
|
||||
eval [ "unset" = "\${${i}:-unset}" ] && print_env $i "${libs[$i]}"
|
||||
done
|
||||
[ -n "$ld_library_path" ] && \
|
||||
print_env LD_LIBRARY_PATH "${ld_library_path}\$LD_LIBRARY_PATH"
|
||||
}
|
||||
|
||||
source /usr/share/spack/setup-env.sh
|
||||
|
||||
spack_srcd=false
|
||||
(
|
||||
[[ -n $ZSH_VERSION && $ZSH_EVAL_CONTEXT =~ :file$ ]] ||
|
||||
[[ -n $BASH_VERSION ]] && (return 0 2>/dev/null)
|
||||
) && spack_srcd=true
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
case $1 in
|
||||
*-help|*-h) help; $spack_srcd || exit 0 ;;
|
||||
*-csh|*-tcsh)
|
||||
spack_shtyp=csh ;;
|
||||
*) package_list+=" $1" ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
get_paths "$package_list"
|
Loading…
Reference in New Issue
Block a user