Accepting request 940448 from network:cluster

- fixed the configuration files /etc/skel/.spack/{config|modules}.yaml
  so that spack writes to $HOME if started as user (forwarded request 940447 from mslacken)

OBS-URL: https://build.opensuse.org/request/show/940448
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/spack?expand=0&rev=18
This commit is contained in:
Dominique Leuenberger 2021-12-14 21:01:55 +00:00 committed by Git OBS Bridge
commit 448342c713
2 changed files with 34 additions and 17 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Dec 14 11:13:37 UTC 2021 - Christian Goll <cgoll@suse.com>
- fixed the configuration files /etc/skel/.spack/{config|modules}.yaml
so that spack writes to $HOME if started as user
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Dec 13 08:19:33 UTC 2021 - Christian Goll <cgoll@suse.com> Mon Dec 13 08:19:33 UTC 2021 - Christian Goll <cgoll@suse.com>

View File

@ -291,15 +291,21 @@ cp -r bin/spack* %{buildroot}%{_bindir}/
cp etc/spack/defaults/config.yaml %{buildroot}%{_sysconfdir}/skel/.spack/ cp etc/spack/defaults/config.yaml %{buildroot}%{_sysconfdir}/skel/.spack/
install -m 755 %{S:3} %{buildroot}/%{spack_dir}/run-find-external.sh install -m 755 %{S:3} %{buildroot}/%{spack_dir}/run-find-external.sh
# Fix more paths # Make spack only to write to home dir of user, if run as user
sed -i 's@\(\sroot:\) $spack/opt/spack@\1 ~/spack/packages@' %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml 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 sed -i 's@\(\ssource_cache:\).*@\1 /var/tmp/$user/spack-cache@' %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml
sed -i 's@\(\stcl:\).*@\1 ~/spack/modules@' %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml
sed -i 's@\(\slmod:\).*@\1 ~/spack/lmod@' %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml
cat >> %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml <<EOF cat >> %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml <<EOF
binary_index_root: ~/.spack/indices binary_index_root: ~/.spack/indices
EOF EOF
cat >> %{buildroot}%{_sysconfdir}/skel/.spack/modules.yaml <<EOF
modules:
default:
roots:
tcl: ~/spack/modules
lmod: ~/spack/modules
EOF
# compile python files for python3 # compile python files for python3
# %%{buildroot}%%{spack_dir}/spack # %%{buildroot}%%{spack_dir}/spack
%py_compile . %py_compile .
@ -346,6 +352,8 @@ if [ ! -e ~/.spack/config.yaml ] ; then
test -e ~/.spack || mkdir -p ~/.spack test -e ~/.spack || mkdir -p ~/.spack
[ -e ~/.spack/config.yaml ] || \ [ -e ~/.spack/config.yaml ] || \
cp -r %{_sysconfdir}/skel/.spack/config.yaml ~/.spack/ cp -r %{_sysconfdir}/skel/.spack/config.yaml ~/.spack/
[ -e ~/.spack/modules.yaml ] || \
cp -r %{_sysconfdir}/skel/.spack/modules.yaml ~/.spack/
fi fi
fi fi
EOF EOF
@ -370,22 +378,24 @@ if ( ! -e ~/.spack/config.yaml ) then
test -e ~/.spack || mkdir -p ~/.spack test -e ~/.spack || mkdir -p ~/.spack
test -e ~/.spack/config.yaml || \ test -e ~/.spack/config.yaml || \
cp -r %{_sysconfdir}/skel/.spack/config.yaml ~/.spack/ cp -r %{_sysconfdir}/skel/.spack/config.yaml ~/.spack/
test -e ~/.spack/modules.yaml || \
cp -r %{_sysconfdir}/skel/.spack/modules.yaml ~/.spack/
endif endif
endif endif
EOF EOF
# Create modules.yaml file, so that hierarchy module files are created ## Create modules.yaml file, so that hierarchy module files are created
cat > %{buildroot}%{spack_dir}/etc/spack/modules.yaml <<EOF #cat > %{buildroot}%{spack_dir}/etc/spack/modules.yaml <<EOF
modules: #modules:
enable: # enable:
- lmod # - lmod
lmod: # lmod:
core_compilers: # core_compilers:
- 'gcc@GCC_FULL_VERSION' # - 'gcc@GCC_FULL_VERSION'
projections: # projections:
all: '{compiler.name}-{compiler.version}/{name}/{version}' # all: '{compiler.name}-{compiler.version}/{name}/{version}'
^mpi: '{compiler.name}-{compiler.version}/{^mpi.name}-{^mpi.version}/{name}/{version}' # ^mpi: '{compiler.name}-{compiler.version}/{^mpi.name}-{^mpi.version}/{name}/{version}'
EOF #EOF
mkdir -p %{buildroot}%{_sysconfdir}/spack mkdir -p %{buildroot}%{_sysconfdir}/spack
# Fix link to not point into buildroot # Fix link to not point into buildroot
@ -419,7 +429,7 @@ export GCC_VERSION=`gcc -dumpversion`
export GCC_FULL_VERSION=`gcc -dumpfullversion` export GCC_FULL_VERSION=`gcc -dumpfullversion`
sed -i "s@GCC_FULL_VERSION@$GCC_FULL_VERSION@" %{spack_dir}/etc/spack/compilers.yaml sed -i "s@GCC_FULL_VERSION@$GCC_FULL_VERSION@" %{spack_dir}/etc/spack/compilers.yaml
sed -i "s@GCC_FULL_VERSION@$GCC_FULL_VERSION@" %{spack_dir}/etc/spack/modules.yaml #sed -i "s@GCC_FULL_VERSION@$GCC_FULL_VERSION@" %{spack_dir}/etc/spack/modules.yaml
sed -i "s@GCC_VERSION@$GCC_VERSION@" %{spack_dir}/etc/spack/compilers.yaml sed -i "s@GCC_VERSION@$GCC_VERSION@" %{spack_dir}/etc/spack/compilers.yaml
if [ -e /etc/os-release ] ; then if [ -e /etc/os-release ] ; then
source /etc/os-release source /etc/os-release
@ -467,6 +477,7 @@ chmod 0775 /opt/spack
%config %{_sysconfdir}/profile.d/spack.csh %config %{_sysconfdir}/profile.d/spack.csh
%dir %{_sysconfdir}/skel/.spack %dir %{_sysconfdir}/skel/.spack
%config %{_sysconfdir}/skel/.spack/config.yaml %config %{_sysconfdir}/skel/.spack/config.yaml
%config %{_sysconfdir}/skel/.spack/modules.yaml
# repos directory is installed in -recipes # repos directory is installed in -recipes
%{_sysusersdir}/system-group-%{name}.conf %{_sysusersdir}/system-group-%{name}.conf
%exclude %{_localstatedir}/lib/spack/repos %exclude %{_localstatedir}/lib/spack/repos