File ohpc.spec of Package ohpc
#
# spec file for package ohpc
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
%include %{_sourcedir}/OHPC_macros
Summary: OpenHPC compatibility environment setup
Name: ohpc
Version: 1.2
Release: 1
License: BSD-3-Clause
Group: Productivity/Clustering/Computing
URL: https://github.com/openhpc/ohpc
BuildArch: noarch
Source0: OHPC_macros
Source1: LICENSE
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: lua-lmod
Requires: lmod-ohpc
%description
Provide rpm macros for compatibility with the OpenHPC project
%prep
%build
%{__cp} %{S:1} .
%install
%{__mkdir_p} %{buildroot}/%{_sysconfdir}/profile.d
%{__cp} %{S:0} %{buildroot}/%{_sysconfdir}/profile.d/ohpc.macros
%{__mkdir_p} %{buildroot}/%{_sysconfdir}/profile.d
%{__cat} <<EOF > %{buildroot}/%{_sysconfdir}/profile.d/lmod.sh
# -*- shell-script -*-
########################################################################
# This is the system wide source file for setting up
# modules:
#
########################################################################
# NOOP if running under known resource manager
if [ ! -z "\$SLURM_NODELIST" ];then
return
fi
export LMOD_SETTARG_CMD=":"
export LMOD_FULL_SETTARG_SUPPORT=no
export LMOD_COLORIZE=no
export LMOD_PREPEND_BLOCK=normal
if [ \$EUID -eq 0 ]; then
MODULEPATH=%{OHPC_ADMIN}/modulefiles:%{lua_lmod_admin_modulesdir}
MODULEPATH=${MODULEPATH}:%{OHPC_MODULES}
MODULEPATH=${MODULEPATH}:%{lua_lmod_modulesdir}
export MODULEPATH
else
export MODULEPATH=%{OHPC_MODULES}:%{lua_lmod_modulesdir}
fi
export BASH_ENV=%{_datadir}/lmod/lmod/init/bash
# Initialize modules system
. \$BASH_ENV >/dev/null
# Load baseline OpenHPC environment
module try-add ohpc
EOF
%{__cat} <<EOF > %{buildroot}/%{_sysconfdir}/profile.d/lmod.csh
# -*- shell-script -*-
########################################################################
# This is the system wide source file for setting up
# modules:
#
########################################################################
if ( \$?SLURM_NODELIST ) then
setenv LMOD_SETTARG_CMD ":"
setenv LMOD_FULL_SETTARG_SUPPORT "no"
setenv LMOD_COLORIZE "no"
setenv LMOD_PREPEND_BLOCK "normal"
if ( \`id -u\` == "0" ) then
setenv MODULEPATH "%{OHPC_ADMIN}/modulefiles}
setenv MODULEPATH "$MODULEPATH:%{lua_lmod_admin_modulesdir}"
setenv MODULEPATH "$MODULEPATH:%{OHPC_MODULES}"
setenv MODULEPATH "$MODULEPATH:"%{lua_lmod_modulesdir}"
else
setenv MODULEPATH "%{OHPC_MODULES}:%{lua_lmod_modulesdir}"
endif
# Initialize modules system
source %{_datadir}/lmod/lmod/init/csh >/dev/null
# Load baseline OpenHPC environment
module try-add ohpc
endif
EOF
%files
%defattr(-,root,root,-)
%config %{_sysconfdir}/profile.d/ohpc.macros
%doc LICENSE
%config %{_sysconfdir}/profile.d/lmod.sh
%config %{_sysconfdir}/profile.d/lmod.csh
%changelog