Skip to content

Commit e8d2053

Browse files
committed
doc: add "module-warn" design notes
Signed-off-by: Xavier Delaruelle <[email protected]>
1 parent 2ad90ec commit e8d2053

File tree

4 files changed

+66
-1
lines changed

4 files changed

+66
-1
lines changed

.hunspell.en.dic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,3 +1219,4 @@ dumpname
12191219
syntaxdbs
12201220
spi
12211221
LMUSE
1222+
EESSI

NEWS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Modules 5.6.0 (not yet released)
114114
print when modulefile is evaluated in ``help`` mode.
115115
* Update :mfcmd:`add-property` modulefile command to use its *value* argument
116116
to define tag on currently loading module.
117+
* Doc: add :ref:`module-warn` design notes.
117118

118119
.. _Security policy: https://github.com/envmodules/modules/blob/main/SECURITY.md
119120
.. _Modules chat room: https://matrix.to/#/#modules:matrix.org

doc/source/design/module-tags.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Specification
4848
- ``nearly-forbidden``: module that soon cannot be loaded (tag acquired through ``module-forbid``)
4949
- ``loaded``: loaded module
5050
- ``auto-loaded``: module automatically loaded by another module
51+
- ``warning``: warning message reported on load (tag acquired through ``module-warn``)
5152

5253
- Tags set with ``module-tag`` or ``--tag`` option associated to a specific behavior:
5354

@@ -250,7 +251,7 @@ Abbreviations
250251

251252
- The :mconfig:`tag_abbrev` configuration defines the abbreviations to apply to each tag
252253

253-
- Set by default at configure time to ``auto-loaded=aL:loaded=L:hidden=H:hidden-loaded=H:forbidden=F:nearly-forbidden=nF:sticky=S:super-sticky=sS:keep-loaded=kL``
254+
- Set by default at configure time to ``auto-loaded=aL:loaded=L:hidden=H:hidden-loaded=H:forbidden=F:nearly-forbidden=nF:sticky=S:super-sticky=sS:keep-loaded=kL:warning=W``
254255

255256
- Note that by default, *hidden* and *hidden-loaded* tags share the same abbreviation, as they operate on separate contexts (respectively avail and list contexts)
256257

doc/source/design/module-warn.rst

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
.. _module-warn:
2+
3+
module-warn modulefile command
4+
==============================
5+
6+
This design document describes the :mfcmd:`module-warn` Tcl command that emits
7+
warning message when targeted module is loaded.
8+
9+
Need for such command comes from `EESSI`_ software-layer where a warning
10+
message is printed when loading modules if a file is not found.
11+
12+
.. _EESSI: https://www.eessi.io/
13+
14+
Command specification
15+
---------------------
16+
17+
The command has following syntax::
18+
19+
module-warn [options] --message text modulefile...
20+
21+
When a ``module-warn`` command applies to an evaluated modulefile:
22+
23+
* message is printed as a warning message when targeted module is evaluated in
24+
``load``, ``display``, ``help`` or ``test`` modes.
25+
* warning message is printed at the end of the modulefile evaluation
26+
* ``warning`` tag is set on available or loaded module
27+
28+
Like other commands of this kind, modulefile specification accepts advanced
29+
version specifiers (see
30+
:ref:`module_version_specification_to_return_all_matching_modules`).
31+
32+
This command is available in modulerc and modulefile evaluation contexts. In
33+
modulefile context, it could be replaced by :mfcmd:`reportWarning`, but it is
34+
easier to also enables it in this context to benefit from the options that
35+
inhibit or enable specifically the warning mechanism.
36+
37+
``module-warn`` accepts options that change warn mechanism:
38+
39+
* ``--not-user``: specify a list of unaffected users
40+
* ``--not-group``: specify a list of groups whose member are unaffected
41+
* ``--user``: specify a list of users specifically affected
42+
* ``--group``: specify a list of groups whose member are specifically affected
43+
* ``--before``: enables warn mechanism until a given date
44+
* ``--after``: enables warn mechanism after a given date
45+
* ``--message``: warning message to print
46+
47+
``warning`` tag
48+
---------------
49+
50+
``warning`` tag is introduced to visibly catch modulefiles affected by
51+
``module-warn``:
52+
53+
* ``W`` is the abbreviation for this tag
54+
* ``W=30;43`` and ``W=103`` is respectively added to dark and light color
55+
palettes (same as nearly-forbidden modules)
56+
* This tag is recorded into collections following standard tag recording
57+
mechanism
58+
* This tag cannot be set manually with ``module-tag`` command
59+
* If ``module-warn`` is used within modulefile, extra match search will not
60+
find ``warning`` tag of these modules
61+
62+
.. vim:set tabstop=2 shiftwidth=2 expandtab autoindent:

0 commit comments

Comments
 (0)