Skip to content

Commit

Permalink
Merge pull request #89 from fgeorgatos/fgeorgatos-Lmod-7.5.1
Browse files Browse the repository at this point in the history
Lmod 7.6.x, bugfixed .spec and paraphernalia; attempt to deliver SETTARG for all
  • Loading branch information
fgeorgatos authored Jul 28, 2017
2 parents dea0847 + 6593f8d commit 0a6a8e5
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 42 deletions.
10 changes: 5 additions & 5 deletions 00-INIT-MODULES.csh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ if (! $?MODULEPATH) then
setenv MODULEPATH /etc/modulefiles:/usr/share/modulefiles:/usr/share/Modules/modulefiles:/etc/site/modules

## Initializations
setenv LMOD_RC /etc/site/extras/lmodrc.lua
##setenv LMOD_SYSTEM_NAME AVX2
##setenv LMOD_SYSTEM_DEFAULT_MODULES "HPCBIOS/2015q2 sge"
setenv LMOD_SYSTEM_DEFAULT_MODULES "sge cluster"
setenv LMOD_RC /etc/site/lmod/lmodrc.lua
setenv LMOD_SYSTEM_DEFAULT_MODULES "settarg use.own.eb HPCBIOS/2016q2 sge cluster"
setenv LMOD_FULL_SETTARG_SUPPORT yes
setenv LMOD_TMOD_FIND_FIRST yes
setenv LMOD_ADMIN_FILE /dev/shm/lmod/lmod_admin_file
setenv LMOD_PACKAGE_PATH /etc/site/lmod

endif
9 changes: 5 additions & 4 deletions 00-INIT-MODULES.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ if [ -z "$MODULEPATH" ]; then
export MODULEPATH=/etc/modulefiles:/usr/share/modulefiles:/usr/share/Modules/modulefiles:/etc/site/modules

## Initializations
export LMOD_RC=/etc/site/extras/lmodrc.lua
##export LMOD_SYSTEM_NAME=AVX2
##export LMOD_SYSTEM_DEFAULT_MODULES="HPCBIOS/2015q2 sge"
export LMOD_SYSTEM_DEFAULT_MODULES="sge cluster"
export LMOD_RC=/etc/site/lmod/lmodrc.lua
export LMOD_SYSTEM_DEFAULT_MODULES="settarg use.own.eb HPCBIOS/2016q2 sge cluster"
export LMOD_FULL_SETTARG_SUPPORT=yes
export LMOD_TMOD_FIND_FIRST=yes
export LMOD_ADMIN_FILE=/dev/shm/lmod/lmod_admin_file
export LMOD_PACKAGE_PATH=/etc/site/lmod

fi
17 changes: 17 additions & 0 deletions DefaultModules.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- System wide default modules that get loaded
-- This is referenced by LMOD_SYSTEM_DEFAULT_MODULES

function chomp(s)
s = string.gsub(s, '^%s+', '')
s = string.gsub(s, '%s+$', '')
s = string.gsub(s, '[\n\r]+', ' ')
return s
end

local uid, status = chomp(capture("/usr/bin/id -u"))

if uid == "0" then
load("shared", "cmd", "cmsh", "cluster-tools", "slurm")
else
load("shared") -- DEFAULT_MODULES_OTHER
end
12 changes: 7 additions & 5 deletions Lmod-illumina-prepare.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@

export CWD=`pwd`

RPMDIR=$HOME/rpmbuild/SOURCES
if [ -d /usr/src/redhat ]
then export RPMDIR=/usr/src/redhat/SOURCES
else export RPMDIR=/usr/src/packages/SOURCES
then if [ ! -x $RPMDIR ]
then export RPMDIR=/usr/src/redhat/SOURCES
fi
fi


NAME=Lmod-files
CMVERSION=7.0

export CWD=`pwd`
cd $CWD

TMPDIR=/tmp/$NAME-build-$RANDOM
TMPDIR=/tmp/$NAME-build-$RANDOM-$$

cp *.patch $RPMDIR/

mkdir -p $TMPDIR/$NAME-$CMVERSION

cp *.sh $TMPDIR/$NAME-$CMVERSION
cp *.csh $TMPDIR/$NAME-$CMVERSION
cp *.lua $TMPDIR/$NAME-$CMVERSION

cd $TMPDIR
tar -zcvf $RPMDIR/$NAME-$CMVERSION.tar.gz $NAME-$CMVERSION
echo $RPMDIR/$NAME-$CMVERSION.tar.gz
rm -rf $TMPDIR
63 changes: 38 additions & 25 deletions Lmod-illumina.spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
%define release cm7.0
%define name Lmod
%define secname Lmod-files
%define version 7.5.0
%define version 7.6
%define debug_package %{nil}

%define rhel6_based %(test -e /etc/redhat-release && grep -q -E '(CentOS|Red Hat Enterprise Linux Server|Scientific Linux) release 6' /etc/redhat-release && echo 1 || echo 0)
Expand All @@ -18,10 +18,10 @@
%endif

%if %{rhel6_based}
%define git_rev %(git rev-list master --first-parent | wc -l)
%define git_rev %(git rev-list HEAD --first-parent | wc -l)
%endif

%define git_tag dfe38e4
%define git_tag 11012bc
%define lmod_upstream_gitid git-%{git_tag}

%if %{rhel6_based}
Expand Down Expand Up @@ -49,12 +49,16 @@ BuildRequires: lua-filesystem
BuildRequires: lua-json
BuildRequires: lua-posix
BuildRequires: lua-term
%if %{rhel6_based}
BuildRequires: lua-bit32
Requires: lua-bit32
%endif
Requires: lua
Requires: lua-filesystem
Requires: lua-json
Requires: lua-posix
Requires: lua-term
Requires: cm-config-cm = %cmrelease
###Requires: cm-config-cm = %cmrelease ### unhash me when all is fine
Provides: environment(modules)
Patch0: lmod-bash-xtrace.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Expand Down Expand Up @@ -89,32 +93,39 @@ make %{?_smp_mflags}
%install
make install DESTDIR=$RPM_BUILD_ROOT

mkdir -p %{buildroot}%{_sysconfdir}/site/lmod
install -m 644 contrib/SitePackage/SitePackage.lua %{buildroot}%{_sysconfdir}/site/lmod/SitePackage.lua
mkdir -p %{buildroot}%{_sysconfdir}/site/lmod ## Local lmod customizations, fi. SitePackage.lua, lmodrc.lua
mkdir -p %{buildroot}%{_sysconfdir}/site/modules ## intentionally distinct from /etc/modulefiles, for more control
install -m 644 contrib/Bright/SitePackage.lua %{buildroot}%{_sysconfdir}/site/lmod/SitePackage.lua

# init scripts are sourced
chmod -x %{buildroot}%{_datadir}/lmod/%{version}/init/*
mkdir -p %{buildroot}%{_sysconfdir}/modulefiles
mkdir -p %{buildroot}%{_datadir}/modulefiles
mkdir -p %{buildroot}%{_sysconfdir}/modulefiles
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
mkdir -p %{buildroot}%{_datadir}/lmod/%{version}/templates

install -m 644 %{secname}-%{cmrelease}/00-modulepath.sh %{buildroot}/%{_sysconfdir}/profile.d/00-modulepath.sh
install -m 644 %{secname}-%{cmrelease}/00-modulepath.csh %{buildroot}/%{_sysconfdir}/profile.d/00-modulepath.csh
install -m 644 %{secname}-%{cmrelease}/00-USER_IS_ROOT.sh %{buildroot}/%{_sysconfdir}/profile.d/00-USER_IS_ROOT.sh
install -m 644 %{secname}-%{cmrelease}/00-USER_IS_ROOT.csh %{buildroot}/%{_sysconfdir}/profile.d/00-USER_IS_ROOT.csh
install -m 644 %{secname}-%{cmrelease}/z00_lmod.sh %{buildroot}/%{_sysconfdir}/profile.d/z00_lmod.sh
install -m 644 %{secname}-%{cmrelease}/z00_lmod.csh %{buildroot}/%{_sysconfdir}/profile.d/z00_lmod.csh
install -m 644 %{secname}-%{cmrelease}/z01-default_modules.sh %{buildroot}/%{_sysconfdir}/profile.d/z01-default_modules.sh

# Local business customization
install -m 644 %{secname}-%{cmrelease}/00-INIT-MODULES.sh %{buildroot}/%{_sysconfdir}/profile.d/00-INIT-MODULES.sh
install -m 644 %{secname}-%{cmrelease}/00-INIT-MODULES.csh %{buildroot}/%{_sysconfdir}/profile.d/00-INIT-MODULES.csh
# guarded definition of $MODULEPATH, could be overwritten above
install -m 644 %{secname}-%{cmrelease}/00-modulepath.sh %{buildroot}/%{_sysconfdir}/profile.d/00-modulepath.sh
install -m 644 %{secname}-%{cmrelease}/00-modulepath.csh %{buildroot}/%{_sysconfdir}/profile.d/00-modulepath.csh
# This is escape valve for user root, so that no parallel fs default modulefiles would be loaded (fi. sge)
install -m 644 %{secname}-%{cmrelease}/00-USER_IS_ROOT.sh %{buildroot}/%{_sysconfdir}/profile.d/00-USER_IS_ROOT.sh
install -m 644 %{secname}-%{cmrelease}/00-USER_IS_ROOT.csh %{buildroot}/%{_sysconfdir}/profile.d/00-USER_IS_ROOT.csh
# This is Lmod shell initialization; the last couple files do defaults & restores
install -m 644 %{secname}-%{cmrelease}/z00_lmod.sh %{buildroot}/%{_sysconfdir}/profile.d/z00_lmod.sh
install -m 644 %{secname}-%{cmrelease}/z00_lmod.csh %{buildroot}/%{_sysconfdir}/profile.d/z00_lmod.csh
install -m 644 %{secname}-%{cmrelease}/z01-default_modules.sh %{buildroot}/%{_sysconfdir}/profile.d/z01-default_modules.sh
install -m 644 %{secname}-%{cmrelease}/z01-default_modules.csh %{buildroot}/%{_sysconfdir}/profile.d/z01-default_modules.csh
# install -Dpm 644 %{SOURCE1} %{buildroot}/%{macrosdir}/macros.%{name}

# Install templates
install -m 644 %{secname}-%{cmrelease}/00-INIT-MODULES.sh %{buildroot}/%{_datadir}/lmod/%{version}/templates/00-INIT-MODULES.sh
install -m 644 %{secname}-%{cmrelease}/00-INIT-MODULES.csh %{buildroot}/%{_datadir}/lmod/%{version}/templates/00-INIT-MODULES.csh

# Install the contrib directory
cp -a contrib %{buildroot}%{_datadir}/lmod/%{version}
cp -a contrib %{buildroot}%{_datadir}/lmod/%{version}
cp -a contrib/use.own.eb %{buildroot}%{_sysconfdir}/site/modules
# this symlink ensures settarg functionality
ln -s /usr/share/lmod/lmod/modulefiles/Core/settarg %{buildroot}%{_sysconfdir}/site/modules
# this defines coloring and where the cache lives
cp -a %{secname}-%{cmrelease}/lmodrc.lua %{buildroot}%{_sysconfdir}/site/lmod

%if %{sles11}
# For sles11 /usr/bin/lua is not in the rpm file list, its created with the alternatives-update command in the post section of the lua package.
Expand All @@ -135,8 +146,12 @@ rm -rf $RPM_BUILD_ROOT

%files
%doc INSTALL License README.md README.new README_lua_modulefiles.txt
%{_sysconfdir}/site/lmod/SitePackage.lua
%{_sysconfdir}/modulefiles
%config(noreplace) %attr(755, root, root) %{_sysconfdir}/site/modules
%config(noreplace) %attr(644, root, root) %{_sysconfdir}/site/lmod/SitePackage.lua
%config(noreplace) %attr(644, root, root) %{_sysconfdir}/site/lmod/lmodrc.lua
%config(noreplace) %attr(755, root, root) %{_sysconfdir}/modulefiles
%config(noreplace) %attr(644, root, root) %{_sysconfdir}/profile.d/00-INIT-MODULES.sh
%config(noreplace) %attr(644, root, root) %{_sysconfdir}/profile.d/00-INIT-MODULES.csh
%config(noreplace) %attr(644, root, root) %{_sysconfdir}/profile.d/00-modulepath.sh
%config(noreplace) %attr(644, root, root) %{_sysconfdir}/profile.d/00-modulepath.csh
%config(noreplace) %attr(644, root, root) %{_sysconfdir}/profile.d/00-USER_IS_ROOT.sh
Expand All @@ -147,6 +162,4 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) %attr(644, root, root) %{_sysconfdir}/profile.d/z01-default_modules.csh
%{_datadir}/lmod
%{_datadir}/modulefiles
%config(noreplace) %attr(644, root, root) %{_datadir}/lmod/%{version}/templates/00-INIT-MODULES.sh
%config(noreplace) %attr(644, root, root) %{_datadir}/lmod/%{version}/templates/00-INIT-MODULES.csh
# %{macrosdir}/macros.%{name}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ This repository holds prototype versions of Lmod, with improved and modernized `
whereby startup scripts sequence under `/etc/profile.d` is as generic as possible and
minimal assumptions are made against the delivery environment (ie. sysadmins retain full control of the how).

The effort is beyond prototype stage, as of Oct 2016, and is mainly here for testing & refining the RPM generation process.
The effort is beyond prototype stage, as of Aug 2017, and is mainly here for testing & refining the RPM generation process.
Typically, the RPM build is just a matter of typing:
* LMOD_FULL_SETTARG_SUPPORT=yes time rpmbuild -ba Lmod-illumina.spec
40 changes: 40 additions & 0 deletions lmodrc.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- lua -*-
propT = {
state = {
validT = { experimental = 1, testing = 1, obsolete = 1 },
displayT = {
experimental = { short = "(E)", long = "(E)", color = "blue", doc = "Experimental", },
testing = { short = "(T)", long = "(T)", color = "green", doc = "Testing", },
obsolete = { short = "(O)", long = "(O)", color = "red", doc = "Obsolete", },
},
},
lmod = {
validT = { sticky = 1 },
displayT = {
sticky = { short = "(S)", long = "(S)", color = "red", doc = "Module is Sticky, requires --force to unload or purge", },
},
},
arch = {
validT = { mic = 1, offload = 1, gpu = 1, },
displayT = {
["mic:offload"] = { short = "(*)", long = "(m,o)", color = "blue", doc = "built for host, native MIC and offload to the MIC", },
["mic"] = { short = "(m)", long = "(m)", color = "blue", doc = "built for host and native MIC", },
["offload"] = { short = "(o)", long = "(o)", color = "blue", doc = "built for offload to the MIC only",},
["gpu"] = { short = "(g)", long = "(g)", color = "red" , doc = "built for GPU",},
["gpu:mic"] = { short = "(gm)", long = "(g,m)", color = "red" , doc = "built natively for MIC and GPU",},
["gpu:mic:offload"] = { short = "(@)", long = "(g,m,o)", color = "red" , doc = "built natively for MIC and GPU and offload to the MIC",},
},
},
status = {
validT = { active = 1, },
displayT = {
active = { short = "(L)", long = "(L)", color = "yellow", doc = "Module is loaded", },
},
},
}
scDescriptT = {
{
["dir"] = "/dev/shm/lmod/cacheDir",
["timestamp"] = "/dev/shm/lmod/system.txt",
},
}
2 changes: 1 addition & 1 deletion z00_lmod.csh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if ( ! $?MODULEPATH_ROOT ) then
endif

setenv TARG_TITLE_BAR_PAREN " "
setenv LMOD_FULL_SETTARG_SUPPORT no
setenv LMOD_FULL_SETTARG_SUPPORT yes
setenv LMOD_SETTARG_CMD :
setenv LMOD_COLORIZE yes
setenv LMOD_PREPEND_BLOCK normal
Expand Down
2 changes: 1 addition & 1 deletion z00_lmod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if [ -z "${MODULEPATH_ROOT:-}" ]; then

export MODULEPATH_ROOT="/usr/share/modulefiles"
export LMOD_SETTARG_CMD=":"
export LMOD_FULL_SETTARG_SUPPORT=no
export LMOD_FULL_SETTARG_SUPPORT=yes
export LMOD_COLORIZE=yes
export LMOD_PREPEND_BLOCK=normal
# export MODULEPATH=$(/usr/share/lmod/lmod/libexec/addto --append MODULEPATH $MODULEPATH_ROOT/$LMOD_sys $MODULEPATH_ROOT/Core)
Expand Down

0 comments on commit 0a6a8e5

Please sign in to comment.