2020-11-19 15:49:24 +01:00
#
# spec file for package spack
#
2021-02-04 19:31:35 +01:00
# Copyright (c) 2021 SUSE LLC
2020-11-19 15:49:24 +01:00
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
2021-02-04 19:31:35 +01:00
2020-12-08 16:10:47 +01:00
%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
2020-11-19 15:49:24 +01:00
%define spack_dir %_prefix/lib/spack/
%define spack_group spack
2020-12-08 16:10:47 +01:00
# 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
2020-11-19 15:49:24 +01:00
Name : spack
2020-12-08 16:10:47 +01:00
Version : 0.16.0
2020-11-19 15:49:24 +01:00
Release : 0
Summary : Package manager for HPC systems
2021-02-04 19:31:35 +01:00
License : Apache-2.0 AND MIT AND Python-2.0 AND BSD-3-Clause
2020-11-19 15:49:24 +01:00
URL : https://spack.io
2020-12-08 16:10:47 +01:00
Source0 : https://github.com/spack/spack/archive/v%{version} .tar.gz#/spack-%{version}.tar.gz
2020-11-19 16:23:20 +01:00
Source1 : README.SUSE
2020-12-08 16:10:47 +01:00
Source2 : spack-rpmlintrc
2020-11-19 15:49:24 +01:00
Patch0 : Make-spack-paths-compliant-to-distro-installation.patch
Patch1 : fix-tumbleweed-naming.patch
2020-12-08 16:10:47 +01:00
Patch2 : Adapt-shell-scripts-that-set-up-the-environment-for-different-shells.patch
Patch3 : added-dockerfile-for-opensuse-leap-15.patch
2020-12-11 16:11:15 +01:00
Patch4 : added-target-and-os-calls-to-output-of-spack-spec-co.patch
2021-02-04 19:31:35 +01:00
Patch5 : Fix-documentation-so-that-parser-doesn-t-stumble.patch
Patch6 : Fix-error-during-documentation-build-due-to-recursive-module-inclusion.patch
2020-12-08 16:10:47 +01:00
# upstream patch removes also problemtatic binaries
#Patch4: spack-test-15702.patch
%if %{without doc}
2020-11-19 15:49:24 +01:00
BuildRequires : fdupes
2021-02-04 19:31:35 +01:00
BuildRequires : lua-lmod
BuildRequires : polkit
2020-11-19 15:49:24 +01:00
BuildRequires : python-base
2020-12-08 16:10:47 +01:00
BuildRequires : python3-urllib3
2020-11-19 15:49:24 +01:00
Requires : %{name} -recipes = %{version}
2021-02-04 19:31:35 +01:00
Requires : bzip2
2020-11-19 15:49:24 +01:00
Requires : curl
Requires : gcc-fortran
Requires : gpg2
2021-02-04 19:31:35 +01:00
Requires : lua-lmod
Requires : polkit
2020-11-19 15:49:24 +01:00
Requires : spack-recipes
2021-02-04 19:31:35 +01:00
Requires : xz
2020-11-19 15:49:24 +01:00
Recommends: spack-recipes = %version
2020-12-08 16:10:47 +01:00
Recommends: %spack_trigger_recommended
%else
BuildRequires : %{python_module Sphinx >= 1.8}
BuildRequires : %{python_module sphinxcontrib-programoutput}
2021-02-04 19:31:35 +01:00
BuildRequires : distribution-release
2020-12-08 16:10:47 +01:00
BuildRequires : git
2021-02-04 19:31:35 +01:00
BuildRequires : makeinfo
BuildRequires : patterns-base-basesystem
BuildRequires : spack
2020-12-08 16:10:47 +01:00
# html
BuildRequires : graphviz
# info
BuildRequires : graphviz-gnome
## pdf
# BuildRequires: python3-Sphinx-latex
Requires : spack
%endif
2020-11-19 15:49:24 +01:00
BuildArch : noarch
2020-12-08 16:10:47 +01:00
%if 0%{?sle_version} <= 120500 && !0%{?is_opensuse}
2020-11-19 15:49:24 +01:00
%define __python3 python3
%endif
%description
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 provides a module file that must be loaded to use spack.
%package recipes
Summary : Spack built-in package recipes
Requires : %{name} >= %version
%description recipes
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 built-in package recipes.
2020-12-08 16:10:47 +01:00
%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.
2020-11-19 15:49:24 +01:00
%prep
%setup -q
%autopatch -p1
2020-12-11 16:11:15 +01:00
%if %{without doc}
2020-11-19 15:49:24 +01:00
2020-12-08 16:10:47 +01:00
# set SPACK_ROOT
for i in share/spack/setup-env.*; do
sed -i -e " s ; @ @ _ p r e f i x @ @ ; %_prefix ; g " $i
done
%endif
2020-11-19 15:49:24 +01:00
%build
# Nothing to build
2020-12-08 16:10:47 +01:00
%if %{with doc}
cd lib/spack/docs
# Causes issues building texinfo as a suitable image cannot be found
grep -rl " : t a r g e t : " | xargs sed -i -e " / : t a r g e t : / s / ^ / # / " -e " / f i g u r e : : / s / ^ / # / "
# Fix path to var - we install this to the 'real' /var
grep -rl " \ $ S P A C K _ R O O T / v a r " | xargs sed -i -e " s @ \ ( . * \ ) \ $ S P A C K _ R O O T / v a r \ ( / s p a c k . * \ ) @ \1 / v a r / l i b \2 @ g "
2020-12-11 16:11:15 +01:00
# spack cannot run without knowing at least the compiler, so we inject
# a dummy one
mkdir -p ${HOME}/.spack/linux/
cat > ${HOME}/.spack/linux/compilers.yaml <<EOF
compilers:
- compiler:
spec: gcc@7.5.0
paths:
cc: /usr/bin/gcc
cxx: /usr/bin/g++
f77: /usr/bin/gfortran
fc: /usr/bin/gfortran
flags: {}
operating_system: SUSE
target: x86_64
modules: []
environment:
unset: []
extra_rpaths: []
EOF
2020-12-08 16:10:47 +01:00
make man info #text dirhtml
gzip _build/texinfo/Spack.info _build/man/spack.1
%endif
2020-11-19 15:49:24 +01:00
%install
2020-12-08 16:10:47 +01:00
%if %{without doc}
cp %{S:1} .
2020-11-19 15:49:24 +01:00
# Fix some rpmlint warnings
## Remove files not required to run spack
rm -rf lib/spack/spack/test
rm -rf share/spack/qa
2020-12-08 16:10:47 +01:00
rm -rf share/spack/logo
2020-11-19 15:49:24 +01:00
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
2020-12-08 16:10:47 +01:00
# Fix _spack_root link
2020-11-19 15:49:24 +01:00
rm -f lib/spack/docs/_spack_root
ln -sf ../.. lib/spack/docs/_spack_root
2020-12-08 16:10:47 +01:00
# 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
2020-11-19 15:49:24 +01:00
## No need for the standalone scripts
rm -f lib/spack/external/macholib/macho_*.py
## Fix shebangs
2020-12-08 16:10:47 +01:00
sed -i 's@#!/bin/env sh@#!/bin/bash@' var/spack/repos/builtin/packages/beast-tracer/tracer
2020-11-19 15:49:24 +01:00
sed -i 's@#! /usr/bin/env bash@ #!/bin/bash@' share/spack/docker/entrypoint.bash
2020-12-08 16:10:47 +01:00
sed -i 's@#!/usr/bin/env bash@#!/bin/bash@' share/spack/docker/package-index/split.sh
2020-11-19 15:49:24 +01:00
mkdir -p %{buildroot} %{spack_dir}
mkdir -p %{buildroot} %{spack_dir} /opt
2020-12-08 16:10:47 +01:00
mkdir -p %{buildroot} %{_datarootdir} /spack/lib/spack
2020-11-19 15:49:24 +01:00
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}
2020-12-08 16:10:47 +01:00
# Link avoids having to fix paths
2020-11-19 15:49:24 +01:00
ln -sf %{buildroot} /%{_localstatedir} /cache/spack %{buildroot} %{_localstatedir} /lib/spack/cache
# Copy files to corresponding paths
2020-12-08 16:10:47 +01:00
cp -r etc %{buildroot} %{_prefix}
cp -r lib/spack/{env,external,llnl,spack} %{buildroot} %{spack_dir}
2020-11-19 15:49:24 +01:00
cp -r share/spack/* %{buildroot} %{_datarootdir} /spack
cp -r var/spack/* %{buildroot} %{_localstatedir} /lib/spack
cp -r bin/sbang %{buildroot} /%{_bindir}
2020-12-08 16:10:47 +01:00
cp -r bin/spack* %{buildroot} %{_bindir} /
2020-11-19 15:49:24 +01:00
cp etc/spack/defaults/config.yaml %{buildroot} %{_sysconfdir} /skel/.spack/
2020-12-08 16:10:47 +01:00
# Fix more paths
sed -i 's@\(\sroot:\) $spack/opt/spack@\1 ~/spack/packages@' %{buildroot} %{_sysconfdir} /skel/.spack/config.yaml
2020-11-19 15:49:24 +01:00
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
2020-12-08 16:10:47 +01:00
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
2020-11-19 15:49:24 +01:00
# compile python files for python3
2020-12-08 16:10:47 +01:00
# %%{buildroot}%%{spack_dir}/spack
2020-11-19 15:49:24 +01:00
%py_compile .
# make shell scripts executeable
find %{buildroot} %{_localstatedir} /lib/spack/ -type f -name \*.sh -exec chmod 755 {} \;
# Create /etc/spack/compilers.yaml
mkdir -p %{buildroot} %{spack_dir} /etc/spack/
cat > %{buildroot} %{spack_dir} /etc/spack/compilers.yaml <<EOF
compilers:
- compiler:
spec: gcc@GCC_FULL_VERSION
paths:
cc: /usr/bin/gcc-GCC_VERSION
cxx: /usr/bin/g++-GCC_VERSION
f77: /usr/bin/gfortran-GCC_VERSION
fc: /usr/bin/gfortran-GCC_VERSION
flags: {}
operating_system: SUSE_VERSION
target: HOSTTYPE
modules: []
environment:
unset: []
extra_rpaths: []
EOF
# Create /etc/profile.d/spack.sh
# This file properly sets MODULEPATH so lua-lmod can find the modules created by spack
mkdir -p %{buildroot} /%{_sysconfdir} /profile.d
cat > %{buildroot} /%{_sysconfdir} /profile.d/spack.sh <<EOF
source /etc/os-release
if [ " \ $ { I D } " == " o p e n s u s e - t u m b l e w e e d " ] ; then
SPACK_NAME=" \ $ { I D / - / } "
else
SPACK_NAME=" \ $ { I D / - / _ } \ $ { V E R S I O N _ I D / . * / } "
fi
export SPACK_ROOT=%{spack_dir}
export MODULEPATH=~/spack/lmod/linux-\${SPACK_NAME}-\${CPU}:%{_prefix} /share/spack/lmod/linux-\${SPACK_NAME}-\${CPU}:\${MODULEPATH}
# copy local configuration, if its not there
if [ ! -e ~/.spack/config.yaml ] ; then
# test if user is in spack group by touching database
if ! touch %{spack_dir} /.spack-db &> /dev/null ; then
test -e ~/.spack || mkdir -p ~/.spack
[ -e ~/.spack/config.yaml ] || \
cp -r %{_sysconfdir} /skel/.spack/config.yaml ~/.spack/
fi
fi
EOF
# Same for csh
cat > %{buildroot} /%{_sysconfdir} /profile.d/spack.csh <<EOF
# get ID
eval \`awk '/^ID=/ {sub("-","_"); printf("set %%s",\$0);}' /etc/os-release\`
# get VERSION_ID
eval \`awk '/^VERSION_ID=/ {sub("\\\\.[0-9]",""); printf("set %%s",\$0);}' /etc/os-release\`
if ( \$ID == " o p e n s u s e _ t u m b l e w e e d " ) then
eval \`awk '/^ID=/ {sub("-",""); printf("set %%s",\$0);}' /etc/os-release\`
set SPACK_NAME=\$ID
else
set SPACK_NAME=" \ $ { I D } \ $ { V E R S I O N _ I D } "
endif
set SPACK_ROOT=" %{spack_dir} "
set MODULEPATH=" ~ / s p a c k / l m o d / l i n u x - \ $ { S P A C K _ N A M E } - \ $ { C P U } : %{_prefix} / s h a r e / s p a c k / l m o d / l i n u x - \ $ { S P A C K _ N A M E } - \ $ { C P U } : \ $ { M O D U L E P A T H } "
if ( ! -e ~/.spack/config.yaml ) then
# test if user is in spack group by touching database
touch %{spack_dir} /.spack-db >& /dev/null
if ( \$? == 1 ) then
test -e ~/.spack || mkdir -p ~/.spack
test -e ~/.spack/config.yaml || \
cp -r %{_sysconfdir} /skel/.spack/config.yaml ~/.spack/
endif
endif
EOF
# Create modules.yaml file, so that hierarchy module files are created
cat > %{buildroot} %{spack_dir} /etc/spack/modules.yaml <<EOF
modules:
enable:
- lmod
lmod:
core_compilers:
- 'gcc@GCC_FULL_VERSION'
projections:
all: '{compiler.name}-{compiler.version}/{name}/{version}'
^mpi: '{compiler.name}-{compiler.version}/{^mpi.name}-{^mpi.version}/{name}/{version}'
EOF
2020-12-08 16:10:47 +01:00
mkdir -p %{buildroot} %{_sysconfdir} /spack
2020-11-19 15:49:24 +01:00
# Fix link to not point into buildroot
rm -f %{buildroot} %{_localstatedir} /lib/spack/cache
ln -sf %{_localstatedir} /cache/spack %{buildroot} %{_localstatedir} /lib/spack/cache
2020-12-08 16:10:47 +01:00
# Remove problematic binaries which are removed upstream with
# 0889be20e0d9dcdf4346cdeaa0647285187375f3
rm -r %{buildroot} %{_localstatedir} /lib/spack/repos/builtin/packages/patchelf/test/
2020-11-19 15:49:24 +01:00
%fdupes %{buildroot} %{spack_dir}
%fdupes %{buildroot} %{_datarootdir} /spack
%fdupes %{buildroot} %{_localstatedir} /lib/spack
2020-12-08 16:10:47 +01:00
%else
mkdir -p %{buildroot} %{_infodir}
mkdir -p %{buildroot} %{_mandir} /man1
cd lib/spack/docs/_build
cp man/spack.1.gz %{buildroot} %{_mandir} /man1/
2021-02-04 19:31:35 +01:00
cp -r texinfo/Spack.info.gz %{buildroot} %{_infodir}
[ -d texinfo/Spack-figures ] && cp -r texinfo/Spack-figures %{buildroot} %{_infodir}
2020-12-08 16:10:47 +01:00
%endif
2020-11-19 15:49:24 +01:00
%pre
getent group %spack_group >/dev/null || groupadd -r %spack_group
%post
# Replace /etc/spack/compilers.yaml
export GCC_VERSION=`gcc -dumpversion`
export GCC_FULL_VERSION=`gcc -dumpfullversion`
sed -i " s @ G C C _ F U L L _ V E R S I O N @ $ G C C _ F U L L _ V E R S I O N @ " %{spack_dir} /etc/spack/compilers.yaml
sed -i " s @ G C C _ F U L L _ V E R S I O N @ $ G C C _ F U L L _ V E R S I O N @ " %{spack_dir} /etc/spack/modules.yaml
sed -i " s @ G C C _ V E R S I O N @ $ G C C _ V E R S I O N @ " %{spack_dir} /etc/spack/compilers.yaml
if [ -e /etc/os-release ] ; then
source /etc/os-release
if [ " $ { I D } " == " o p e n s u s e - t u m b l e w e e d " ] ; then
export SPACK_NAME=" $ { I D / - / } "
else
export SPACK_NAME=" $ { I D / - / _ } $ { V E R S I O N _ I D / . * / } "
fi
sed -i " s @ S U S E _ V E R S I O N @ $ S P A C K _ N A M E @ " %{spack_dir} /etc/spack/compilers.yaml
sed -i " s @ S U S E _ V E R S I O N @ $ S P A C K _ N A M E @ g " /etc/profile.d/spack.sh
fi
sed -i " s @ H O S T T Y P E @ $ H O S T T Y P E @ " %{spack_dir} /etc/spack/compilers.yaml
2020-12-08 16:10:47 +01:00
# find installed programms
test -e %{_sysconfdir} /spack/no_rpm_trigger || spack external find --scope system
2020-11-19 15:49:24 +01:00
2020-12-08 16:10:47 +01:00
%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 " C r e a t e %{_sysconfdir} / s p a c k / n o _ r p m _ t r i g g e r t o s t o p s p a c k t o s e a r c h f o r n e w p a c k a g e s a f t e r a r p m i n s t a l l "
2021-02-04 19:31:35 +01:00
2020-12-08 16:10:47 +01:00
%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 " C r e a t e %{_sysconfdir} / s p a c k / n o _ r p m _ t r i g g e r t o s t o p s p a c k t o s e a r c h f o r n e w p a c k a g e s a f t e r a r p m i n s t a l l "
%if %{without doc}
2020-11-19 15:49:24 +01:00
%files
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT
2020-12-08 16:10:47 +01:00
%doc CHANGELOG.md NOTICE README.md README.SUSE
%dir %{_sysconfdir} /spack/
2020-11-19 15:49:24 +01:00
%{_bindir} /*
2020-12-08 16:10:47 +01:00
%if 0%{?suse_version} <= 1500
%dir %{_prefix} /etc
%endif
%{_prefix} /etc/spack
2020-11-19 15:49:24 +01:00
%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
2020-12-08 16:10:47 +01:00
%{spack_dir}
2020-11-19 15:49:24 +01:00
%{_localstatedir} /cache/spack
%{_localstatedir} /lib/spack
%{_datarootdir} /spack
%config %{_sysconfdir} /profile.d/spack.sh
%config %{_sysconfdir} /profile.d/spack.csh
%dir %{_sysconfdir} /skel/.spack
%config %{_sysconfdir} /skel/.spack/config.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
2020-12-08 16:10:47 +01:00
%else
2021-02-04 19:31:35 +01:00
%post info
%install _info --info-dir=%{_infodir} --info-file="%{_infodir}/Spack.info.gz"
%preun info
%install _info_delete --info-dir=%{_infodir} --info-file="%{_infodir}/Spack.info.gz"
2020-12-08 16:10:47 +01:00
%files man
%{_mandir} /man1/*
%files info
%{_infodir} /*
%endif
2020-11-19 15:49:24 +01:00
%changelog