From cfa2fabf0189d573ac889302c53df43745e9bcc7 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Wed, 18 Nov 2026 13:18:48 -0600 Subject: [PATCH] install: add --enable-like-lmod configure option Several behaviors Lmod users expect exist in Modules but are disabled by default, each behind its own installation option. Sites migrating from Lmod, or providing both tools, had to find and set them one by one. The new option sets them all at once: abort on error on load and switch sub-commands, conflict unload, require via, unique name loaded, path entry reorder, contains search match and sticky purge reported as a warning. Like --enable-new-features, an option set after it on the command line supersedes the value it defines. Assisted-by: Claude:claude-fable-5-2 Signed-off-by: Xavier Delaruelle --- INSTALL.rst | 20 ++++++++++++++++++++ NEWS.rst | 6 ++++++ configure | 19 +++++++++++++++++++ doc/source/other-implementations.rst | 5 +++++ 4 files changed, 50 insertions(+) diff --git a/INSTALL.rst b/INSTALL.rst index 26f307913..335c9a420 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -672,6 +672,26 @@ instance :instopt:`--disable-set-manpath<--enable-set-manpath>`): .. versionadded:: 4.3 +.. instopt:: --enable-like-lmod + + Enable all options that make the :command:`module` command behave similarly + to Lmod, the alternative :command:`module` implementation developed in Lua. + This option is equivalent to the cumulative use of + :instopt:`--with-abort-on-error=load:ml:reload:switch<--with-abort-on-error>`, + :instopt:`--enable-conflict-unload`, :instopt:`--enable-path-entry-reorder`, + :instopt:`--enable-require-via`, + :instopt:`--with-search-match=contains<--with-search-match>`, + :instopt:`--with-sticky-purge=warning<--with-sticky-purge>` and + :instopt:`--enable-unique-name-loaded`. (default=no) + + An installation option set after :instopt:`--enable-like-lmod` on the + :command:`configure` command line supersedes the value defined by this + option. + + .. only:: html or latex + + .. versionadded:: 5.8 + .. instopt:: --enable-mcookie-version-check Enable check of the version specified right after Modules magic cookie diff --git a/NEWS.rst b/NEWS.rst index 7070ad5f6..ec289aebc 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -77,6 +77,12 @@ Modules 5.8.0 (not yet released) option is changed with the :subcmd:`config` sub-command from an initialization rc file or a sourced modulefile. (fix issue #740 with contribution from Achim Gsell) +* Install: add installation option :instopt:`--enable-like-lmod` that enables + all the options making the :command:`module` command behave similarly to + Lmod: *abort on error* on :subcmd:`load` and :subcmd:`switch` sub-commands, + *conflict unload* and *require via* mechanisms, one module loaded per module + name, path entry reordering, *contains* search match and sticky modules kept + with a warning on :subcmd:`purge`. .. _5.7 release notes: diff --git a/configure b/configure index c7c61504f..a5899570a 100755 --- a/configure +++ b/configure @@ -296,6 +296,8 @@ Optional Features: --enable-libtclenvmodules build and install the Modules Tcl extension library and enable its load in modulecmd.tcl [yes] + --enable-like-lmod enable all options that make module command behave + similarly to Lmod [no] --enable-mcookie-version-check enable check of the version specified right after Modules magic cookie in modulefiles, which defines @@ -937,6 +939,23 @@ for arg in "$@"; do # shellcheck disable=SC2034 requirevia=y ; fi ;; + --enable-like-lmod*|--disable-like-lmod) + val=$(get_feature_value "$arg") ; + if [ "$val" = 'y' ]; then + abortonerror='load:ml:reload:switch' ; + # shellcheck disable=SC2034 + conflictunload=y ; + # shellcheck disable=SC2034 + pathentryreorder=y ; + # shellcheck disable=SC2034 + requirevia=y ; + # shellcheck disable=SC2034 + searchmatch=contains ; + # shellcheck disable=SC2034 + stickypurge=warning ; + # shellcheck disable=SC2034 + uniquenameloaded=y ; + fi ;; --with-dark-background-colors=*|--without-dark-background-colors) darkbgcolors=$(get_package_value "$arg" "") ;; --with-light-background-colors=*|--without-light-background-colors) diff --git a/doc/source/other-implementations.rst b/doc/source/other-implementations.rst index ccca33592..02f876c2b 100644 --- a/doc/source/other-implementations.rst +++ b/doc/source/other-implementations.rst @@ -225,6 +225,11 @@ implementation. * - ``myModuleVersion()`` - :mfcmd:`module-info moduleversion` +Several Modules features that correspond to Lmod behaviors are not enabled by +default. The :instopt:`--enable-like-lmod` installation option enables all of +them at once to get a :command:`module` command that behaves similarly to +Lmod. + .. _Irreversible module actions: https://lmod.readthedocs.io/en/latest/370_irreversible.html .. _NAG file: https://lmod.readthedocs.io/en/latest/140_deprecating_modules.html .. _Custom labels for avail: https://lmod.readthedocs.io/en/latest/200_avail_custom.html