diff --git a/INSTALL.rst b/INSTALL.rst index 07cb89b9a..3e0a17b3b 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -1721,6 +1721,8 @@ installation. | :mconfig:`implicit_requirement` | ``1`` | :instopt:`--enable-implicit-requirement`, | | | | | | :envvar:`MODULES_IMPLICIT_REQUIREMENT` | | | +-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+ +| :mconfig:`info_extension` | ``0`` | :envvar:`MODULES_INFO_EXTENSION`, | | | ++-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+ | :mconfig:`list_output` | ``header:idx:variant:sym:tag:key`` | :instopt:`--with-list-output`, | | | | | | :envvar:`MODULES_LIST_OUTPUT`, | | | | | | :option:`--output` | | | diff --git a/NEWS.rst b/NEWS.rst index f793ad4b2..ddfd8d93f 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -84,6 +84,12 @@ Modules 5.7.0 (not yet released) :subcmd:`spider` sub-commands rather the last part of this via information. JSON output is updated to report the ``via`` key as an array rather as a string. (fix issue #586) +* Introduce the :mconfig:`info_extension` configure option to consider that + module extensions have a pure informational purpose and no module alias is + associated to them. Extensions defined with :mfcmd:`provide` modulefile + command are not affected by this mechanism. When :mconfig:`info_extension` + is changed with :subcmd:`config` sub-command, it sets the + :envvar:`MODULES_INFO_EXTENSION` environment variable. (fix issue #585) .. _5.6 release notes: diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 570268ac8..936afc35c 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -1076,6 +1076,7 @@ The following environment variables appeared on Modules 5. | 5.7 | :envvar:`MODULES_PATH_ENTRY_REORDER`, | | | :envvar:`MODULES_PAGINATE`, | | | :envvar:`MODULES_NON_EXPORTABLE_TAGS` | +| | :envvar:`MODULES_INFO_EXTENSION` | +------------+-----------------------------------------------------------------+ Modules Specific Tcl Commands @@ -1289,7 +1290,7 @@ The following Modules configuration option has been introduced on Modules 5. | | :mconfig:`spider_indepth`, :mconfig:`require_via` | +------------+-----------------------------------------------------------------+ | 5.7 | :mconfig:`path_entry_reorder`, :mconfig:`paginate`, | -| | :mconfig:`non_exportable_tags` | +| | :mconfig:`non_exportable_tags`, :mconfig:`info_extension` | +------------+-----------------------------------------------------------------+ :mconfig:`auto_handling` diff --git a/doc/source/design/provide.rst b/doc/source/design/provide.rst index 76eb7dd16..dea315aac 100644 --- a/doc/source/design/provide.rst +++ b/doc/source/design/provide.rst @@ -57,4 +57,17 @@ wins. *FUTURE*: keep all target definitions to be able to report all of them if asked. +info_extension configuration option +----------------------------------- + +The :mconfig:`info_extension` configuration option is added to control if +defined extensions should be considered with an information purpose only. + +When this option is enabled, the module alias is not generated to avoid having +conflict between 2 modules defining the same extension. + +This configuration option only affects extensions defined with the +:mfcmd:`extensions` modulefile command. When enabled it behaves like the +:mfcmd:`extensions` modulefile command implemented by Lmod. + .. vim:set tabstop=2 shiftwidth=2 expandtab autoindent: diff --git a/doc/source/module.rst b/doc/source/module.rst index a1a67b3cf..a1435e5ab 100644 --- a/doc/source/module.rst +++ b/doc/source/module.rst @@ -1235,6 +1235,19 @@ Module Sub-Commands .. versionadded:: 4.7 + .. mconfig:: info_extension + + Consider module :mfcmd:`extensions` having a pure informational purpose: no + module alias is associated to them. + + Default is ``0``. The :envvar:`MODULES_INFO_EXTENSION` environment variable + is defined by :subcmd:`config` sub-command when changing this configuration + option from its default value. + + .. only:: html or latex + + .. versionadded:: 5.7 + .. mconfig:: list_output Content to report in addition to module names on :subcmd:`list` sub-command @@ -5122,6 +5135,20 @@ ENVIRONMENT .. versionadded:: 4.7 +.. envvar:: MODULES_INFO_EXTENSION + + Consider (if set to ``1``) that module extensions have a pure informational + purpose and no module alias are associated to them. Extensions defined with + :mfcmd:`provide` modulefile command are not affected by this mechanism. + + This environment variable value supersedes the default value set in the + :mconfig:`info_extension` configuration option. It can be defined with the + :subcmd:`config` sub-command. + + .. only:: html or latex + + .. versionadded:: 5.7 + .. envvar:: MODULES_LIST_OUTPUT A colon separated list of the elements to report in addition to module names diff --git a/init/Makefile b/init/Makefile index 89d1f4ce5..1ff1b2c75 100644 --- a/init/Makefile +++ b/init/Makefile @@ -136,7 +136,7 @@ comp_lint_opts := -a -i --all --icase comp_modtosh_opts := --auto --no-auto --force -f --icase -i comp_path_opts := -d --delim --duplicates comp_rm_path_opts := -d --delim --index -comp_config_opts := --dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days non_exportable_tags pager paginate path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277 +comp_config_opts := --dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement info_extension list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days non_exportable_tags pager paginate path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277 define translate-in-script $(ECHO_GEN) diff --git a/init/fish_completion b/init/fish_completion index 2f0626b81..503f574f7 100644 --- a/init/fish_completion +++ b/init/fish_completion @@ -87,7 +87,7 @@ complete -c module -n '__fish_module_use_stashlist' -f -a "(module stashlist --c /Stash collection list\$/d; \ /:\$/d; \ /:ERROR:/d;')" -complete -c module -n '__fish_module_use_config' -f -a "--dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days non_exportable_tags pager paginate path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277" +complete -c module -n '__fish_module_use_config' -f -a "--dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement info_extension list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days non_exportable_tags pager paginate path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277" complete -f -n '__fish_module_no_subcommand' -c module -a 'help' --description 'Print this or modulefile(s) help info' complete -f -n '__fish_module_no_subcommand' -c module -a 'avail' --description 'List all or matching available modules' diff --git a/init/zsh-functions/_module.in b/init/zsh-functions/_module.in index 2c35576da..01912c8c7 100644 --- a/init/zsh-functions/_module.in +++ b/init/zsh-functions/_module.in @@ -378,7 +378,7 @@ _module() { _arguments \ '--dump-state[Report each state value of current Modules execution]' \ '--reset[Unset environment variable relative to configuration key]' \ - '1:configuration key:(abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days non_exportable_tags pager paginate path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277)' \ + '1:configuration key:(abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement info_extension list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days non_exportable_tags pager paginate path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277)' \ && ret=0 ;; (edit) diff --git a/tcl/init.tcl.in b/tcl/init.tcl.in index f5cd683fd..c276223d3 100644 --- a/tcl/init.tcl.in +++ b/tcl/init.tcl.in @@ -106,6 +106,7 @@ array set g_config_defs [list\ ignored_dirs {{} {CVS RCS SCCS .svn .git .SYNC .sos} 0 o}\ implicit_requirement {MODULES_IMPLICIT_REQUIREMENT @implicitrequirement@ 0\ b {0 1}}\ + info_extension {MODULES_INFO_EXTENSION 0 0 b {0 1}}\ list_output {MODULES_LIST_OUTPUT {@listoutput@} 0 l {header idx variant\ alias indesym sym tag hidden key} {} {} eltlist}\ list_terse_output {MODULES_LIST_TERSE_OUTPUT {@listterseoutput@} 0 l\ diff --git a/tcl/interp.tcl.in b/tcl/interp.tcl.in index d4122cf25..96c45fddc 100644 --- a/tcl/interp.tcl.in +++ b/tcl/interp.tcl.in @@ -79,7 +79,7 @@ complete {complete complete-un reportCmd nop nop conflict {conflict nop reportCmd nop nop nop nop conflict-sc } depends-on {prereqAllModfileCmd nop reportCmd nop nop nop nop prereq-all-sc} depends-on-any {prereqAnyModfileCmd nop reportCmd nop nop nop nop prereq-sc } -extensions {provide nop reportCmd nop nop nop nop provide-sc } +extensions {extensions nop reportCmd nop nop nop nop extensions-sc} family {family family-un reportCmd nop nop nop nop family-sc } haveDynamicMPATH {nop nop nop nop nop nop nop nop } hide-modulefile {hide-modulefile hide-modulefile hide-modulefile hide-modulefile hide-modulefile hide-modulefile nop nop } diff --git a/tcl/mfcmd.tcl b/tcl/mfcmd.tcl index 73007208a..223a29e1b 100644 --- a/tcl/mfcmd.tcl +++ b/tcl/mfcmd.tcl @@ -2388,6 +2388,17 @@ proc module-warn {args} { } } +proc extensions {args} { + if {![llength $args]} { + knerror {No module specified in argument} + } + # skip alias definition for extensions cmd if info_extension is enabled + if {[getConf info_extension]} { + return + } + provide {*}$args +} + proc provide {args} { if {![llength $args]} { knerror {No module specified in argument} diff --git a/tcl/modscan.tcl b/tcl/modscan.tcl index b588f46fd..3ed35a11b 100644 --- a/tcl/modscan.tcl +++ b/tcl/modscan.tcl @@ -127,6 +127,19 @@ proc family-sc {name} { recordScanModuleElt $name family provided-alias } +proc extensions-sc {args} { + if {![llength $args]} { + knerror {No module specified in argument} + } + set elt_list [list provide] + if {![getConf info_extension]} { + lappend elt_list provided-alias + } + foreach alias $args { + recordScanModuleElt $alias {*}$elt_list + } +} + proc provide-sc {args} { if {![llength $args]} { knerror {No module specified in argument} diff --git a/testsuite/install.00-init/010-environ.exp b/testsuite/install.00-init/010-environ.exp index 56a6ba905..04c9788c3 100644 --- a/testsuite/install.00-init/010-environ.exp +++ b/testsuite/install.00-init/010-environ.exp @@ -200,4 +200,7 @@ set env(LANG) "C" # ensure that tests doesn't run with Lmod path order unsetenv_var MODULES_PATH_ENTRY_REORDER +# clean any module extension config +unsetenv_var MODULES_INFO_EXTENSION + # vim:set tabstop=3 shiftwidth=3 expandtab autoindent: diff --git a/testsuite/modules.00-init/010-environ.exp b/testsuite/modules.00-init/010-environ.exp index f676f53ec..5de7d5dff 100644 --- a/testsuite/modules.00-init/010-environ.exp +++ b/testsuite/modules.00-init/010-environ.exp @@ -194,6 +194,9 @@ catch {unset env(MODULE_VERSION_STACK)} # ensure that tests doesn't run with Lmod path order unsetenv_var MODULES_PATH_ENTRY_REORDER +# clean any module extension config +unsetenv_var MODULES_INFO_EXTENSION + set env(MODULERCFILE) "$env(TESTSUITEDIR)/etc/empty" set ORIG_MODULERCFILE $env(MODULERCFILE) catch {unset env(MODULESHOME)} diff --git a/testsuite/modules.50-cmds/512-extensions.exp b/testsuite/modules.50-cmds/512-extensions.exp index 9d0b014a1..bc45cd5fb 100644 --- a/testsuite/modules.50-cmds/512-extensions.exp +++ b/testsuite/modules.50-cmds/512-extensions.exp @@ -133,6 +133,26 @@ set tserr "$modlin $mpre $modlin testouterr_cmd_re sh "whatis $mod" OK $tserr +# info_extension tests +set mp $modpath.4 +setenv_var MODULEPATH $mp + +setenv_var TESTSUITE_PROVIDE extensions + +setenv_var MODULES_INFO_EXTENSION 0 +set ans [list] +lappend ans [list set __MODULES_LMALTNAME provide/1&al|foo/1&al|bar/1&al|baz/1&al|qux/1&al|quux/1] +lappend ans [list set _LMFILES_ $mp/provide/1] +lappend ans [list set LOADEDMODULES provide/1] +testouterr_cmd bash {load provide/1} $ans {} + +setenv_var MODULES_INFO_EXTENSION 1 +set ans [list] +lappend ans [list set _LMFILES_ $mp/provide/1] +lappend ans [list set LOADEDMODULES provide/1] +testouterr_cmd bash {load provide/1} $ans {} + + # # Cleanup # diff --git a/testsuite/modules.50-cmds/720-provide.exp b/testsuite/modules.50-cmds/720-provide.exp index 10238ea3e..eb1db444e 100644 --- a/testsuite/modules.50-cmds/720-provide.exp +++ b/testsuite/modules.50-cmds/720-provide.exp @@ -52,6 +52,12 @@ lappend ans [list set _LMFILES_ $mp/provide/1] lappend ans [list set LOADEDMODULES provide/1] testouterr_cmd bash {load provide/1} $ans {} +# info_extension tests +setenv_var MODULES_INFO_EXTENSION 1 +testouterr_cmd bash {load provide/1} $ans {} + +setenv_var MODULES_INFO_EXTENSION 0 + skip_if_quick_mode diff --git a/testsuite/modules.51-scan/046-extra_spec-provide.exp b/testsuite/modules.51-scan/046-extra_spec-provide.exp index aeab09755..98f7c19d9 100644 --- a/testsuite/modules.51-scan/046-extra_spec-provide.exp +++ b/testsuite/modules.51-scan/046-extra_spec-provide.exp @@ -103,6 +103,24 @@ testouterr_cmd sh {avail -t provide:foo} OK $tserr testouterr_cmd sh {avail -t provided-alias:foo} OK $tserr +# +# info_extension tests +# + +setenv_var MODULES_INFO_EXTENSION 1 + +setenv_var TESTSUITE_PROVIDE multiple + +set tserr provide/1 +testouterr_cmd sh {avail -t provide provide:foo/1} OK $tserr +testouterr_cmd sh {avail -t provide provided-alias:qux/1} OK $tserr + +setenv_var TESTSUITE_PROVIDE extensions + +testouterr_cmd sh {avail -t provide provide:foo/1} OK $tserr +testouterr_cmd sh {avail -t provide provided-alias:qux/1} OK {} + + # # Cleanup # diff --git a/testsuite/modules.70-maint/220-config.exp b/testsuite/modules.70-maint/220-config.exp index e65feb92c..76a009848 100644 --- a/testsuite/modules.70-maint/220-config.exp +++ b/testsuite/modules.70-maint/220-config.exp @@ -84,6 +84,7 @@ array set configdfl [list\ ignored_dirs {CVS RCS SCCS .svn .git .SYNC .sos}\ implicit_default [expr {$install_implicitdefault eq {y}}]\ implicit_requirement [expr {$install_implicitrequirement eq {y}}]\ + info_extension 0\ list_output $install_listoutput\ list_terse_output $install_listterseoutput\ locked_configs $install_lockedconfigs\ @@ -153,6 +154,7 @@ array set configvar [list\ ignore_user_rc MODULES_IGNORE_USER_RC\ implicit_default MODULES_IMPLICIT_DEFAULT\ implicit_requirement MODULES_IMPLICIT_REQUIREMENT\ + info_extension MODULES_INFO_EXTENSION\ list_output MODULES_LIST_OUTPUT\ list_terse_output MODULES_LIST_TERSE_OUTPUT\ logged_events MODULES_LOGGED_EVENTS\ @@ -213,6 +215,7 @@ array set configvalid [list\ ignore_user_rc {0 1}\ implicit_default {0 1}\ implicit_requirement {0 1}\ + info_extension {0 1}\ list_output {header idx variant alias indesym sym tag hidden key}\ list_terse_output {header idx variant alias indesym sym tag hidden key}\ logged_events {auto_eval requested_eval requested_cmd}\