Skip to content

Commit a6617d6

Browse files
committed
doc: add provide design notes
Signed-off-by: Xavier Delaruelle <[email protected]>
1 parent f65c46e commit a6617d6

File tree

4 files changed

+66
-8
lines changed

4 files changed

+66
-8
lines changed

NEWS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ Modules 5.6.0 (not yet released)
174174
options. When set, module aliases are included into the output and the
175175
*extra match search* mechanism is activated to scan modulefiles to get the
176176
module aliases they define.
177+
* Doc: add :ref:`provide` design notes.
177178

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

doc/source/design/extra-match-search.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ by default on Modules v5 and enabled by default on v6.
3737
What triggers an extra match search?
3838
------------------------------------
3939

40-
* module variants should be reported
40+
* module variants or provided module aliases should be reported
4141
* variant is specified in query on :subcmd:`avail`, :subcmd:`paths`,
4242
:subcmd:`spider` or :subcmd:`whatis`
4343
* an extra specifier is specified in query

doc/source/design/lmod-tcl-modulefile-compat.rst

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,17 @@ Lmod Tcl modulefile compatibility
7474
- Not used to load the modulefile declaring them when an extension name is
7575
passed to ``load`` sub-command or ``depends-on`` modulefile command
7676

77-
- This command will be first implemented as a no-operation command (``nop``)
77+
- This command was first implemented as a no-operation command (``nop``) in
78+
Modules 5.1
7879

7980
- No error raised if used
8081
- And no warning message to avoid polluting output
8182

8283
- This command is intended for use only within modulefile evaluation context
8384
(not within modulerc)
8485

85-
- *FUTURE*: may be interesting to improve the concept by making the extension
86-
names an alias on the modulefile declaring them
87-
88-
- Will automatically achieve dependency consistency this way
89-
- Could resolve dependencies based on extension names if modulefile is
90-
evaluated during an ``avail``
86+
- Starting Modules 5.6, this command is made an alias onto :mfcmd:`provide`
87+
modulefile command. See :ref:`provide` for details.
9188

9289

9390
``prereq-any``

doc/source/design/provide.rst

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
.. _provide:
2+
3+
provide modulefile command
4+
==========================
5+
6+
This design document describes the :mfcmd:`provide` Tcl command that defines
7+
one or multiple module aliases targeting currently evaluating module.
8+
9+
Command specification
10+
---------------------
11+
12+
The command has following syntax::
13+
14+
provide modulefile...
15+
16+
Each modulefile argument corresponds to a module alias to define onto current
17+
modulefile. At least one argument should be provided, an error is raised
18+
otherwise. Modulefile specification should correspond to a module name and
19+
version. Variant cannot be specified. Each individual string is interpreted as
20+
a module name and version.
21+
22+
This command is only available in modulefile evaluation contexts.
23+
24+
``provide`` command is only effective during ``load`` evaluations. It
25+
corresponds to a *no-operation* on other evaluation modes.
26+
27+
``provide`` only defines aliases, thus ``conflict`` definitions are expected
28+
to avoid these names to be provided by several loaded modules.
29+
30+
extensions modulefile command
31+
-----------------------------
32+
33+
The :mfcmd:`extensions` modulefile command introduced by Lmod is now
34+
implemented as a bare command alias onto :mfcmd:`provide`.
35+
36+
Provided alias
37+
--------------
38+
39+
Module alias defined with ``provide`` command are not distinguished from other
40+
aliases defined with ``family`` or ``module-alias``. These aliases are
41+
recorded in :envvar:`__MODULES_LMALTNAME` with `al` type like other aliases.
42+
43+
It appears easier for the user to only face one kind of element (alias) rather
44+
requiring them to learn multiple concepts (family, extensions, alias). All of
45+
this is just different names applying to a given modulefile.
46+
47+
A new item for output configuration is introduced: ``provided-alias``. It adds
48+
module aliases information into the generated output and enables the
49+
evaluation of modulefiles to fetch aliases provided by them (i.e., defined
50+
within them by ``provide`` or ``family`` modulefile commands).
51+
``provided-alias`` implies ``alias`` item.
52+
53+
A given provided alias may be defined by several modulefiles. When reported
54+
first defined target is retained. Which means that first scanned modulefile
55+
wins.
56+
57+
*FUTURE*: keep all target definitions to be able to report all of them if
58+
asked.
59+
60+
.. vim:set tabstop=2 shiftwidth=2 expandtab autoindent:

0 commit comments

Comments
 (0)