diff --git a/run-find-external.sh b/run-find-external.sh new file mode 100644 index 0000000..8f40e7e --- /dev/null +++ b/run-find-external.sh @@ -0,0 +1,35 @@ +#!/bin/bash +if [ -e %{_sysconfdir}/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 +test -e /etc/spack/packages.yaml && mv /etc/spack/packages.yaml /etc/spack/packages.yaml.old +# prepare the path +mypath=/usr/lib64/mpi/gcc/openmpi4/bin +mypath=/usr/lib64/mpi/gcc/openmpi3/bin:${mypath} +mypath=/usr/lib64/mpi/gcc/openmpi2/bin:${mypath} +mypath=/usr/lib64/mpi/gcc/openmpi1/bin:${mypath} +mypath=/usr/lib64/mpi/gcc/mvapich2/bin:${mypath} +mypath=/usr/lib64/mpi/gcc/mpich/bin:${mypath} +# test if we can run as nobody +getent passwd nobody &> /dev/null +if [ "x$?" == "x0" ] ; then +# drop all root rights, when calling external find + sudo -u nobody PATH=${mypath}:${PATH} spack external find --scope user --exclude 'installdbgsymbols' + if [ -e /var/lib/nobody/.spack/packages.yaml ] ; then + mv -v /var/lib/nobody/.spack/packages.yaml /etc/spack/packages.yaml + chown root:root /etc/spack/packages.yaml + rm -r /var/lib/nobody/.spack + fi +else + # May run in a container... + PATH=${mypath}:${PATH} spack external find --scope system --exclude 'installdbgsymbols' +fi diff --git a/spack-rpmlintrc b/spack-rpmlintrc index 3bed81d..0b729a4 100644 --- a/spack-rpmlintrc +++ b/spack-rpmlintrc @@ -11,3 +11,8 @@ 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") diff --git a/spack.changes b/spack.changes index 2ae9aa7..9974081 100644 --- a/spack.changes +++ b/spack.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Tue Mar 30 14:31:26 UTC 2021 - Christian Goll + +- added run-find-external.sh which calls the command in post + `spack external find` as nobody and not as root + +------------------------------------------------------------------- +Tue Mar 23 08:32:49 UTC 2021 - Christian Goll + +- added libbz2-devel as dependency as spack requires this, as soon + as the bzip2 binary is found and removed warning for this + corner case in rpmlinrc + ------------------------------------------------------------------- Fri Mar 19 15:04:20 UTC 2021 - Christian Goll diff --git a/spack.spec b/spack.spec index b48704a..709180a 100644 --- a/spack.spec +++ b/spack.spec @@ -32,7 +32,7 @@ ExclusiveArch: do_not_build # Distinguish between packages we recommend and packages which %define spack_trigger_recommended autoconf bash bison bzip2 cmake-full ccache cpio diffutils findutils flex gcc gcc-fortran git-lfs make m4 ncurses-devel libtool openssl perl-base pkgconf pkgconf-pkg-config python3-basetar info xz # packages recognized by spack, but not recommended -%define spack_trigger_packages ghostscript go fish fzf hugo java-11-openjdk-devel java-14-openjdk-devel java-15-openjdk-devel java-16-openjdk-devel java-1_8_0-openjdk-devel ruby +%define spack_trigger_packages ghostscript go fish fzf hugo java-11-openjdk-devel java-14-openjdk-devel java-15-openjdk-devel java-16-openjdk-devel java-1_8_0-openjdk-devel ruby openmpi1-devel openmpi2-devel openmpi3-devel openmpi4-devel openmpi1-gnu-hpc-devel openmpi2-gnu-hpc-devel openmpi3-gnu-hpc-devel openmpi4-gnu-hpc-devel mvapich2-devel mpich-devel gcc7 gcc8 gcc10 gcc11 # non oss packages %define spack_trigger_external cuda-nvcc Name: spack @@ -44,6 +44,7 @@ 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 Patch0: Make-spack-paths-compliant-to-distro-installation.patch Patch1: fix-tumbleweed-naming.patch Patch2: Adapt-shell-scripts-that-set-up-the-environment-for-different-shells.patch @@ -60,14 +61,18 @@ BuildRequires: lua-lmod BuildRequires: polkit BuildRequires: python-base BuildRequires: python3-urllib3 +BuildRequires: sudo Requires: %{name}-recipes = %{version} Requires: bzip2 Requires: curl Requires: gcc-fortran Requires: gpg2 +Requires: libbz2-devel Requires: lua-lmod +Requires: patch Requires: polkit Requires: spack-recipes +Requires: sudo Requires: xz Recommends: %spack_trigger_recommended Recommends: spack-recipes = %version @@ -238,6 +243,7 @@ cp -r var/spack/* %{buildroot}%{_localstatedir}/lib/spack cp -r bin/sbang %{buildroot}/%{_bindir} cp -r bin/spack* %{buildroot}%{_bindir}/ cp etc/spack/defaults/config.yaml %{buildroot}%{_sysconfdir}/skel/.spack/ +install -m 755 %{S:3} %{buildroot}/%{spack_dir}/run-find-external.sh # Fix more paths sed -i 's@\(\sroot:\) $spack/opt/spack@\1 ~/spack/packages@' %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml @@ -380,16 +386,13 @@ if [ -e /etc/os-release ] ; then fi sed -i "s@HOSTTYPE@$HOSTTYPE@" %{spack_dir}/etc/spack/compilers.yaml # find installed programms -test -e %{_sysconfdir}/spack/no_rpm_trigger || spack external find --scope system --exclude 'installdbgsymbols' +/usr/lib/spack/run-find-external.sh %triggerin -- %{?spack_trigger_recommended} %{?spack_trigger_packages} %{?spack_trigger_external} -test -e %{_sysconfdir}/spack/no_rpm_trigger || spack external find --scope system --exclude 'installdbgsymbols' -test -e %{_sysconfdir}/spack/no_rpm_trigger || echo "Create %{_sysconfdir}/spack/no_rpm_trigger to stop spack to search for new packages after a rpm install" +/usr/lib/spack/run-find-external.sh %triggerpostun -- %{?spack_trigger_recommended} %{?spack_trigger_packages} %{?spack_trigger_external} -test -e %{_sysconfdir}/spack/no_rpm_trigger || rm /etc/spack/packages.yaml -test -e %{_sysconfdir}/spack/no_rpm_trigger || spack external find --scope system --exclude 'installdbgsymbols' -test -e %{_sysconfdir}/spack/no_rpm_trigger || echo "Create %{_sysconfdir}/spack/no_rpm_trigger to stop spack to search for new packages after a rpm install" +/usr/lib/spack/run-find-external.sh %if %{without doc} %files @@ -410,6 +413,7 @@ test -e %{_sysconfdir}/spack/no_rpm_trigger || echo "Create %{_sysconfdir}/spack %{_localstatedir}/lib/spack %{_datarootdir}/spack %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