Commit Graph

225 Commits

Author SHA1 Message Date
Xavier Delaruelle
3ba2851767 Add ability to control module search match
Introduce the ability to control the module search match. Search query
string should match module name start or any part of module fully
qualified name. Default search match behavior is set at ``./configure``
time with the ``--with-search-match`` option. It could be superseded
with the ``MODULES_SEARCH_MATCH`` environment variable, that could be
set with ``config`` module sub-command through the ``search_match``
option. Command-line switches ``--starts-with`` (``-S``) and
``--contains`` (``-C``) for ``avail`` module sub-command enable to
supersede defined search match configuration.
2019-07-02 05:39:15 +02:00
Xavier Delaruelle
1a52463b96 install: replaces --enable-extra-siteconfig with --with-locked-configs
Add to the configure script the --with-locked-configs option to ignore
environment variable superseding of Modules configurations defined in
modulecmd.tcl script. Lockable configuration option are extra_siteconfig.
Currently locked options are reported through the locked_configs option
on the config sub-command.

This new configure option replces --enable-extra-siteconfig which was
dedicated to the control over the MODULES_SITECONFIG variable.
2019-06-08 08:04:49 +02:00
Xavier Delaruelle
51c56f66ee Control whether an implicit default should be selected
Add the ability to configure whether an implicit default version should
be defined for modules with no default version explicitly defined. When
enabled, which stays the default behavior, a module version is
automatically selected (latest one) when the generic name of the module
is passed. When implicit default selection is disabled, the name of
modules to evaluate should be fully qualified elsewhere an error is
returned. This option is set at `./configure` time with the
`--enable-implicit-default` and `--disable-implicit-default` options. It
could be superseded with the `MODULES_IMPLICIT_DEFAULT` environment
variable, that could be set with `config` module sub-command throught the
`implicit_default` option.

When implicit_default is disabled:
- module implicit default versions are excluded from 'module avail -d'
  results.
- false is returned when argument passed to the 'is-avail' sub-command
  is a directory without an explicit default set in it.
- and auto_handling is enabled, the requirement load mechanism will fail
  on requirement relying on module implicit default version

Fixes #179.
2019-06-03 08:14:59 +02:00
Xavier Delaruelle
b66a6e25ac Add the ability to configure of unload match order
Add the ability to configure when unloading a module and multiple loaded
modules match request if firstly loaded module should be choosen or
lastly loaded module. Default behavior is set at the `./configure` time
with the `--with-unload-match-order` switch. This default could be
superseded with the `MODULES_UNLOAD_MATCH_ORDER` environment variable,
that could be set with `config` module sub-command throught the
`unload_match_order` option.

This change allows to restore behavior of Modules compatibility version
where first matching module in loaded module list were unloaded in such
situation.

By default, lastly loaded module is set for unload (like it was
before this change) to limit impact on the loaded module list when
dependencies are woven between these loaded modules.

Even if this change enables to change the default behavior, it is highly
recommanded to keep it as soon your modulefiles express dependencies
between each other.

Fixes #198.
2019-05-26 07:33:07 +02:00
Xavier Delaruelle
8f8b74398a Add ability to disallow MODULES_SITECONFIG
Add to the configure script the `--enable-extra-siteconfig` and
`--disable-extra-siteconfig` options to allow or forbid the definition
of a site-specific configuration script controlled with the
`MODULES_SITECONFIG` environment variable.

These options control the default value of the `g_extrasiteconfig`
variable in `modulecmd.tcl`. If this variable is true (by default),
MODULES_SITECONFIG is looked at the siteconfig sourcing time. Thus the
primary siteconfig.tcl can set the variable to false to ensure the
extra siteconfig is disabled whatever the option passed at ./configure
time.
2019-05-20 20:36:56 +02:00
Xavier Delaruelle
5826bb20e8 Report and set 'extra_siteconfig' on 'config' sub-command
Report and be able to set the 'extra_siteconfig' configuration, linked
to the MODULES_SITECONFIG environment variable, on the 'config'
sub-command.
2019-05-19 10:46:35 +02:00
Xavier Delaruelle
d3527425fd Report and set 'rcfile' on 'config' sub-command
Report and be able to set the 'rcfile' configuration, linked to the
MODULERCFILE environment variable, on the 'config' sub-command.
2019-05-15 20:50:30 +02:00
Xavier Delaruelle
43b2760353 init: add 'config' sub-cmd to shell comp scripts 2019-05-15 20:50:29 +02:00
Xavier Delaruelle
2a07bedebd init: improve readability of var definition operations
Improve readability of variable definition operations by writing one
definition operation per line rather having multiple commands on a single
line like 'VAR=val; export VAR'.

Fixes #225.
2019-05-08 11:04:36 +02:00
Xavier Delaruelle
afa789fe62 Leverage --force cmd-line switch on 'clear' sub-cmd
Leverage --force command-line switch on 'clear' sub-command to skip
confirmation dialog.

Fixes #268.
2019-05-08 10:59:34 +02:00
Xavier Delaruelle
ddbdef78ad Re-introduce 'clear' sub-command
With same behavior than on compatibility version. The list of the
environmet variables that are cleared by this sub-command has been
updated to match the recent development (MODULES_LMPREREQ, ...)

Fixes #203.
2019-05-03 14:01:34 +02:00
Xavier Delaruelle
1c1e4aa21a init: add --color opt to bash/fish/tcsh/zsh comp scripts
Add both the --color and --color= forms of the colorize output
command-line switch to the shell completion scripts.
2019-05-03 14:01:22 +02:00
Xavier Delaruelle
54c4698e56 init: run module in --color=never mode in shell comp scripts
Ensure color mode is disabled when calling module command in the bash,
fish, tcsh and zsh completion scripts.
2019-05-03 14:01:22 +02:00
Xavier Delaruelle
c8fa18814a init: zsh completes avail mods in no in depth mode 2019-05-03 14:00:29 +02:00
Xavier Delaruelle
268b2a4e51 init: fish completes avail mods in no in depth mode 2019-05-03 14:00:29 +02:00
Xavier Delaruelle
1317ca8e12 init: bash completes avail mods in no in depth mode
Take advantage of the no in depth mode of the module avail command to
only get available choices for the current query file depth level.
2019-05-03 14:00:29 +02:00
Xavier Delaruelle
849d4ef318 init: add support for --indepth/--no-indepth avail opts 2019-05-03 14:00:29 +02:00
Xavier Delaruelle
32c6911f3e init: init MANPATH on zsh if empty to preserve man sysconfig
Zsh initializes by default the MANPATH environment variable to an empty
value when it starts. To preserve manpath system configuration even
after addition to this variable by modulefiles, set MANPATH variable to
':' if found empty.

Fixes #224.
2019-04-25 18:54:39 +02:00
Xavier Delaruelle
34e5547147 init: init MANPATH if not set to preserve man sysconfig
In shell initialization scripts, initialize MANPATH if not set with a
value that preserves manpath system configuration even after addition
of paths to this variable by modulefiles

Fixes #224
2019-02-23 15:12:30 +01:00
Xavier Delaruelle
75410fa0b0 init: fix tcsh completion when 'noclobber' var is set
Fix _module_not_yet_loaded alias in tcsh completion script to handle
situation when 'noclobber' variable is set (should force to write to the
fifo files).

Also ensure actual 'rm' command is called and not an alias that may ask
for confirmation.

Fixes #219
2019-01-30 20:29:02 +01:00
Xavier Delaruelle
abefc9bc59 init: recognize --{auto,no-auto,force,paginate,no-pager} opts in zsh comp
Add recognition of the --auto, --no-auto, --force, --paginate and
--no-pager command-line switches in zsh shell completion script.
2018-12-24 16:01:00 +01:00
Xavier Delaruelle
737a762463 init: recognize --{auto,no-auto,force} opts in fish comp
Add recognition of the --auto, --no-auto and --force command-line
switches in fish shell completion script.
2018-12-24 16:01:00 +01:00
Xavier Delaruelle
df677ff5ce init: skip shell env alteration if autoinit cmd failed
Fixes #208
2018-11-09 17:36:11 +01:00
Satya Mishra
691a085fa1 use :q to quote prompt to accomodate prompts with embedded newlines 2018-11-07 22:33:28 +01:00
Xavier Delaruelle
ca19609ff8 init: fix unload/switch cmd completion on bash 2018-10-25 09:53:41 +02:00
Xavier Delaruelle
8defb257f0 init: fix saved coll listing in bash/zsh/tcsh/fish completions
When no collection is currently found.
2018-10-20 15:51:13 +02:00
Xavier Delaruelle
81dc369bce init: fix loaded modules listing in tcsh/fish completions 2018-10-20 15:51:04 +02:00
Xavier Delaruelle
9c5dd88edd Support 'remove' as an alias on 'unload' command
As compatibility version does

Fixes #200
2018-10-15 07:21:27 +02:00
Xavier Delaruelle
b0c7bf891d Support 'del' as an alias on 'unload' command
Like compatibility version does.

Fixes #200
2018-10-15 07:21:09 +02:00
Xavier Delaruelle
8fa93a271d install: add --enable-quarantine-support configure opt
Add the ability to control whether or not code to support quarantine
mechanism should be added to the module function and initialization
scripts. Enabled by default

Fixes #167
2018-09-05 06:02:43 +02:00
Xavier Delaruelle
f700e055d4 install: add --enable-silent-shell-debug-support configure opt
Add the ability to control whether or not code to support silent shell
debug should be added to the module function and sh-kind initialization
scripts. Enabled by default

Fixes #166
2018-09-03 07:43:50 +02:00
Xavier Delaruelle
924b10864c init: split unset of shdbg and quar-related vars 2018-09-02 18:43:01 +02:00
Xavier Delaruelle
a199915dc7 By-pass conflict/prereq issue with -f/--force cmd-line switches
Add -f/--force command-line switches to by-pass dependency consistency
in case of
* load of a module conflicting with another loaded module
* load of a module where its declared requirements cannot be loaded
* unload of a module required by other loaded module

These options are only useful for the load, unload and switch module
sub-commands.

When a dependency is actually by-passed, still produce a warning message
to help user learn that something has effectively been forced. Warning
messages will be improved later-on to let user better understand what
happens

Update shell completion scripts.
2018-07-22 08:22:16 +02:00
Xavier Delaruelle
a8017d8f0c init: add pager opts in shell completion scripts 2018-07-22 08:22:16 +02:00
Xavier Delaruelle
d272b4abc8 Add --auto/--no-auto command-line switches
Add the ability to control from the command-line whether the auto_hanling
mode should be enabled or disabled.

Command-line option override auto_handling enablement value set with
MODULES_AUTO_HANDLING environment variable or set at configure time.

Update tests and shell completion scripts.
2018-07-22 08:22:16 +02:00
Xavier Delaruelle
419775c216 init: fix ksh script for ksh88 compatibility
Fix a ksh88 incompatible assignment and use '.' rather 'source' to
source external script.

Fixes #159
2018-07-13 19:27:18 +02:00
Xavier Delaruelle
b68e44ef7c init: enable ERE on sed with '-E' argument rather '-r'
When enabling Extended Regular Expression (ERE) on sed command, use the
'-E' argument (rather '-r') for compatibility with OS X's and BSDs' sed.

'sed -E' is used in bash and zsh completion scripts. ERE are required to
interpret alternation character '|'.

Fixes #178
2018-07-13 09:22:52 +02:00
Xavier Delaruelle
784f64d84b Detect shell with variables in profile.sh script
To improve shell detection code that until now was relying on a parent
process name check, some shell variables will be used to determine the
current shell name.

$BASH and $ZSH_NAME variables will be looked at if defined to determine
calling shell name.

Doing so will avoid some external command call when running bash or zsh.
Also if people source /etc/profile script in their own bash or zsh script
it will correctly determine calling shell name, as parent process in
this case is the script name.

Cannot determine shell name on ksh with a variable due to the lack of a
consistent detection mechanism across all ksh flavors [1].

Fixes #173

[1] https://books.google.fr/books?id=53zaxy423xcC&pg=PA161
2018-06-18 06:14:09 +02:00
Xavier Delaruelle
e5e16def77 init: init/export _module_raw if stderr attached to term
To get coherent with the test made by modulecmd.tcl to determine if
autoinit sub-command has to produce code for the '_module_raw' shell
function, export this function (or initialize it on compat mode) if
stderr is attached to a terminal.

Was previously testing stdout, whereas modulecmd.tcl is checking stderr,
which led to inconsistencies as described in [1].

Fixes #169

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1575479
2018-05-19 11:39:03 +02:00
Xavier Delaruelle
9df232de14 install: add --enable-append-{bin,man}path configure opts
Add the ability to append rather prepend the man or bin directory when
adding these directory to the relative environment variable is enabled
(with --enable-set-manpath or --enable-set-binpath).

Takes the form of 2 new configure options: --enable-append-manpath and
--enable-append-binpath. No effect if set but relative
--enable-set-{bin,man}path option is unset or disabled.
2018-05-03 07:09:11 +02:00
Xavier Delaruelle
6a3860bf8b Rename _moduleraw shell func in _module_raw
To use a common _module_ prefix for all module-related internal shell
functions as suggested by Paul FM [1].

[1] https://sourceforge.net/p/modules/mailman/message/36230667/
2018-05-02 21:09:13 +02:00
Xavier Delaruelle
468f16f9ec init: shield autoinit res from param expansion on sh-shells
Quote autoinit result for eval interpretation on SH-kind shells to
avoid parameter expansion to randomly occur on generated code
depending on file or directory names of current working directory.

Test basic module commands in install testsuite with a
'something (test)' file existing in current working directory.

Fixes bug reported at [1].

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1549664
2018-03-01 19:15:44 +01:00
Xavier Delaruelle
13c169a27c install: workaround Linux+Make 3.81 '\\\n' issue
Was affecting tests on Ubuntu Trusty
2018-02-14 08:18:22 +01:00
Xavier Delaruelle
bec3f92304 install: more portable \n to build init/modulerc
That also works on OS X.
2018-02-13 07:52:25 +01:00
Xavier Delaruelle
9ffa05a95e init: no call to manpath if MANPATH defined on csh 2018-02-06 09:44:10 +01:00
Xavier Delaruelle
a46739bfcc init: correct switchml def for Solaris pure csh 2018-02-06 06:16:23 +01:00
Xavier Delaruelle
22432b52d6 init/testsuite: need quotes for eval arg on pure csh 2018-02-06 06:06:50 +01:00
Xavier Delaruelle
5ce6488909 install: portable newline echo in Makefile 2018-02-01 20:11:16 +01:00
Xavier Delaruelle
0e9aa2b774 install: check rmdir '--ignore-fail-on-non-empty' exists 2018-02-01 19:46:34 +01:00
Xavier Delaruelle
300910d93e install: fix multi modulepath build in init/modulerc 2018-02-01 18:53:25 +01:00