SHA256
1
0
forked from pool/spack

Accepting request 854051 from network:cluster:staging

- added test for /etc/spack/no_rpm_trigger 

- added %triggerin and %triggerpostun for the packages which 
  can be detected by spack

- updated to 0.16.0
- added find for external packages
- added dockerfile for leap
  * added patchfile added-dockerfile-for-opensuse-leap-15.patch

- Add documentation (man and info pages, pdf doesn't build
  currently).
  * Do not ship documentation sources.
- Do not distribute Dockerfiles and other container related
  material, yet. This needs to be fixed so that the samples
  work with SUSE.
- Fully integrate spack into SUSE directory structure, fix
  paths where required.
  * Fix setup scripts to work correctly in above environment.

OBS-URL: https://build.opensuse.org/request/show/854051
OBS-URL: https://build.opensuse.org/package/show/network:cluster/spack?expand=0&rev=3
This commit is contained in:
2020-12-08 15:10:47 +00:00
committed by Git OBS Bridge
parent 21936ccf0b
commit a641c6661c
10 changed files with 444 additions and 45 deletions

View File

@@ -15,28 +15,49 @@
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global flavor @BUILD_FLAVOR@%{?nil}
%if "%{flavor}" == "doc"
%bcond_without doc
%endif
%if %{with doc} && (0%{?sle_version} > 0) && (150200 >= 0%{?sle_version})
ExclusiveArch: do_not_build
%endif
%define spack_dir %_prefix/lib/spack/
%define spack_group spack
# These packages are found and can be used by spack, /etc/spack/packages-yaml
# needs to be updated when one of these packages is updated or uninstalled.
# 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
# non oss packages
%define spack_trigger_external cuda-nvcc
Name: spack
Version: 0.15.4
Version: 0.16.0
Release: 0
Summary: Package manager for HPC systems
License: Apache-2.0 AND MIT AND Python-2.0 AND BSD-3-Clause
URL: https://spack.io
Source0: https://github.com/spack/spack/archive/v%{version}.tar.gz#/spack-%{version}.tar.gz
Source0: https://github.com/spack/spack/archive/v%{version}.tar.gz#/spack-%{version}.tar.gz
Source1: README.SUSE
Source1: spack-recipes-rpmlintrc
Source2: spack-rpmlintrc
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
Patch3: added-dockerfile-for-opensuse-leap-15.patch
# upstream patch removes also problemtatic binaries
#Patch4: spack-test-15702.patch
%if %{without doc}
BuildRequires: polkit
BuildRequires: fdupes
BuildRequires: python-base
BuildRequires: python3-urllib3
BuildRequires: lua-lmod
Requires: %{name}-recipes = %{version}
Requires: curl
Requires: lua-lmod
Requires: pattern() = devel_basis
Requires: polkit
Requires: gcc-fortran
Requires: gpg2
@@ -44,8 +65,25 @@ Requires: xz
Requires: bzip2
Requires: spack-recipes
Recommends: spack-recipes = %version
Recommends: %spack_trigger_recommended
%else
BuildRequires: patterns-base-basesystem
BuildRequires: spack
BuildRequires: makeinfo
BuildRequires: distribution-release
BuildRequires: %{python_module Sphinx >= 1.8}
BuildRequires: %{python_module sphinxcontrib-programoutput}
BuildRequires: git
# html
BuildRequires: graphviz
# info
BuildRequires: graphviz-gnome
## pdf
# BuildRequires: python3-Sphinx-latex
Requires: spack
%endif
BuildArch: noarch
%if 0%{?sle_version} <= 120500 && !0%{?is_opensuse}
%if 0%{?sle_version} <= 120500 && !0%{?is_opensuse}
%define __python3 python3
%endif
@@ -77,68 +115,127 @@ using different compilers, options, and MPI implementations.
This package contains the built-in package recipes.
%package man
Summary: Man Page for Spack - Package manager for HPC systems
Requires: man
%description man
Spack is a configurable Python-based HPC package manager, automating
the installation and fine-tuning of simulations and libraries.
It operates on a wide variety of HPC platforms and enables users
to build many code configurations. Software installed by Spack
runs correctly regardless of environment, and file management
is streamlined. Spack can install many variants of the same build
using different compilers, options, and MPI implementations.
This package contains the man page.
%package info
Summary: Info Page for Spack - Package manager for HPC systems
Requires: info
%description info
Spack is a configurable Python-based HPC package manager, automating
the installation and fine-tuning of simulations and libraries.
It operates on a wide variety of HPC platforms and enables users
to build many code configurations. Software installed by Spack
runs correctly regardless of environment, and file management
is streamlined. Spack can install many variants of the same build
using different compilers, options, and MPI implementations.
This package contains the info page.
%prep
%setup -q
%if %{without doc}
%autopatch -p1
# set SPACK_ROOT
for i in share/spack/setup-env.*; do
sed -i -e "s;@@_prefix@@;%_prefix;g" $i
done
%endif
%build
# Nothing to build
%if %{with doc}
cd lib/spack/docs
# Causes issues building texinfo as a suitable image cannot be found
grep -rl ":target:" | xargs sed -i -e "/:target:/s/^/#/" -e "/figure::/s/^/#/"
# Fix path to var - we install this to the 'real' /var
grep -rl "\$SPACK_ROOT/var" | xargs sed -i -e "s@\(.*\)\$SPACK_ROOT/var\(/spack.*\)@\1/var/lib\2@g"
# spack cannot run without knowing at least the compiler
spack compiler find
make man info #text dirhtml
gzip _build/texinfo/Spack.info _build/man/spack.1
%endif
%install
%doc %{S:1}
%if %{without doc}
cp %{S:1} .
# Fix some rpmlint warnings
## Remove files not required to run spack
rm -rf lib/spack/spack/test
rm -rf share/spack/qa
rm -rf share/spack/logo
rm -rf var/spack/repos/builtin.mock var/spack/gpg.mock var/spack/mock_configs
rm -rf lib/spack/external/ruamel/yaml/.ruamel
find . -type f -name .gitignore -delete
find . -type f -name .nojekyll -delete
# Fix _spack_root link
rm -f lib/spack/docs/_spack_root
ln -sf ../.. lib/spack/docs/_spack_root
# Do not ship Docker and container building for now - needs fixing
rm -rf share/spack/{templates/container}
rm -rf share/spack/docker/{centos,ubuntu}*.dockerfile
# Do not ship AWS specifics
rm -f share/spack/setup-tutorial-env.sh
# Fix rpmlint warnings
## No need for the standalone scripts
rm -f lib/spack/external/macholib/macho_*.py
## Fix shebangs
sed -i 's@#!/bin/env sh@#!/bin/bash@' var/spack/repos/builtin/packages/beast-tracer/tracer
sed -i 's@#!/usr/bin/env bash@#!/bin/bash@' share/spack/docker/package-index/split.sh
sed -i 's@#!/bin/env sh@#!/bin/bash@' var/spack/repos/builtin/packages/beast-tracer/tracer
sed -i 's@#! /usr/bin/env bash@ #!/bin/bash@' share/spack/docker/entrypoint.bash
sed -i 's@#!/usr/bin/env bash@#!/bin/bash@' share/spack/docker/package-index/split.sh
mkdir -p %{buildroot}%{spack_dir}
mkdir -p %{buildroot}%{spack_dir}/opt
mkdir -p %{buildroot}%{spack_dir}/bin
mkdir -p %{buildroot}%{_datarootdir}/spack
mkdir -p %{buildroot}%{_datarootdir}/spack/lib/spack
mkdir -p %{buildroot}%{_datarootdir}/spack/modules
mkdir -p %{buildroot}%{_localstatedir}/lib/spack
mkdir -p %{buildroot}%{_localstatedir}/lib/spack/junit-report
mkdir -p %{buildroot}%{_localstatedir}/cache/spack
mkdir -p %{buildroot}%{_sysconfdir}/skel/.spack/
mkdir -p %{buildroot}/%{_bindir}
# Link avoids having to fix paths
ln -sf %{buildroot}/%{_localstatedir}/cache/spack %{buildroot}%{_localstatedir}/lib/spack/cache
# Copy files to corresponding paths
cp -r etc lib %{buildroot}%{spack_dir}
cp -r etc %{buildroot}%{_prefix}
cp -r lib/spack/{env,external,llnl,spack} %{buildroot}%{spack_dir}
cp -r share/spack/* %{buildroot}%{_datarootdir}/spack
cp -r var/spack/* %{buildroot}%{_localstatedir}/lib/spack
cp -r bin/sbang %{buildroot}/%{_bindir}
cp -r bin/spack* %{buildroot}%{spack_dir}/bin
cp -r bin/spack* %{buildroot}%{_bindir}/
cp etc/spack/defaults/config.yaml %{buildroot}%{_sysconfdir}/skel/.spack/
sed -i 's@\(\sinstall_tree:\).*@\1 ~/spack/packages@' %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml
# Fix more paths
sed -i 's@\(\sroot:\) $spack/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@\(\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
# Timeout in seconds used for downloading sources etc. This only applies
# to the connection phase and can be increased for slow connections or
# servers. 0 means no timeout.
binary_index_root: ~/.spack/indices
EOF
# create spack scripts
echo -e '#!/bin/bash\n\nexec %{spack_dir}bin/$(basename $0) "${1+$@}"' > \
%{buildroot}%{_bindir}/spack
chmod 0755 %{buildroot}%{_bindir}/spack
ln -s spack %{buildroot}%{_bindir}/spack-python
ln -s %{_bindir}/sbang %{buildroot}%{spack_dir}/bin/sbang
# compile python files for python3
# %%{buildroot}%%{spack_dir}/spack
%py_compile .
# make shell scripts executeable
@@ -223,13 +320,24 @@ modules:
all: '{compiler.name}-{compiler.version}/{name}/{version}'
^mpi: '{compiler.name}-{compiler.version}/{^mpi.name}-{^mpi.version}/{name}/{version}'
EOF
mkdir -p %{buildroot}%{_sysconfdir}/spack
# Fix link to not point into buildroot
rm -f %{buildroot}%{_localstatedir}/lib/spack/cache
ln -sf %{_localstatedir}/cache/spack %{buildroot}%{_localstatedir}/lib/spack/cache
# Remove problematic binaries which are removed upstream with
# 0889be20e0d9dcdf4346cdeaa0647285187375f3
rm -r %{buildroot}%{_localstatedir}/lib/spack/repos/builtin/packages/patchelf/test/
%fdupes %{buildroot}%{spack_dir}
%fdupes %{buildroot}%{_datarootdir}/spack
%fdupes %{buildroot}%{_localstatedir}/lib/spack
%else
mkdir -p %{buildroot}%{_infodir}
mkdir -p %{buildroot}%{_mandir}/man1
cd lib/spack/docs/_build
cp man/spack.1.gz %{buildroot}%{_mandir}/man1/
cp -r texinfo/Spack.info.gz texinfo/Spack-figures %{buildroot}%{_infodir}
%endif
%pre
getent group %spack_group >/dev/null || groupadd -r %spack_group
@@ -254,16 +362,33 @@ if [ -e /etc/os-release ] ; then
sed -i "s@SUSE_VERSION@$SPACK_NAME@g" /etc/profile.d/spack.sh
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
%triggerin -- %{?spack_trigger_recommended} %{?spack_trigger_packages} %{?spack_trigger_external}
test -e %{_sysconfdir}/spack/no_rpm_trigger || spack external find --scope system
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"
%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
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"
%if %{without doc}
%files
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT
%doc CHANGELOG.md NOTICE README.md
%doc CHANGELOG.md NOTICE README.md README.SUSE
%dir %{_sysconfdir}/spack/
%{_bindir}/*
%if 0%{?suse_version} <= 1500
%dir %{_prefix}/etc
%endif
%{_prefix}/etc/spack
%attr(0775, root, spack) %{_localstatedir}/lib/spack/junit-report
%attr(0775, root, spack) %{spack_dir}/opt
%attr(0775, root, spack) %{_localstatedir}/cache/spack
%attr(0775, root, spack) %{_datarootdir}/spack/modules
%{_prefix}/lib/spack
%{spack_dir}
%{_localstatedir}/cache/spack
%{_localstatedir}/lib/spack
%{_datarootdir}/spack
@@ -274,11 +399,18 @@ sed -i "s@HOSTTYPE@$HOSTTYPE@" %{spack_dir}/etc/spack/compilers.yaml
# repos directory is installed in -recipes
%exclude %{_localstatedir}/lib/spack/repos
%files recipes
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT
%doc CHANGELOG.md NOTICE README.md
%{_localstatedir}/lib/spack/repos
%else
%files man
%{_mandir}/man1/*
%files info
%{_infodir}/*
%endif
%changelog