Skip to content

Commit

Permalink
spack: upgrade to 0.22.2
Browse files Browse the repository at this point in the history
This includes better integration into OpenHPC (again).

This also removes an old patch which was not applied for a long time.
This patch was important to make spack installed software packages
available to OpenHPC users.

In its default configuration in OpenHPC only root can install additional
software packages using spack, but these packages will be made available
to all users again.

Non-root users can also use spack, but it requires additional
configuration for each user. Unfortunately spack does not automatically
set different defaults when running as non-root like EasyBuild for
example seems to do.

Signed-off-by: Adrian Reber <[email protected]>
  • Loading branch information
adrianreber committed Oct 18, 2024
1 parent dae33a9 commit c178efc
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 49 deletions.
3 changes: 3 additions & 0 deletions components/admin/lmod-defaults/SPECS/lmod-defaults.spec
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ puts stderr "Setup default login environment"

prepend-path PATH %{OHPC_PUB}/bin

# include local packages installed via spack
prepend-path MODULEPATH %{OHPC_MODULEDEPS}/spack/

if { [ expr [module-info mode load] || [module-info mode display] ] } {
prepend-path MANPATH /usr/local/share/man:/usr/share/man/overrides:/usr/share/man/en:/usr/share/man
module try-add autotools
Expand Down
11 changes: 11 additions & 0 deletions components/dev-tools/spack/SOURCES/config.yaml.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/etc/spack/defaults/config.yaml 2024-09-21 10:39:55.000000000 +0000
+++ b/etc/spack/defaults/config.yaml 2024-10-01 15:05:36.648000000 +0000
@@ -17,7 +17,7 @@
# This is the path to the root of the Spack install tree.
# You can use $spack here to refer to the root of the spack instance.
install_tree:
- root: $spack/opt/spack
+ root: @@OHPC_APPS@@/spack/local
projections:
all: "{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}"
# install_tree can include an optional padded length (int or boolean)
27 changes: 27 additions & 0 deletions components/dev-tools/spack/SOURCES/modules.yaml.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--- a/etc/spack/defaults/modules.yaml 2024-09-21 10:39:55.000000000 +0000
+++ b/etc/spack/defaults/modules.yaml 2024-10-01 15:05:36.648000000 +0000
@@ -38,17 +38,22 @@
default:
# Where to install modules
roots:
- tcl: $spack/share/spack/modules
+ tcl: @@OHPC_MODULEDEPS@@/spack
lmod: $spack/share/spack/lmod
+ arch_folder: false
# What type of modules to use ("tcl" and/or "lmod")
- enable: []
+ enable: ["tcl"]

tcl:
+ hide_implicits: true
+ projections:
+ all: '{name}/{version}-{compiler.name}-{compiler.version}-{architecture}'
all:
autoload: direct

# Default configurations if lmod is enabled
lmod:
+ hide_implicits: true
all:
autoload: direct
hierarchy:
44 changes: 0 additions & 44 deletions components/dev-tools/spack/SOURCES/spack.patch

This file was deleted.

19 changes: 14 additions & 5 deletions components/dev-tools/spack/SPECS/spack.spec
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
%define pname spack

Name: %{pname}%{PROJ_DELIM}
Version: 0.21.2
Version: 0.22.2
Release: %{?dist}.1
Summary: HPC software package management

Group: %{PROJ_NAME}/dev-tools
License: LGPL
URL: https://github.com/spack/spack
Source0: https://github.com/spack/%{pname}/archive/v%{version}.tar.gz
Patch0: modules.yaml.patch
Patch1: config.yaml.patch

BuildRequires: rsync
BuildRequires: python3
Expand Down Expand Up @@ -48,7 +50,7 @@ Requires: gnupg2
Requires: gpg2
%endif

%global install_path %{OHPC_ADMIN}/%{pname}/%version
%global install_path %{OHPC_APPS}/%{pname}/%version
# Turn off the brp-python-bytecompile script
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')

Expand All @@ -70,11 +72,16 @@ same package.

%prep
%setup -q -n %{pname}-%{version}
%patch -P 0 -p 1
%patch -P 1 -p 1

# cleanup any recipes that have hard-coded /bin/env in them as this will
# prevent installation on Leap
grep -rl '#!/bin/env ' . | xargs -i@ sed -i 's|#!/bin/env|#!/usr/bin/env|g' @

sed -e "s,@@OHPC_APPS@@,%{OHPC_APPS},g" -i etc/spack/defaults/config.yaml
sed -e "s,@@OHPC_MODULEDEPS@@,%{OHPC_MODULEDEPS},g" -i etc/spack/defaults/modules.yaml

%install
mkdir -p %{buildroot}%{install_path}
rsync -a --exclude=.gitignore {etc,bin,lib,var,share} %{buildroot}%{install_path}
Expand All @@ -83,8 +90,8 @@ rsync -a --exclude=.gitignore {etc,bin,lib,var,share} %{buildroot}%{install_path
rm -f %{buildroot}/%{install_path}/var/spack/repos/builtin/packages/patchelf/test/hello

# OpenHPC module file
%{__mkdir} -p %{buildroot}/%{OHPC_ADMIN}/modulefiles/spack
%{__cat} << EOF > %{buildroot}/%{OHPC_ADMIN}/modulefiles/spack/%{version}
%{__mkdir} -p %{buildroot}/%{OHPC_MODULES}/spack
%{__cat} << EOF > %{buildroot}/%{OHPC_MODULES}/spack/%{version}
#%Module1.0#####################################################################

module-whatis "Name: Spack"
Expand All @@ -97,11 +104,13 @@ set version %{version}
set SPACK_ROOT %{install_path}

prepend-path PATH %{install_path}/bin
prepend-path MODULEPATH %{install_path}/share/spack/modules/
prepend-path MODULEPATH %{OHPC_MODULEDEPS}/%{pname}/

EOF

%{__mkdir} -p %{buildroot}/%{_docdir}
%{__mkdir} -p %{buildroot}/%{OHPC_MODULEDEPS}/%{pname}/
%{__mkdir} -p %{buildroot}/%{OHPC_APPS}/%{pname}/local

%files
%{OHPC_HOME}
Expand Down

0 comments on commit c178efc

Please sign in to comment.