spack/share/spack
Xavier Delaruelle 2db09f27af
modules: use depends-on to autoload module with Lmod on Tcl (#38347)
Update Tcl modulefile template to use the `depends-on` command to
autoload modules if Lmod is the current module tool.

Autoloading modules with `module load` command in Tcl modulefile does
not work well for Lmod at some extend. An attempt to unload then load
designated module is performed each time such command is encountered. It
may lead to a load storm that may not end correctly with large number of
module dependencies.

`depends-on` command should be used for Lmod instead of `module load`,
as it checks if module is already loaded, and does not attempt to reload
this module.

Lua modulefile template already uses `depends_on` command to autoload
dependencies. Thus it is already considered that to use Lmod with Spack,
it must support `depends_on` command (version 7.6+).

Environment Modules copes well with `module load` command to autoload
dependencies (version 3.2+). `depends-on` command is supported starting
version 5.1 (as an alias of `prereq-all` command) which was relased last
year.

This change introduces a test to determine if current module tool that
evaluates modulefile is Lmod. If so, autoload dependencies are defined
with `depends-on` command. Otherwise `module load` command is used.

Test is based on `LMOD_VERSION_MAJOR` environment variable, which is set
by Lmod starting version 5.1.

Fixes #36764
2023-06-14 15:35:53 +02:00
..
bash license year bump (#34921) 2023-01-18 14:30:17 -08:00
bootstrap Update metadata for bootstrapping (#33665) 2022-11-03 09:05:03 +00:00
csh license year bump (#34921) 2023-01-18 14:30:17 -08:00
docker license year bump (#34921) 2023-01-18 14:30:17 -08:00
docs/docker/module-file-tutorial license year bump (#34921) 2023-01-18 14:30:17 -08:00
gitlab Hotfix to avoid building compilers from sources in pcluster pipelines (#38256) 2023-06-09 07:56:28 +02:00
keys update tutorial command for v0.18.0 and new gpg key (#30904) 2022-05-28 02:36:20 +00:00
logo add artisanal handcrafted SVG Spack logo. (#6165) 2017-11-06 22:42:16 -08:00
qa Hraden Spack's powershell interface (#37079) 2023-04-21 08:58:37 -05:00
templates modules: use depends-on to autoload module with Lmod on Tcl (#38347) 2023-06-14 15:35:53 +02:00
setup-env.csh license year bump (#34921) 2023-01-18 14:30:17 -08:00
setup-env.fish license year bump (#34921) 2023-01-18 14:30:17 -08:00
setup-env.ps1 Hraden Spack's powershell interface (#37079) 2023-04-21 08:58:37 -05:00
setup-env.sh license year bump (#34921) 2023-01-18 14:30:17 -08:00
setup-tutorial-env.sh license year bump (#34921) 2023-01-18 14:30:17 -08:00
spack-completion.bash buildcache: remove deprecated api (#37246) 2023-06-12 14:33:26 +02:00