urn:noticeable:projects:cbzeG7wTvAIqj21zbUmxEnvironment Modules Updatescea-hpc.github.io/modules2020-11-14T20:32:29.920ZCopyright © Environment ModulesNoticeablehttps://storage.noticeable.io/projects/cbzeG7wTvAIqj21zbUmx/newspages/UPOFxJbXsysxyt1L7iHB/01h55ta3gsp13j52cdnky8js2v-header-logo.pnghttps://storage.noticeable.io/projects/cbzeG7wTvAIqj21zbUmx/newspages/UPOFxJbXsysxyt1L7iHB/01h55ta3gsp13j52cdnky8js2v-header-logo.png#b70e0burn:noticeable:publications:XPNZrPxr4Y3twYG39a8A2020-11-14T20:30:00.001Z2020-11-14T20:32:29.920ZModules 4.6.1 releasedModules 4.6.1 is out. This release brings a significant performance improvement for the dynamic hiding/forbidding feature and several other fixes. The changes introduced in this bugfix release are: Lib: implement initStateClockSeconds...<p>Modules 4.6.1 is out. This release brings a significant performance improvement for the dynamic hiding/forbidding feature and several other fixes.</p> <p>The changes introduced in this bugfix release are:</p> <ul> <li>Lib: implement <code>initStateClockSeconds</code> as a Tcl command in libtclenvmodules to provide an optimized way to retrieve current Epoch time.</li> <li>Lib: implement <code>parseDateTimeArg</code> as a Tcl command in libtclenvmodules to provide an optimized way to convert a datetime string into an Epoch time.</li> <li>When full module specification is equal to <code>@</code>, raise an error as no module name is provided. (fix issue #362)</li> <li>Optimize internal recording of hidden module and tag specification when parsing modulerc files in order to reduce the time taken to test if a given module is hidden or if a given tag applies to it.</li> <li>Script: add the ability to select the benchmark test to perform on <code>mb</code> utility.</li> <li>Doc: add <em>Use new features without breaking old module command</em> cookbook recipe</li> <li>Doc: rework option description for <code>module-hide</code> and <code>module-forbid</code> commands in modulefile(4) document.</li> <li>Doc: describe in diff_v3_v4 document that shell special characters like backticks are escaped when used in values starting Modules 4.0. (fix issue #365)</li> <li>Doc: make the ENVIRONMENT section from modulefile(4) man page point to the ENVIRONMENT section of module(1) man page.</li> <li>Fix <code>clear</code> sub-command to unset the <code>MODULES_LMSOURCESH</code> environment variable. (fix issue #367)</li> <li>Correctly return on <code>avail</code> sub-command a symbolic version defined in a global RC file when specifically searched. (fix issue #368)</li> <li>Fix module hiding resolution for symbolic versions defined in a global RC file when <code>module-hide</code> statements are set in the modulepath where the modulefiles targeted by these symbols are located. (fix issue #369)</li> <li>When a module fails to unload during a <code>purge</code> sub-command, preserve loaded the modules it requires to keep environment consistent. (fix issue #370)</li> <li>Doc: add <em>Hide and forbid modules</em> cookbook recipe.</li> </ul> <p>The list of all changes made in this new version are described in the NEWS document. Details on the new features introduced in the 4.6 series are provided in the MIGRATING document.</p> <p><a href="http://modules.readthedocs.io/en/stable/MIGRATING.html?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-1-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.XPNZrPxr4Y3twYG39a8A&amp;utm_medium=newspage" target="_blank" rel="noopener">http://modules.readthedocs.io/en/stable/MIGRATING.html</a><br> <a href="http://modules.readthedocs.io/en/stable/NEWS.html?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-1-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.XPNZrPxr4Y3twYG39a8A&amp;utm_medium=newspage" target="_blank" rel="noopener">http://modules.readthedocs.io/en/stable/NEWS.html</a></p> <p>The tarball of this new version can be downloaded at:</p> <p><a href="http://downloads.sourceforge.net/modules/modules-4.6.1.tar.gz?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-1-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.XPNZrPxr4Y3twYG39a8A&amp;utm_medium=newspage" target="_blank" rel="noopener">http://downloads.sourceforge.net/modules/modules-4.6.1.tar.gz</a></p> <p>The zipball to install this new version on Windows platform can be downloaded at:</p> <p><a href="http://downloads.sourceforge.net/modules/modules-4.6.1-win.zip?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-1-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.XPNZrPxr4Y3twYG39a8A&amp;utm_medium=newspage" target="_blank" rel="noopener">http://downloads.sourceforge.net/modules/modules-4.6.1-win.zip</a></p> <p>If you encounter any issue, please let us know by creating a ticket on the project bug tracker at:</p> <p><a href="https://github.com/cea-hpc/modules/issues?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-1-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.XPNZrPxr4Y3twYG39a8A&amp;utm_medium=newspage" target="_blank" rel="noopener">https://github.com/cea-hpc/modules/issues</a></p> <p>Special thanks to to all the people who reported issues.</p> Xavier Delaruelle[email protected]urn:noticeable:publications:qlb4pYoLlIZB79aJvLKq2020-09-16T05:04:00.001Z2020-09-16T06:23:34.831ZModules 4.6.0 releasedModules 4.6.0 is here with many new stuff to handle the life cycle of your modulefiles. It is as always backward-compatible with previous version 4 releases and primarily adds features and fixes bugs. Major new features introduced in v4...<p>Modules 4.6.0 is here with many new stuff to handle the life cycle of your modulefiles. It is as always backward-compatible with previous version 4 releases and primarily adds features and fixes bugs. Major new features introduced in v4.6.0 since v4.5 are:</p> <ul> <li><a href="https://timeline.noticeable.io/cbzeG7wTvAIqj21zbUmx/posts/translating-shell-scripts-into-modulefiles?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-0-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.qlb4pYoLlIZB79aJvLKq&amp;utm_medium=newspage" target="_blank" rel="noopener">Translating shell scripts into modulefiles</a></li> <li><a href="https://timeline.noticeable.io/cbzeG7wTvAIqj21zbUmx/posts/embed-shell-scripts-directly-in-modulefiles?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-0-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.qlb4pYoLlIZB79aJvLKq&amp;utm_medium=newspage" target="_blank" rel="noopener">Embed shell scripts in modulefiles</a></li> <li><a href="https://timeline.noticeable.io/cbzeG7wTvAIqj21zbUmx/posts/querying-user-s-name-and-groups-membership?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-0-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.qlb4pYoLlIZB79aJvLKq&amp;utm_medium=newspage" target="_blank" rel="noopener">Querying user’s name and groups membership</a></li> <li><a href="https://timeline.noticeable.io/cbzeG7wTvAIqj21zbUmx/posts/hiding-modules?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-0-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.qlb4pYoLlIZB79aJvLKq&amp;utm_medium=newspage" target="_blank" rel="noopener">Hiding modules</a></li> <li><a href="https://timeline.noticeable.io/cbzeG7wTvAIqj21zbUmx/posts/forbidding-use-of-modules?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-0-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.qlb4pYoLlIZB79aJvLKq&amp;utm_medium=newspage" target="_blank" rel="noopener">Forbidding use of modules</a></li> <li><a href="https://timeline.noticeable.io/cbzeG7wTvAIqj21zbUmx/posts/tracing-module-execution?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-0-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.qlb4pYoLlIZB79aJvLKq&amp;utm_medium=newspage" target="_blank" rel="noopener">Tracing module execution</a></li> </ul> <p>Details on these features included in this new release are provided in the <a href="http://modules.readthedocs.io/en/stable/MIGRATING.html?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-0-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.qlb4pYoLlIZB79aJvLKq&amp;utm_medium=newspage" target="_blank" rel="noopener">MIGRATING</a> document. The list of all changes made in this new version are described in the <a href="http://modules.readthedocs.io/en/stable/NEWS.html?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-0-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.qlb4pYoLlIZB79aJvLKq&amp;utm_medium=newspage" target="_blank" rel="noopener">NEWS</a> document.</p> <p>The tarball of this new version can be downloaded at:</p> <p><a href="http://downloads.sourceforge.net/modules/modules-4.6.0.tar.gz?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-0-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.qlb4pYoLlIZB79aJvLKq&amp;utm_medium=newspage" target="_blank" rel="noopener">http://downloads.sourceforge.net/modules/modules-4.6.0.tar.gz</a></p> <p>The zipball to install this new version on Windows platform can be downloaded at:</p> <p><a href="http://downloads.sourceforge.net/modules/modules-4.6.0-win.zip?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-0-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.qlb4pYoLlIZB79aJvLKq&amp;utm_medium=newspage" target="_blank" rel="noopener">http://downloads.sourceforge.net/modules/modules-4.6.0-win.zip</a></p> <p>If you encounter any issue, please let us know by creating a ticket on the project bug tracker at:</p> <p><a href="https://github.com/cea-hpc/modules/issues?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.modules-4-6-0-released&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.qlb4pYoLlIZB79aJvLKq&amp;utm_medium=newspage" target="_blank" rel="noopener">https://github.com/cea-hpc/modules/issues</a></p> <p>Many thanks also to all of you who improve Modules by reporting bugs or sharing new ideas.</p> Xavier Delaruelle[email protected]urn:noticeable:publications:achutQdKS8OfUCfFK5wM2020-09-15T04:21:00.001Z2020-09-15T04:22:58.181ZTracing module executionThe trace verbosity is introduced between the verbose and debug levels to report details on module searches, resolutions, selections and evaluations. Trace mode can be enabled by setting the verbosity config to the trace value or by...<p>The <code>trace</code> verbosity is introduced between the <code>verbose</code> and <code>debug</code> levels to report details on module searches, resolutions, selections and evaluations. Trace mode can be enabled by setting the <code>verbosity</code> config to the <code>trace</code> value or by using the <code>-T</code>/<code>--trace</code> command-line switches.</p> <p>To specifically render trace messages, the <code>tr</code> key is added to the color palette with a default value of <code>2</code> (decreased intensity).</p> <pre><code>$ ml -T foo Evaluate modulerc: '/path/to/modulefiles/.modulerc' Get modules: {foo} matching 'foo' in '/path/to/modulefiles' Resolve: 'foo' into 'bar' Get modules: {bar bar/1.0} matching 'bar' in '/path/to/modulefiles' Select module: 'bar/1.0' (/path/to/modulefiles/bar/1.0) matching 'bar/1.0' Loading bar/1.0 Evaluate modulefile: '/path/to/modulefiles/bar/1.0' as 'bar/1.0' </code></pre> Xavier Delaruelle[email protected]urn:noticeable:publications:EW741DsigBK1PSdQmrsU2020-09-08T19:04:00.001Z2020-09-09T06:26:49.548ZForbidding use of modulesThe module-forbid modulefile command is added to dynamically forbid the evaluation of modulefiles it specifies. When forbidden, a module cannot be loaded and an access error is returned when an attempt is made to evaluate it. $ cat...<p>The <code>module-forbid</code> modulefile command is added to dynamically forbid the evaluation of modulefiles it specifies. When forbidden, a module cannot be loaded and an access error is returned when an attempt is made to evaluate it.</p> <pre><code>$ cat /path/to/modulefiles/foo/.modulerc #%Module4.6 module-forbid foo@1: $ ml foo/1.0 ERROR: Access to module 'foo/1.0' is denied $ ml No Modulefiles Currently Loaded. </code></pre> <p><code>module-forbid</code> statements can be coupled with :mfcmd:<code>module-hide</code> statements to hide modules in addition to forbid their use. <code>module-forbid</code> supports the <code>--not-user</code>, <code>--not-group</code>, <code>--before</code> and <code>--after</code> options to still allow some users or forbid modules before or after a given date time.</p> <p>An additional error message can be defined with the <code>--message</code> option to guide for instance users when they try to evaluate a forbidden module:</p> <pre><code>$ cat /path/to/modulefiles/bar/.modulerc #%Module4.6 module-forbid --message {Software bar/1.0 is decommissioned, please now use\ bar/2.0} --after 2020-09-01 bar/1.0 $ ml bar/1.0 ERROR: Access to module 'bar/1.0' is denied Software bar/1.0 is decommissioned, please now use bar/2.0 </code></pre> <p>When an evaluated module will soon be forbidden, a message is returned to the user to warn him/her of the near limit. An additional warning message can also be defined here with the <code>--nearly-message</code> option to guide users.</p> <pre><code>$ cat /path/to/modulefiles/qux/.modulerc #%Module4.6 module-forbid --nearly-message {Version 1.0 will soon expire, please now use\ version 2.0} --after 2020-09-15 qux/1.0 $ date Tue 08 Sep 2020 06:49:43 AM CEST $ ml qux/1.0 Loading qux/1.0 WARNING: Access to module will be denied starting '2020-09-15' Version 1.0 will soon expire, please now use version 2.0 </code></pre> <p>The range of time the <em>nearly forbidden</em> warning appears can be controlled with the <code>nearly_forbidden_days</code> configuration option, whose value equals to the number of days prior the module starts to be forbidden. This configuration is set to <code>14</code> (days) by default and this value can be controlled at <code>configure</code> time with <code>--with-nearly-forbidden-days</code> option. When the <code>nearly_forbidden_days</code> configuration is set through the <code>config</code> sub-command, the <code>MODULES_NEARLY_FORBIDDEN_DAYS</code> environment variable is set.</p> Xavier Delaruelle[email protected]urn:noticeable:publications:hfjsEtXrUBaej7bhVPih2020-09-03T06:17:00.001Z2020-09-04T05:20:56.996ZHiding modulesThe newly introduced module-hide modulefile command enables to dynamically hide modulefiles, module aliases or symbolic versions specified to it: $ cat /path/to/modulefiles/bar/.modulerc #%Module4.6 module-version bar/1.0...<p>The newly introduced <code>module-hide</code> modulefile command enables to dynamically hide modulefiles, module aliases or symbolic versions specified to it:</p> <pre><code>$ cat /path/to/modulefiles/bar/.modulerc #%Module4.6 module-version bar/1.0 old # hide 'old' symbolic version module-hide bar/old # hide all version 2 and above module-hide bar@2: $ cat /path/to/modulefiles/.modulerc #%Module4.6 # hide all versions of foo module module-hide foo </code></pre> <p><code>module-hide</code> commands should be placed in module rc files and can leverage the <a href="https://timeline.noticeable.io/cbzeG7wTvAIqj21zbUmx/posts/advanced-module-version-specifiers?utm_source=noticeable&amp;utm_campaign=cbzeg7wtvaiqj21zbumx.hiding-modules&amp;utm_content=publication+link&amp;utm_id=cbzeG7wTvAIqj21zbUmx.UPOFxJbXsysxyt1L7iHB.hfjsEtXrUBaej7bhVPih&amp;utm_medium=newspage" target="_blank" rel="noopener">Advanced module version specifiers</a> syntax as shown in the above example.</p> <p>Hidden modules are excluded from available module search or module selection unless query refers to hidden module by its exact name:</p> <pre><code>$ ml av --------------- /path/to/modulefiles --------------- bar/1.0 bar/2.0 $ module load -v foo ERROR: Unable to locate a modulefile for 'foo' $ module load -v foo/1.0 Loading foo/1.0 $ module avail bar/old --------------- /path/to/modulefiles --------------- bar/1.0(old) </code></pre> <p><code>module-hide</code> command accepts a <code>--soft</code> option to apply a lighter of hiding to modules:</p> <pre><code>$ cat /path/to/modulefiles/qux/.modulerc #%Module4.6 # softly hide all qux modules module-hide --soft qux </code></pre> <p>The soft hiding mode enables to hide modules from full availability listing yet keeping the ability to select such module for load without having to use module exact name:</p> <pre><code>$ ml av --------------- /path/to/modulefiles --------------- bar/1.0 bar/2.0 $ ml av qux --------------- /path/to/modulefiles --------------- qux/1.0 qux/2.0 $ module load -v qux Loading qux/2.0 </code></pre> <p>Alternatively, a <code>--hard</code> option can be set on <code>module-hide</code> command to ensure designated modules do not unveil even if referred by their exact name:</p> <pre><code>$ cat /path/to/modulefiles/qux/.modulerc #%Module4.6 # softly hide all qux modules module-hide --soft qux # set highest version of qux hard hidden module-hide --hard qux/3.0 $ ml av qux/3.0 $ ml qux/3.0 ERROR: Unable to locate a modulefile for 'qux/3.0' </code></pre> <p>Some users or groups can be set unaffected by hiding mechanism with the <code>--not-user</code> or <code>--not-group</code> options:</p> <pre><code>$ cat /path/to/modulefiles/quuz/.modulerc #%Module4.6 # hiding does not apply to grp1 and grp2 groups module-hide --not-group {grp1 grp2} quuz $ id --groups --name grp1 grp7 $ ml av quuz --------------- /path/to/modulefiles --------------- quuz/1.0 quuz/2.0 $ ml -v quuz Loading quuz/2.0 </code></pre> <p>Hiding mechanism can also be set effective only before or after a given date time with the <code>--before</code> and <code>--after</code> options. Accepted date time format is <code>YYYY-MM-DD[THH:MM]</code>.</p> <pre><code>$ cat /path/to/modulefiles/fum/.modulerc #%Module4.6 # hide only before a given date module-hide --hard --before 2020-09-01T12:00 fum/1.0 # hide only after a given date module-hide --hard --after 2020-09-01 fum/2.0 $ date Fri 04 Sep 2020 06:21:48 AM CEST $ ml av fum --------------- /path/to/modulefiles --------------- fum/1.0 </code></pre> <p>Hidden modules can be included in available module searches if option <code>--all</code>/<code>-a</code> is set on <code>avail</code>, <code>aliases</code>, <code>whatis</code> or <code>search</code> sub-commands. Hard hidden modules are unaffected by this option and stay hidden.</p> <pre><code>$ ml av -a --------------- /path/to/modulefiles --------------- bar/1.0(old) foo/1.0 fum/1.0 quuz/2.0 qux/2.0 bar/2.0 foo/2.0 quuz/1.0 qux/1.0</code></pre> Xavier Delaruelle[email protected]urn:noticeable:publications:VN2cgrhpPvUwC2sifEEP2020-07-24T12:52:00.001Z2020-07-24T12:54:29.015ZQuerying user's name and groups membershipTwo new sub-commands are introduced for the module-info modulefile command: username and usergroups. They respectively fetch the name of the user currently running modulecmd.tcl or the name of all the groups this user is member of...<p>Two new sub-commands are introduced for the <code>module-info</code> modulefile command: <code>username</code> and <code>usergroups</code>. They respectively fetch the name of the user currently running modulecmd.tcl or the name of all the groups this user is member of.</p> <p>These two new modulefile commands can help to adapt code to specific users or groups. Like for instance to instantiate a modulefile for each group the user is member of:</p> <pre><code>$ cat /path/to/modulefiles/foo/.modulerc #%Module foreach grp [module-info usergroups] { module-virtual foo/$grp .common } $ id -G -n grp1 grp2 grp3 $ module avail --------------- /path/to/modulefiles --------------- foo/grp1 foo/grp2 foo/grp3 </code></pre> <p><code>username</code> and <code>usergroups</code> sub-commands of <code>module-info</code> modulefile command are only supported on Unix platform.</p> Xavier Delaruelle[email protected]urn:noticeable:publications:QNWvVvNvYmyPnbi818n32020-07-16T15:09:00.001Z2020-07-16T15:11:30.947ZEmbed shell scripts in modulefilesThe source-sh modulefile command is introduced to source environment changes done by the evaluation of a shell script passed as argument. With newly introduced sh-to-mod sub-command resulting environment changes done by script are output...<p>The <code>source-sh</code> modulefile command is introduced to source environment changes done by the evaluation of a shell script passed as argument. With newly introduced <code>sh-to-mod</code> sub-command resulting environment changes done by script are output as modulefile commands. <code>source-sh</code> applies those modulefile commands as if they were directly written in loading modulefile.</p> <p><code>source-sh</code> is useful for software providing a shell script for their enablement. If you want to enable such software with <code>module</code> yet using shell script provided by software for this task, just write a modulefile using <code>source-sh</code> command to call the shell script.</p> <p>Keeping the same example used to describe <code>sh-to-mod</code> sub-command: <em>foo</em> software provides a <code>foo-setup.sh</code> script for its activation. Create a modulefile <code>foo/1.2</code> that calls this script:</p> <pre><code>$ cat /path/to/modulefiles/foo/1.2 #%Module source-sh sh /path/to/foo-1.2/foo-setup.sh arg1 </code></pre> <p>Displaying this modulefile indicates the environment changes done by script:</p> <pre><code>$ module display foo/1.2 ------------------------------------------------------------------- /path/to/modulefiles/foo/1.2: prepend-path PATH /path/to/foo-1.2/bin set-alias foo {foobin -q -l} setenv FOOENV arg1 ------------------------------------------------------------------- </code></pre> <p>Loading the modulefile applies the environment changes seen above:</p> <pre><code>$ module load -v foo/1.2 Loading foo/1.2 $ echo $FOOENV arg1 $ alias foo alias foo='foobin -q -l' </code></pre> <p>Track of these changes is kept in user environment to be able to undo them when modulefile is unloaded:</p> <pre><code>$ module unload -v foo/1.2 Unloading foo/1.2 $ echo $FOOENV $ alias foo bash: alias: foo: not found </code></pre> <p>Changes on environment variables, shell aliases, shell functions and current working directory are tracked. The following shells are supported: <em>sh</em>, <em>dash</em>, <em>csh</em>, <em>tcsh</em>, <em>bash</em>, <em>ksh</em>, <em>ksh93</em>, <em>zsh</em> and <em>fish</em>.</p> Xavier Delaruelle[email protected]urn:noticeable:publications:CIbV259hRjBmfBkOhg3F2020-07-07T13:17:00.001Z2020-07-07T13:34:15.381ZTranslating shell scripts into modulefilesThe sh-to-mod sub-command is added to output as a modulefile content the environment changes done by the evaluation of a shell script passed as argument. sh-to-mod is especially useful for software providing a shell script for their...<p>The <code>sh-to-mod</code> sub-command is added to output as a modulefile content the environment changes done by the evaluation of a shell script passed as argument. <code>sh-to-mod</code> is especially useful for software providing a shell script for their enablement in shell session: it can convert these scripts into modulefiles.</p> <p>Say for instance, a <em>foo</em> software has been installed and it provides a <code>foo-setup.sh</code> script to activate <em>foo</em> software in user environment:</p> <pre><code>$ cat /path/to/foo-1.2/foo-setup.sh #!/bin/sh export FOOENV="$1" export PATH=/path/to/foo-1.2/bin:$PATH alias foo='foobin -q -l' </code></pre> <p>Calling <code>module sh-to-mod</code> on this shell script outputs the environment changes it performs as a modulefile content:</p> <pre><code>$ module sh-to-mod sh /path/to/foo-1.2/foo-setup.sh arg1 #%Module prepend-path PATH /path/to/foo-1.2/bin set-alias foo {foobin -q -l} setenv FOOENV arg1 </code></pre> <p>Changes on environment variables, shell aliases, shell functions and current working directory are tracked. The following shells are supported: <em>sh</em>, <em>dash</em>, <em>csh</em>, <em>tcsh</em>, <em>bash</em>, <em>ksh</em>, <em>ksh93</em>, <em>zsh</em> and <em>fish</em>.</p> <p><code>sh-to-mod</code> acts as a full replacement for the standalone <code>createmodule.sh</code> and <code>createmodule.py</code> scripts. However those two scripts are currently still provided for compatibility purpose.</p> <p>This new feature is available in git repository and will be included in next release (v4.6).</p> Xavier Delaruelle[email protected]