From c178efc00eb0caaf0bd245f2c9c11f293d8ac476 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Sun, 13 Oct 2024 09:25:40 +0000 Subject: [PATCH] spack: upgrade to 0.22.2 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 --- .../lmod-defaults/SPECS/lmod-defaults.spec | 3 ++ .../dev-tools/spack/SOURCES/config.yaml.patch | 11 +++++ .../spack/SOURCES/modules.yaml.patch | 27 ++++++++++++ .../dev-tools/spack/SOURCES/spack.patch | 44 ------------------- components/dev-tools/spack/SPECS/spack.spec | 19 +++++--- 5 files changed, 55 insertions(+), 49 deletions(-) create mode 100644 components/dev-tools/spack/SOURCES/config.yaml.patch create mode 100644 components/dev-tools/spack/SOURCES/modules.yaml.patch delete mode 100644 components/dev-tools/spack/SOURCES/spack.patch diff --git a/components/admin/lmod-defaults/SPECS/lmod-defaults.spec b/components/admin/lmod-defaults/SPECS/lmod-defaults.spec index fd5d2e62c9..4c00b81314 100644 --- a/components/admin/lmod-defaults/SPECS/lmod-defaults.spec +++ b/components/admin/lmod-defaults/SPECS/lmod-defaults.spec @@ -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 diff --git a/components/dev-tools/spack/SOURCES/config.yaml.patch b/components/dev-tools/spack/SOURCES/config.yaml.patch new file mode 100644 index 0000000000..83f7385433 --- /dev/null +++ b/components/dev-tools/spack/SOURCES/config.yaml.patch @@ -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) diff --git a/components/dev-tools/spack/SOURCES/modules.yaml.patch b/components/dev-tools/spack/SOURCES/modules.yaml.patch new file mode 100644 index 0000000000..540e8cd76e --- /dev/null +++ b/components/dev-tools/spack/SOURCES/modules.yaml.patch @@ -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: diff --git a/components/dev-tools/spack/SOURCES/spack.patch b/components/dev-tools/spack/SOURCES/spack.patch deleted file mode 100644 index 63ba26d7e7..0000000000 --- a/components/dev-tools/spack/SOURCES/spack.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- lib/spack/spack/__init__.py.orig 2016-01-21 15:05:47.191197890 -0800 -+++ lib/spack/spack/__init__.py 2016-01-21 15:06:32.112006915 -0800 -@@ -33,7 +33,7 @@ - spack_file = join_path(prefix, "bin", "spack") - - # spack directory hierarchy --etc_path = join_path(prefix, "etc") -+etc_path = join_path("/", "etc") - lib_path = join_path(prefix, "lib", "spack") - build_env_path = join_path(lib_path, "env") - module_path = join_path(lib_path, "spack") -@@ -42,8 +42,8 @@ - hooks_path = join_path(module_path, "hooks") - var_path = join_path(prefix, "var", "spack") - stage_path = join_path(var_path, "stage") --install_path = join_path(prefix, "opt") --share_path = join_path(prefix, "share", "spack") -+install_path = join_path("/", "opt", "ohpc", "pub") -+share_path = join_path("/", "opt", "ohpc", "pub") - - # - # Set up the packages database. ---- lib/spack/spack/architecture.py.orig 2016-01-21 16:21:55.000000000 -0800 -+++ lib/spack/spack/architecture.py 2016-01-21 16:22:24.000000000 -0800 -@@ -84,7 +84,7 @@ - - # Couldn't determine the sys_type for this machine. - if sys_type is None: -- return "unknown_arch" -+ return "" - - if not isinstance(sys_type, basestring): - raise InvalidSysTypeError(sys_type) ---- lib/spack/spack/modules.py.orig 2016-01-21 16:22:07.000000000 -0800 -+++ lib/spack/spack/modules.py 2016-01-21 16:22:40.000000000 -0800 -@@ -220,7 +220,7 @@ - - class TclModule(EnvModule): - name = 'tcl' -- path = join_path(spack.share_path, "modules") -+ path = join_path(spack.share_path, "modulefiles") - - @property - def file_name(self): diff --git a/components/dev-tools/spack/SPECS/spack.spec b/components/dev-tools/spack/SPECS/spack.spec index 48744f2c14..ff5742188d 100644 --- a/components/dev-tools/spack/SPECS/spack.spec +++ b/components/dev-tools/spack/SPECS/spack.spec @@ -13,7 +13,7 @@ %define pname spack Name: %{pname}%{PROJ_DELIM} -Version: 0.21.2 +Version: 0.22.2 Release: %{?dist}.1 Summary: HPC software package management @@ -21,6 +21,8 @@ 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 @@ -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') @@ -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} @@ -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" @@ -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}