!1 package init

From: @wangxiao65
Reviewed-by: @small_leek
Signed-off-by: @small_leek
This commit is contained in:
openeuler-ci-bot 2020-10-31 09:17:11 +08:00 committed by Gitee
commit 3702afbe22
5 changed files with 136 additions and 0 deletions

BIN
Lmod-8.1.17.tar.gz Normal file

Binary file not shown.

109
Lmod.spec Normal file
View File

@ -0,0 +1,109 @@
%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
# We'd like to be noarch, but Lmod encodes the system lua path
%global debug_package %{nil}
Name: Lmod
Version: 8.1.17
Release: 1
Summary: Environmental Modules System in Lua
License: MIT and LGPLv2
URL: https://github.com/TACC/Lmod
Source0: https://github.com/TACC/Lmod/archive/%{version}.tar.gz#/Lmod-%{version}.tar.gz
Source1: macros.%{name}
# redirect echo stmts to stderr in init/bash.in
# Having them go to stdout breaks openQA tests when Lmod is installed
# Backported version of
# https://github.com/TACC/Lmod/commit/fa2e3a1a84951b38a56c76391e6b0c340c0199a7
Patch0: lmod-8.1.17-echo_stderr.patch
BuildRequires: gcc
BuildRequires: lua-devel
BuildRequires: lua-filesystem
BuildRequires: lua-json
BuildRequires: lua-posix
BuildRequires: lua-term
BuildRequires: tcl-devel
BuildRequires: zsh
Requires: lua-filesystem
Requires: lua-json
Requires: lua-posix
Requires: lua-term
Requires: /usr/bin/ps
Provides: environment(modules)
%description
Lmod is a Lua based module system that easily handles the MODULEPATH
Hierarchical problem. Environment Modules provide a convenient way to
dynamically change the users' environment through modulefiles. This includes
easily adding or removing directories to the PATH environment variable.
Modulefiles for library packages provide environment variables that specify
where the library and header files can be found.
%prep
%setup -q
%patch0 -p1
sed -i -e 's,/usr/bin/env ,/usr/bin/,' src/*.tcl
# Remove bundled lua-filesystem and lua-term
rm -r pkgs/{luafilesystem,term} tools/json.lua
#sed -i -e 's, pkgs , ,' Makefile.in
# Remove unneeded shbangs
sed -i -e '/^#!/d' init/*.in
%build
%if 0%{?rhel} && 0%{?rhel} <= 6
%configure --prefix=%{_datadir} PS=/bin/ps
%else
%configure --prefix=%{_datadir} PS=/usr/bin/ps
%endif
%make_build
%install
%make_install
# init scripts are sourced
find %{buildroot}%{_datadir}/lmod/%{version}/init -type f -exec chmod -x {} +
mkdir -p %{buildroot}%{_sysconfdir}/modulefiles
mkdir -p %{buildroot}%{_datadir}/modulefiles
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
cat <<'EOF' > %{buildroot}%{_sysconfdir}/profile.d/00-modulepath.sh
[ -z "$MODULEPATH" ] &&
[ "$(readlink /etc/alternatives/modules.sh)" = "/usr/share/lmod/lmod/init/profile" -o -f /etc/profile.d/z00_lmod.sh ] &&
export MODULEPATH=%{_sysconfdir}/modulefiles:%{_datadir}/modulefiles || :
EOF
cat << 'EOF' > %{buildroot}%{_sysconfdir}/profile.d/00-modulepath.csh
if (! $?MODULEPATH && ( `readlink /etc/alternatives/modules.csh` == /usr/share/lmod/lmod/init/cshrc || -f /etc/profile.d/z00_lmod.csh ) ) then
setenv MODULEPATH %{_sysconfdir}/modulefiles:%{_datadir}/modulefiles
endif
EOF
# Add a snippet to make sure that the 00-modulepath.* is included, when
# the user calls /etc/profile.d/modules.sh directly, just below
# the shbang line.
sed -i '2i\. /etc/profile.d/00-modulepath.sh\n' \
%{buildroot}%{_datadir}/lmod/lmod/init/profile
# Install the rpm config file
install -Dpm 644 %{SOURCE1} %{buildroot}/%{macrosdir}/macros.%{name}
%files
%license License
%doc INSTALL README.md README_lua_modulefiles.txt
%{_sysconfdir}/modulefiles
%config(noreplace) %{_sysconfdir}/profile.d/00-modulepath.csh
%config(noreplace) %{_sysconfdir}/profile.d/00-modulepath.sh
%ghost %{_sysconfdir}/profile.d/modules.csh
%ghost %{_sysconfdir}/profile.d/modules.sh
%{_datadir}/lmod
%{_datadir}/modulefiles
%{macrosdir}/macros.%{name}
%changelog
* Fri Oct 10 2020 wangxiao <wangxiao65@huawei.com> - 8.1.17-1
- package init.

4
Lmod.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: TACC/Lmod
tag_prefix: ""
seperator: .

View File

@ -0,0 +1,20 @@
--- Lmod-8.1.17/init/bash.in 2019-12-11 11:20:35.213144077 -0800
+++ Lmod-8.1.17/init/bash.in.new 2019-12-11 11:17:24.024473520 -0800
@@ -18,7 +18,7 @@
export LMOD_PKG=@PKGV@
if [ -n "${__lmod_vx:-}" ]; then
- echo "Shell debugging temporarily silenced: export LMOD_SH_DBG_ON=1 for this output ($LMOD_PKG/init/bash)"
+ echo "Shell debugging temporarily silenced: export LMOD_SH_DBG_ON=1 for this output ($LMOD_PKG/init/bash)" 1>&2
fi
export LMOD_DIR=$LMOD_PKG/libexec
@@ -163,7 +163,7 @@
# Restoring XTRACE and VERBOSE states.
if [ -n "${__lmod_vx:-}" ]; then
- echo "Shell debugging restarted"
+ echo "Shell debugging restarted" 1>&2
set -$__lmod_vx;
unset __lmod_vx;
fi;

3
macros.Lmod Normal file
View File

@ -0,0 +1,3 @@
# RPM macros for environment modules
%_modulesdir %{_datadir}/modulefiles