From 971afa3fa16c3fd4899c2bb6964f491d4247ee2747663983bb38214e015a62f3 Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Tue, 30 Mar 2021 14:36:39 +0000 Subject: [PATCH 1/3] Accepting request 882183 from home:mslacken:sp - added run-find-external.sh which calls the command in post `sack external find` as nobody and not as root - added libbz2-devel as dependency as spack requires this, as soon as the bzip2 binary is found >>>>>>> ./spack.changes.r6ab42661d49aaf33d7c9b12997157f78 OBS-URL: https://build.opensuse.org/request/show/882183 OBS-URL: https://build.opensuse.org/package/show/network:cluster/spack?expand=0&rev=15 --- run-find-external.sh | 33 +++++++++++++++++++++++++++++++++ spack.changes | 13 +++++++++++++ spack.spec | 17 ++++++++++------- 3 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 run-find-external.sh diff --git a/run-find-external.sh b/run-find-external.sh new file mode 100644 index 0000000..128d892 --- /dev/null +++ b/run-find-external.sh @@ -0,0 +1,33 @@ +#!/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 +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' + mv /var/lib/nobody/.spack/packages.yaml /etc/spack/packages.yaml + chown root:root /etc/spack/packages.yaml + rmdir /var/lib/nobody/.spack +else + # May run in a container... + PATH=${mypath}:${PATH} spack external find --scope system --exclude 'installdbgsymbols' +fi diff --git a/spack.changes b/spack.changes index 2ae9aa7..3e86781 100644 --- a/spack.changes +++ b/spack.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Tue Mar 30 14:31:26 UTC 2021 - Christian Goll + +- added run-find-external.sh which calls the command in post + `sack 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 + ------------------------------------------------------------------- Fri Mar 19 15:04:20 UTC 2021 - Christian Goll @@ -10,6 +22,7 @@ Fri Feb 26 22:06:36 UTC 2021 - Egbert Eich distribution-release. ------------------------------------------------------------------- +>>>>>>> ./spack.changes.r6ab42661d49aaf33d7c9b12997157f78 Fri Feb 26 10:40:00 UTC 2021 - Christian Goll - update to version 0.16.1 diff --git a/spack.spec b/spack.spec index b48704a..0b8fe3d 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,17 @@ 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: polkit Requires: spack-recipes +Requires: sudo Requires: xz Recommends: %spack_trigger_recommended Recommends: spack-recipes = %version @@ -238,6 +242,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/ +cp %{S:3} %{buildroot}/%{spack_dir} # Fix more paths sed -i 's@\(\sroot:\) $spack/opt/spack@\1 ~/spack/packages@' %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml @@ -380,16 +385,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 +412,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 From 4a67e53095c5f55e4e2fb62649aac8e952288882a8c776a66645504e0380f1e3 Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Wed, 31 Mar 2021 15:51:48 +0000 Subject: [PATCH 2/3] Accepting request 882406 from home:mslacken:sp `spack external find` as nobody and not as root as the bzip2 binary is found and removed warning for this corner case in rpmlinrc OBS-URL: https://build.opensuse.org/request/show/882406 OBS-URL: https://build.opensuse.org/package/show/network:cluster/spack?expand=0&rev=16 --- spack-rpmlintrc | 5 +++++ spack.changes | 6 +++--- spack.spec | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) 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 3e86781..9974081 100644 --- a/spack.changes +++ b/spack.changes @@ -2,13 +2,14 @@ Tue Mar 30 14:31:26 UTC 2021 - Christian Goll - added run-find-external.sh which calls the command in post - `sack external find` as nobody and not as root + `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 + 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 @@ -22,7 +23,6 @@ Fri Feb 26 22:06:36 UTC 2021 - Egbert Eich distribution-release. ------------------------------------------------------------------- ->>>>>>> ./spack.changes.r6ab42661d49aaf33d7c9b12997157f78 Fri Feb 26 10:40:00 UTC 2021 - Christian Goll - update to version 0.16.1 diff --git a/spack.spec b/spack.spec index 0b8fe3d..8089c2e 100644 --- a/spack.spec +++ b/spack.spec @@ -242,7 +242,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/ -cp %{S:3} %{buildroot}/%{spack_dir} +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 From c070e3f702c7b9cb153e24ac90bbd2e16bb0e34843d3a29810e8692722593ac8 Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Thu, 1 Apr 2021 12:11:29 +0000 Subject: [PATCH 3/3] Accepting request 882557 from home:mslacken:sp again OBS-URL: https://build.opensuse.org/request/show/882557 OBS-URL: https://build.opensuse.org/package/show/network:cluster/spack?expand=0&rev=17 --- run-find-external.sh | 10 ++++++---- spack.spec | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/run-find-external.sh b/run-find-external.sh index 128d892..8f40e7e 100644 --- a/run-find-external.sh +++ b/run-find-external.sh @@ -11,7 +11,7 @@ echo "Create /etc/spack/no_rpm_trigger to stop spack to search for new packages # save old packages.yml, it has to be removed as when not # the new and old packages.yaml files would have to be # combined -mv /etc/spack/packages.yaml /etc/spack/packages.yaml.old +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} @@ -24,9 +24,11 @@ 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' - mv /var/lib/nobody/.spack/packages.yaml /etc/spack/packages.yaml - chown root:root /etc/spack/packages.yaml - rmdir /var/lib/nobody/.spack + 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' diff --git a/spack.spec b/spack.spec index 8089c2e..709180a 100644 --- a/spack.spec +++ b/spack.spec @@ -69,6 +69,7 @@ Requires: gcc-fortran Requires: gpg2 Requires: libbz2-devel Requires: lua-lmod +Requires: patch Requires: polkit Requires: spack-recipes Requires: sudo