Commit Graph

157 Commits

Author SHA1 Message Date
Xavier Delaruelle
a481df0ecb Introduce 'info-loaded' as module sub-command
Like for 'is-loaded', register 'module-info loaded' modulefile Tcl
command as a module sub-command to make it reachable from the command
line. Sub-command is named 'info-loaded' for sake of efficiency (not
'module-info-loaded').

Add the new command to the existing shell completion scripts (bash, tcsh
fish, zsh).

Document new command in the module.1 man page.

Check 'info-loaded' command argument error in 071-args tests of 00-init
suite. Test 'module info-loaded' cannot be called from a modulefile with
151-module-onlytop in 50-cmds suite. Add 156-info-loaded tests in
70-maint suite to validate new sub-command.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.

Closes #3
2017-12-01 08:07:39 +01:00
Xavier Delaruelle
a4929a13b9 Introduce 'is-avail' as module sub-command
Like for 'append-path', register 'is-avail' modulefile Tcl command as a
module sub-command to make it reachable from the command line.

Add the new command to the existing shell completion scripts (bash, tcsh
fish, zsh).

Document new command in the module.1 man page.

Check 'is-avail' command argument error in 071-args tests of 00-init
suite. Test 'module is-avail' cannot be called from a modulefile with
151-module-onlytop in 50-cmds suite. Add 155-is-avail tests in 70-maint
suite to validate new sub-command.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.
2017-11-28 20:56:45 +01:00
Xavier Delaruelle
0cff43a864 Introduce 'is-used' as module sub-command
Like for 'append-path', register 'is-used' modulefile Tcl command as a
module sub-command to make it reachable from the command line.

Add the new command to the existing shell completion scripts (bash, tcsh
fish, zsh).

Document new command in the module.1 man page.

Check 'is-used' command argument error in 071-args tests of 00-init
suite. Test 'module is-used' cannot be called from a modulefile with
151-module-onlytop in 50-cmds suite. Add 154-is-used tests in 70-maint
suite to validate new sub-command.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.
2017-11-28 07:26:56 +01:00
Xavier Delaruelle
1b468822ed Introduce 'is-saved' as module sub-command
Like for 'append-path', register 'is-saved' modulefile Tcl command as a
module sub-command to make it reachable from the command line.

Add the new command to the existing shell completion scripts (bash, tcsh
fish, zsh).

Document new command in the module.1 man page.

Check 'is-saved' command argument error in 071-args tests of 00-init
suite. Test 'module is-saved' cannot be called from a modulefile with
151-module-onlytop in 50-cmds suite. Add 154-is-saved tests in 70-maint
suite to validate new sub-command.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.
2017-11-28 07:26:39 +01:00
Xavier Delaruelle
100d9223b1 Introduce 'is-loaded' as module sub-command
Like for 'append-path', register 'is-loaded' modulefile Tcl command as a
module sub-command to make it reachable from the command line.

Improve 'cmdModuleResurface' procedure to set a global 'g_return_false'
flag when 'is-loaded' command returns 0. If 'g_return_false' flag is set
shell code rendering will end with a false value returned.

Add the new command to the existing shell completion scripts (bash, tcsh
fish, zsh).

Document new command in the module.1 man page.

Check 'is-loaded' command argument error in 071-args tests of 00-init
suite. Test 'module is-loaded' cannot be called from a modulefile with
151-module-onlytop in 50-cmds suite. Add 153-is-loaded tests in 70-maint
suite to validate new sub-command.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.

Closes #116
2017-11-26 16:01:57 +01:00
Xavier Delaruelle
62334ed0f7 Improve new {append,prepend,remove}-path commands
Refactor code to call from the module command line modulefile-specific
commands. These commands can only be called from the command line, not
when calling 'module' procedure from a modulefile, to avoid any
ambiguity.

When parsing command line arguments, check context to know if '-d' means
'--default' (avail command) or '--delim' (*-path commands).

Add the new commands to the existing shell completion scripts (bash,
tcsh, fish, zsh).

Document new commands in the module.1 man page.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.
2017-11-26 10:40:29 +01:00
Xavier Delaruelle
dfbdb9f7d1 Return dummy true on compat module function
Make compatibility module function to always return a value to be able
to check function result either new main version or compat version is
called.

Adapt cmake, perl, python and ruby compat module function to return a
true value. Always true is returned as compat version does not handle
returning error exit code.
2017-11-21 21:57:21 +01:00
Xavier Delaruelle
a6a93c5ff1 Silent sh-shells debug if MODULES_SILENT_SHELL_DEBUG
Introduce MODULES_SILENT_SHELL_DEBUG environment variable to silent the
xtrace and verbose output on sh-kind shells.

When set (means MODULES_SILENT_SHELL_DEBUG=1), current xtrace and
verbose flags are saved then these shell properties are disabled. Once
execution is finished, saved setup is restored.

This mechanism is defined on initialization scripts, at the beginning to
silent, at the end to restore defined behavior. It is also defined
within the module function following exact same principle.

By default, xtrace and verbose shell properties are applied to module
function and initialization script if enabled in calling shell script or
interactive session. These properties are disabled in module context only
if MODULES_SILENT_SHELL_DEBUG is set to '1'.

Notice that if xtrace/verbose properties are set, shell code that
leads to disable them when MODULES_SILENT_SHELL_DEBUG is set will be
outputed as debugging is set during these operations.

The mechanism only applies to the SH-shell family.

Closes #121
2017-11-14 09:55:45 +01:00
Xavier Delaruelle
d918ee6d86 install: add --with-quarantine-vars
Add --with-quarantine-vars configure option to define quarantine
mechanism configuration at build time.

Value passed to the configure option will be used by Makefile to
initialize in the various initialization scripts the
MODULES_RUN_QUARANTINE variable and eventual MODULES_RUNENV_<VAR>.
2017-11-12 16:56:40 +01:00
Xavier Delaruelle
7a36a422f3 Handle IFS in a sh-compatible way
On sh shell like dash, IFS cannot be local var. Also when setting IFS
with the "IFS=$' ';" syntax $ character is also added to the IFS value.
2017-11-11 17:04:17 +01:00
Xavier Delaruelle
8d5f8fe6cc Ensure correct IFS on sh-kind script or func
With quarantine mechanism sh-kind init scripts or module function are
sensitive to IFS value. If space character is not part of IFS, eval
command will not be able to understand command-line string.

This commit add code in init scripts and module function to guaranty
correct value for IFS.
2017-11-11 16:30:30 +01:00
Xavier Delaruelle
97ae43b1e2 Add quarantine mechanism support to r 2017-11-11 16:30:30 +01:00
Xavier Delaruelle
078bee1e29 Add quarantine mechanism support to cmake 2017-11-11 16:30:30 +01:00
Xavier Delaruelle
f62cf1ec24 Add quarantine mechanism support to ruby 2017-11-11 16:30:30 +01:00
Xavier Delaruelle
dde517ba2a Add quarantine mechanism support to python 2017-11-11 16:30:30 +01:00
Xavier Delaruelle
722e596003 Add quarantine mechanism support to perl 2017-11-11 16:30:30 +01:00
Xavier Delaruelle
47d0012122 Add quarantine mechanism support to tcl 2017-11-11 16:30:30 +01:00
Xavier Delaruelle
91a149b354 Add quarantine mechanism support to fish 2017-11-11 16:30:30 +01:00
Xavier Delaruelle
b3fcd93b24 Improve variable name check in MODULES_RUN_QUARANTINE
A variable name cannot start with a [0-9] character.
2017-11-11 16:30:30 +01:00
Xavier Delaruelle
7a2906233c Validate variable names set in MODULES_RUN_QUARANTINE
Test that the names of the environment variable defined in
MODULES_RUN_QUARANTINE are valid names.

Add test in quarantine setup code within init scripts (silent check) and
also test in modulecmd.tcl. The latter reports a warning if a bad name
is detected.

Add a non-regression test in modules.00-init and install.00-init test
suites.
2017-11-11 16:30:30 +01:00
Xavier Delaruelle
cd1786ab3f init: setup quarantine before autoinit for SH shells
As now a call to modulecmd.tcl defines the module function and
surrounding initial environment, this execution should also be shield
against bad environment with quarantine mechanism.
2017-11-11 16:30:22 +01:00
Xavier Delaruelle
29fb374116 install: fix use of ifeq/wildcard in Makefile
Prefer 'rmdir --ignore-fail-on-non-empty' which is evaluated at runtime.
ifeq is evaluated at Makefile read.
2017-11-01 17:42:52 +01:00
Xavier Delaruelle
1416a523cd testsuite/travis: rework tests with ex. init config
Use make for test config setup rather direct commands in travis
configuration.
2017-10-25 16:29:04 +02:00
Xavier Delaruelle
1dec5ed2eb install: skip initdir rmdir if not empty on uninstall 2017-10-23 22:35:27 +02:00
Xavier Delaruelle
519d08e98d init: shell scripts now rely on autoinit command
Make use of autoinit module command to initialize module command and its
initial surrounding environment (default value for MODULESHOME,
MODULEPATH, LOADEDMODULES and parse of init/.modulespath).

Then if compatibility version is currently activated redefined the
module command to point to the compat binary. But the compat version
will benefit from the surrounding environment initialization made by
autoinit.

With this change, activated compatibility version will also get its
environment initialized by the init/modulerc file whereas before this
change only the main version was affected by this setup file.
2017-10-23 22:35:27 +02:00
Xavier Delaruelle
f6f76143f7 init: redirect stderr msg on stdout if terminal
Change from previous behavior where redirection were set if shell was
interactive. With this change, a 'sh script' command launched from a
terminal session will setup module stderr redirection whereas previously
it was not the case as script was not ran in interactive mode.

Shell interactive mode is useful to know that interaction will occur on
stdin (interesting for completion setup). Knowing session is attached to
a terminal seems to be the good pivot to adapt stdout or stderr
functioning (help to determine if PAGER mode can be enabled or not on
'git')
2017-10-17 22:35:04 +02:00
Xavier Delaruelle
7de4c10bcc install: use sed rather perl for substitutions
Use sed instead of perl in configure and Makefile scripts as perl is not
required anymore to build documentation. sed is a lighter requirement to
build and install software.
2017-10-07 17:57:08 +02:00
Xavier Delaruelle
429215f9b7 install: handle version number through git tags
Introduce a version.inc file sourced by Makefiles, that holds release
number and build information. Makefiles use these information to set
correct version number in manpages and modulecmd.tcl script.

version.inc is present in dist tarball. This file is generated from
version.inc.in file by main Makefile when working in git repository.

Release information are retrieved from the tags of the git repository.
Release number corresponds to last git tag set. Build number is the
result of the 'git describe' command: this information helps to know
from what git branch and commit the current build is made of.
2017-09-30 21:47:26 +02:00
Xavier Delaruelle
8ec675c299 Release of version 4.0.0-beta
Adapt testsuite to take new release name in account.
2017-09-25 18:23:48 +02:00
Xavier Delaruelle
5c7314c059 init: rename use compat var in MODULES_USE_COMPAT_VERSION
Use a distinguishable prefix for environment variables relative to the
Modules software: 'MODULES_'.
2017-09-22 21:32:37 +02:00
Xavier Delaruelle
ab2de00dc8 init: fix and normalize fish_completion
* remove incorrect references to apt-get
* use space instead of tabs
* normalize description messages reusing short sentences already made
  for zsh completion
* fix function to filter module command output and only return
  modulefile list not mixed with files
* simplify install process by removing need for a '.in' file (and fix
  bash_completion install on the way)
2017-09-22 21:30:47 +02:00
BEFH
e833ab2b74 fish_completion
Created an initial fish_completion script and added to Makefile.
2017-09-22 08:12:36 +02:00
Xavier Delaruelle
c2d53d96d8 init: use . instead of source in sh-kind profile script 2017-09-18 05:57:58 +02:00
Xavier Delaruelle
8594a029cf install: add 'modules' modfile to example modfiles 2017-09-15 06:16:42 +02:00
Xavier Delaruelle
b4401a0061 init: add profile scripts enabling compat vers by default 2017-09-13 06:30:27 +02:00
Xavier Delaruelle
58e8558a17 git: fix location of ignored files 2017-09-13 06:30:27 +02:00
Xavier Delaruelle
34273d4956 install: remove any preexisting ksh-functions switchml
In case we reinstall with this time C version installation disabled.
2017-09-13 06:30:27 +02:00
Xavier Delaruelle
e23e771c09 init: normalize perl.pm hash key syntax 2017-09-13 06:30:27 +02:00
Xavier Delaruelle
fc5674846c init: adapt scripts to --enable-compat-version build
Introduce MODULE_USE_COMPAT_VERSION environment variable to control the
activation of the compatibility version rather main version in case of
--enable-compat-version installation.

The initialization script of the shells supporting compatibility version
are adapted to define the 'module' command based on the modulecmd-compat
binary if MODULE_USE_COMPAT_VERSION is set to 1. Elsewhere module is
based on modulecmd.tcl.

'switchml' function of alias is reintroduced to switch between main and
compatibility version based on the state of the
MODULE_USE_COMPAT_VERSION environment variable.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.
2017-09-13 06:30:19 +02:00
Xavier Delaruelle
1cdae156ff install: --enable-compat-version to build compat vers
Introduce '--enable-compat-version' configure argument to configure and
build compatibility (C) version in addition to main version.

This compatibility version is located in the 'compat' directory, which
is automatically populated with 'c-master' git branch if we work in the
git repository.

'configure' script is adapted to run the compatibility version relative
configure script. Unknown command-line arguments are passed down to this
script, which raise error if these arguments are not known there either.
Some compatibility version configure script argument are also
incompatible in this dual installation mode, so an error is raised
(--enable-versioning for instance).

Build process will generate and install modulecmd-compat, module-compat.1
and modulefile-compat.4 from this compatibility version. 'compat' suffix
enables clear distinction with main version files.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.
2017-09-13 06:12:49 +02:00
Xavier Delaruelle
d6b87dfe26 install: remove features linking to external C version
Remove the --enable-set-switchml, --enable-use-cver-dotmodulespath,
--with-cver-initdir, --with-cver-bindir and --with-cver-mandir configure
option that previously enabled to link Modules-Tcl installation to an
external Modules-C installation.

This change is an initial step toward a bundled installation of Tcl/C
versions, so the external linking support will transform into a dual
flavor installation.
2017-09-06 07:28:37 +02:00
Xavier Delaruelle
4c7dd94360 init: module source @initdir@/modulerc rather shell source
Like for other lang init scripts.
2017-09-05 06:04:53 +02:00
Xavier Delaruelle
9006a3baab install: avoid make to rebuild Makefile.inc 2017-09-03 15:56:08 +02:00
Xavier Delaruelle
b6d4404153 install: fix Makefile generation flaws
Generate a shared 'Makefile.inc' file rather all 'Makefile's at
configure time. Avoid init/Makefile being rebuilt by initscript '%.in'
rules.

Correct 'all' rule typo in doc/Makefile.

Enforce '.modulespath' symlink creation when usecverdotmodulespath is
enabled.
2017-08-11 23:13:05 +02:00
Xavier Delaruelle
a625d685da Support for R "shell"
And adapt documentation, installation and testsuite.
2017-08-09 15:32:45 +02:00
Roy Storey
e342f8a396 init: script for R support 2017-08-09 00:44:34 +02:00
Xavier Delaruelle
6ce8fda40a Support for Ruby "shell"
And adapt documentation, installation and testsuite.
2017-08-09 00:19:31 +02:00
Tammo Tjarks
fb2aa12474 init: script for Ruby support 2017-08-08 18:58:08 +02:00
Xavier Delaruelle
e5aa815663 Use file extension for perl/python init script
Rename 'perl' in 'perl.pm' and 'python' into 'python.py' to get same
init script filename than C-version.
2017-08-08 18:21:11 +02:00
Xavier Delaruelle
1d5232c55c Support for CMake "shell"
And adapt documentation, installation and testsuite.
2017-08-07 16:11:55 +02:00