Commit Graph

2780 Commits

Author SHA1 Message Date
Xavier Delaruelle
56e73a7c26 Add 'usergroups' state
Create `usergroups` state to collect all the groups the user running
modulecmd.tcl process is member of. Add an initStateUsergroups procedure
to initialize this state, which calls `id -G -n` to fetch these group
names. This external command is available on every Unices and its
`-G -n` arguments operate the same way.

An error will be obtained on Windows platform as `id` command is not
known there.

initStateUsergroups procedure is recorded in modulecmd.tcl as
__initStateUsergroups and renamed if initStateUsergroups procedure is
not found from Modules Tcl extension library. A more efficient version
of initStateUsergroups will be provided in the library later on (not to
depend on an external command call).
2020-07-16 21:53:51 +02:00
Xavier Delaruelle
d52f2fc863 Add 'username' sub-cmd to module-info command
Be able to fetch current username through `module-info` modulefile
command. With no extra argument, username is returned. If a name is
provided as argument, true is returned if this name matches current
username, false is returned otherwise.
2020-07-16 21:53:51 +02:00
Xavier Delaruelle
5a8527d4b5 Add 'username' state
Create `username` state to collect the name of the user running
modulecmd.tcl process. Add an initStateUsername procedure to initialize
this state, which calls `id -u -n` to fetch username. This external
command is available on every Unices and its `-u -n` arguments operate
the same way.

An error will be obtained on Windows platform as `id` command is not
known there.

initStateUsername procedure is recorded in modulecmd.tcl as
__initStateUsername and renamed if initStateUsername procedure is not
found from Modules Tcl extension library. A more efficient version of
initStateUsername will be provided in the library later on (not to
depend on an external command call).
2020-07-16 21:53:51 +02:00
Xavier Delaruelle
44c9147ee8 Apply inclusive terminology in code and docs
Use inclusive terminology [1] to eliminate 'master' and 'slave' terms as
much as possible from code and documentation. 'master' has been changed
into 'main' and 'slave' into 'subordinate' or 'sub'.

After this change, some references to the 'master' and 'slave' word can
still be found in repository:
* `slaves` sub-command of `interp` Tcl command
* `--slave` option of `update-alternatives tool in RPM spec file
* `master_doc` attribute of Sphinx `conf.py` file
* git 'master' branch need to be renamed and tools referring it need to
  be updated accordingly (configure, script/mpub, script/mrel)

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=49decddd39e5f6132ccd7d9fdc3d7c470b0061bb
2020-07-16 21:31:30 +02:00
Xavier Delaruelle
6d8f72b950 doc: desc. recent doc and configure script updates in NEWS 2020-07-07 18:38:41 +02:00
Xavier Delaruelle
efb64c83a5 ts: fix install quar test when LD_PRELOAD is set 2020-07-07 15:09:42 +02:00
Xavier Delaruelle
43c1a3eb46 install: disable compat version build by default
Version 4 of Modules is available since almost 3 years. Many
improvements have been made to integrate features of version 3.2 still
needed in module command. So it is now time to disable the build of
version 3.2 which was triggered by default since 4.0.
2020-07-07 09:39:46 +02:00
Xavier Delaruelle
bba8c028b8 travis: use '--arg val' configure syntax on 2 test cases 2020-07-07 09:39:46 +02:00
Xavier Delaruelle
23776df5f7 install: set dir arg with '--arg val' form in configure
Enable the definition of the installation directory argument of the
./configure script with the `--arg val` syntax form in addition to the
`--arg=val` syntax.

Fixes #348
2020-07-07 09:39:31 +02:00
Xavier Delaruelle
4d8421c25c travis: fix --with-quarantine-vars arg bad definition 2020-07-07 09:39:31 +02:00
Xavier Delaruelle
71fb69944f install: show lib/compat configure args on configure 2020-07-07 09:39:26 +02:00
Xavier Delaruelle
e5947537e8 install: raise error on unknown configure argument
Fixes #348
2020-07-07 09:39:04 +02:00
Xavier Delaruelle
0f79bed5a3 install: limit compat args to those supported in configure
Only pass to compatibility version ./configure script arguments that
make sense to it. Do not transmit anymore arguments that are unknown to
this compatibility version ./configure script.

Compatibility version ./configure script argument listed in project's
main configure script are only a subset of supported arguments. Main
configure script can only be used to run compatibility configure script
with the argument list here.
2020-07-07 09:38:56 +02:00
Xavier Delaruelle
a44f1fd195 doc: use brighter variation of red svg logo
Built from CMYK EPS file.
2020-06-27 08:27:40 +02:00
Xavier Delaruelle
8e5a3b531a doc: include logo on README 2020-06-24 08:45:24 +02:00
Xavier Delaruelle
b0d2fe921c doc: fix html theme on RTD
To avoid RTD to override html_theme_options when html_theme is set to
'default'.
2020-06-24 08:03:58 +02:00
Xavier Delaruelle
fd7ba8de87 doc: include logo in doc portal 2020-06-24 07:50:09 +02:00
Xavier Delaruelle
d15b7c6494 doc: add source-script-in-modulefile recipe 2020-06-01 21:03:12 +02:00
Xavier Delaruelle
fdebca9005 doc: desc. source-sh in MIGRATING/NEWS 2020-06-01 21:03:12 +02:00
Xavier Delaruelle
fcc2a32686 doc: desc. source-sh/MODULES_LMSOURCESH in man/diff 2020-06-01 21:03:12 +02:00
Xavier Delaruelle
98846cd6b1 doc: desc. env recording in source-sh design doc 2020-06-01 21:03:12 +02:00
Xavier Delaruelle
38fa4a3356 ts: fix result order on 50/400 tests 2020-06-01 21:03:12 +02:00
Xavier Delaruelle
01a89ccc92 ts: adapt 50/400 err stack trace msg to Tcl version used 2020-06-01 21:03:12 +02:00
Xavier Delaruelle
03f5dd9af8 ts: test var relying on source-sh script defined var 2020-06-01 21:03:12 +02:00
Xavier Delaruelle
33d4db3ec1 ts: add 'display' mode test for source-sh cmd 2020-06-01 21:03:12 +02:00
Xavier Delaruelle
866a7d8e93 Implement 'source-sh' for display mode
When modulefile is displayed, report modulefile commands resulting from
source-sh script evaluation rather source-sh modulefile command.

As for unload modulefile evaluation, display mode relies on
MODULES_LMSOURCESH if modulefile is currently loaded. However it will
requery script to fetch the definition of shell aliases and functions.
2020-06-01 21:03:12 +02:00
Xavier Delaruelle
7133bab420 Split sh-to-mod code in 2 procs
Separate script evaluation and output extraction in a dedicated
procedure called execShAndGetEnv.
2020-06-01 21:03:12 +02:00
Xavier Delaruelle
71d48f03c0 ts: test 'source-sh' modulefile command 2020-06-01 21:03:12 +02:00
Xavier Delaruelle
91670c17cb Transform sep char used in MODULES_LMSOURCESH value
Transform character used as separator to structure MODULES_LMSOURCESH
environment variable value (:, & and |), when these characters are used
among values set by source-sh scripts. Respectively transform these
characters into `<EnvModEscPS>`, `<EnvModEscS1>` and `<EnvModEscS2>`.
2020-06-01 21:03:12 +02:00
Xavier Delaruelle
c001bf6763 Implement 'source-sh' for unload mode
Rely on information saved in MODULES_LMSOURCESH environment variable to
know what to undo when modulefile is evaluated in unload mode. Evaluate
source-sh resulting modulefile commands through unload Tcl interpreter
to get those command reversed.
2020-06-01 21:03:12 +02:00
Xavier Delaruelle
365f0a726b Record cmds from source-sh in MODULES_LMSOURCESH env var
Record in user environment the modulefile commands resulting from
source-sh evaluations. Making this information persist in environment
via MODULES_LMSOURCESH variable helps to determine what to undo when
unloading modulefiles making use of the source-sh command.
2020-06-01 21:03:12 +02:00
Xavier Delaruelle
afe429f604 Implement 'source-sh' command for load mode 2020-06-01 21:03:11 +02:00
Xavier Delaruelle
65549cfbb8 vim: add new modulefile command 'source-sh' 2020-06-01 21:03:11 +02:00
Xavier Delaruelle
6a74f7b37d Add skeleton for new modulefile command 'source-sh'
Add an undo procedure to apply on unload modulefile evaluation mode.
Print command call on display mode. And no operation for other modes.
2020-06-01 21:03:11 +02:00
Xavier Delaruelle
24bd4f28bf doc: desc. -T/--trace option in NEWS 2020-06-01 21:02:32 +02:00
Xavier Delaruelle
6beaaff9ef ts: add tests for 'trace' verbosity level 2020-06-01 21:02:32 +02:00
Xavier Delaruelle
227f325ea7 doc: desc. -T/--trace in man/diff/INSTALL docs 2020-06-01 21:02:32 +02:00
Xavier Delaruelle
09e3c8cd98 Fix double err counter increase when mod eval breaks 2020-06-01 21:02:32 +02:00
Xavier Delaruelle
bc1373dffc init: add -T/--trace options to completion scripts 2020-06-01 21:02:32 +02:00
Xavier Delaruelle
f2d280eb57 Introduce 'trace' verbosity level 2020-06-01 21:02:32 +02:00
Xavier Delaruelle
e2188df5d1 doc: desc. sh-to-mod in NEWS/MIGRATING 2020-06-01 20:59:50 +02:00
Xavier Delaruelle
31fadd19a8 doc: desc. sh-to-mod in module(1) and diff docs 2020-06-01 20:59:50 +02:00
Xavier Delaruelle
2351c9a863 doc: add source-shell-script-in-modulefile design doc 2020-06-01 20:59:50 +02:00
Xavier Delaruelle
20b28d1091 ts: add test for path-like variable in 70/310 2020-06-01 20:59:50 +02:00
Xavier Delaruelle
ffa9e52215 Dedup path entries found after sh-to-mod script source
For path-like variable set by sourced script, the newly added path
entries are analyzed to remove duplicates among the same portion to
avoid a path to be prepended multiple times or appended multiple times.

Deduplication does not apply between prepended portion and appended
portion. Path entries found set prior script sourced are also excluded
from deduplication process.
2020-06-01 20:59:50 +02:00
Xavier Delaruelle
f6d64723ba Exclude PS1 variable from sh-to-mod environment change
Sourced scripts may detect the need to update PS1, but this decision is
taken over a specific environment where initialization scripts have not
been evaluated for the shells.
2020-06-01 20:59:50 +02:00
Xavier Delaruelle
1c3fd35338 No support of BSD sh shell on sh-to-mod currently
sh shell on BSD platform outputs alias definition with different
character escaping than regular sh or dash on Linux platform.

Disable test for this shell on this platform currently. Will see later
on if a need to support this shell is needed.
2020-06-01 20:59:50 +02:00
Xavier Delaruelle
f5991f09c6 ts: rework FOOSHELL var test in 70/310
Prefer BASH environment variable to SHELL to check bash binary location
used for current shell session.
2020-06-01 20:59:50 +02:00
Xavier Delaruelle
628de991ea Run shell without loading its config to proceed sh-to-mod eval 2020-06-01 20:59:50 +02:00
Xavier Delaruelle
3dd6e43836 Add support for csh/tcsh shells on sh-to-mod sub-cmd 2020-06-01 20:59:50 +02:00