From 0086c1bb99279c6d44bac95c302a3d9f61c59bce Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Tue, 5 Apr 2022 10:06:09 +0200 Subject: [PATCH 01/12] version set to 1.0.0rc11 --- config/versions.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/versions.conf b/config/versions.conf index 670deb3..4d6da01 100644 --- a/config/versions.conf +++ b/config/versions.conf @@ -4,6 +4,6 @@ findutils 4.7.0 getopt 1.1.6 gettext 0.21 modules 3.2.10.1 -Pmodules 1.0.0rc10 +Pmodules 1.0.0rc11 Tcl 8.6.10 tcllib 1.20 From 184397caa8d73fb45e0f91be312b388b5d1339aa Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Tue, 5 Apr 2022 10:06:39 +0200 Subject: [PATCH 02/12] modulecmd: set _ROOT --- Pmodules/libmodules.tcl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Pmodules/libmodules.tcl b/Pmodules/libmodules.tcl index e8776a3..64d0aea 100644 --- a/Pmodules/libmodules.tcl +++ b/Pmodules/libmodules.tcl @@ -154,6 +154,9 @@ proc _pmodules_setenv { PREFIX name version } { if { [lsearch ${::dont-setenv} "${NAME}_HOME"] == -1 } { setenv ${NAME}_HOME $PREFIX } + if { [lsearch ${::dont-setenv} "${NAME}_ROOT"] == -1 } { + setenv ${NAME}_ROOT $PREFIX + } } else { debug "$PREFIX is not a directory" } From 7c500b7bf348f24417d7ca684f9cc4715d108408 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Tue, 5 Apr 2022 14:45:56 +0200 Subject: [PATCH 03/12] modulecmd: unsetting aliases fixed --- Pmodules/modulecmd.bash.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index f98eb41..5827f15 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -639,7 +639,7 @@ subcommand_unload() { local arg for arg in "${args[@]}"; do local output=$("${modulecmd}" "${Shell}" 'unload' "${arg}") - eval "${output}" + eval "$(echo "${output}"|sed -e 's/;unalias [^;]*//g')" case ${Shell} in sh | bash | zsh ) echo "${output}" From ba0e6a7ce0d496f2b759cf34c62091e584d9388e Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Tue, 5 Apr 2022 17:48:51 +0200 Subject: [PATCH 04/12] modulecmd: unsetting aliases in sub-command 'purge' fixed --- Pmodules/modulecmd.bash.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 5827f15..48e29b7 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1489,7 +1489,7 @@ subcommand_purge() { # re-run with right shell "${modulecmd}" "${Shell}" 'purge' fi - eval "${output}" + eval "$(echo "${output}"|sed -e 's/;unalias [^;]*//g')" if [[ -n "${error}" ]]; then echo "${error}" 1>&2 fi From 5a739a0a8f7acfce5337ff41cc6acdd7e4c9dd7f Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Tue, 5 Apr 2022 17:54:23 +0200 Subject: [PATCH 05/12] modulefile: don't set default env.variable PMODULES_ROOT --- Pmodules/modulefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Pmodules/modulefile b/Pmodules/modulefile index 1893fdb..6b3e91a 100644 --- a/Pmodules/modulefile +++ b/Pmodules/modulefile @@ -9,6 +9,7 @@ module-help " Pmodules are a hierarchical module environment based on Environment Modules. " +set dont-setenv { "PMODULES_ROOT" } # # It might be that '${PMODULES_ROOT}/Tools/Pmodules/VERSION' is in PATH. # Why? With older version the PATH might have been set without loading From 13b3dbcfd87f3aa514aa7eaebd87f62819ca8316 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Tue, 5 Apr 2022 17:57:26 +0200 Subject: [PATCH 06/12] modulefile: some comment added --- Pmodules/modulefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Pmodules/modulefile b/Pmodules/modulefile index 6b3e91a..c40824d 100644 --- a/Pmodules/modulefile +++ b/Pmodules/modulefile @@ -9,6 +9,10 @@ module-help " Pmodules are a hierarchical module environment based on Environment Modules. " +# +# Pmodules >= 1.0.0rc11 set _ROOT +# But for Pmodules PMODULES_ROOT != PMODULES_DIR and should not be set. +# set dont-setenv { "PMODULES_ROOT" } # # It might be that '${PMODULES_ROOT}/Tools/Pmodules/VERSION' is in PATH. From a209d7f335da62413eb16b40da488082826a4106 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Tue, 5 Apr 2022 18:32:15 +0200 Subject: [PATCH 07/12] revert changes to set _ROOT --- Pmodules/libmodules.tcl | 3 --- Pmodules/modulefile | 5 ----- 2 files changed, 8 deletions(-) diff --git a/Pmodules/libmodules.tcl b/Pmodules/libmodules.tcl index 64d0aea..e8776a3 100644 --- a/Pmodules/libmodules.tcl +++ b/Pmodules/libmodules.tcl @@ -154,9 +154,6 @@ proc _pmodules_setenv { PREFIX name version } { if { [lsearch ${::dont-setenv} "${NAME}_HOME"] == -1 } { setenv ${NAME}_HOME $PREFIX } - if { [lsearch ${::dont-setenv} "${NAME}_ROOT"] == -1 } { - setenv ${NAME}_ROOT $PREFIX - } } else { debug "$PREFIX is not a directory" } diff --git a/Pmodules/modulefile b/Pmodules/modulefile index c40824d..1893fdb 100644 --- a/Pmodules/modulefile +++ b/Pmodules/modulefile @@ -9,11 +9,6 @@ module-help " Pmodules are a hierarchical module environment based on Environment Modules. " -# -# Pmodules >= 1.0.0rc11 set _ROOT -# But for Pmodules PMODULES_ROOT != PMODULES_DIR and should not be set. -# -set dont-setenv { "PMODULES_ROOT" } # # It might be that '${PMODULES_ROOT}/Tools/Pmodules/VERSION' is in PATH. # Why? With older version the PATH might have been set without loading From 071fb3585abe10adc65181acf61a5e77ecd85007 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 6 Apr 2022 10:07:45 +0200 Subject: [PATCH 08/12] update of CHANGELOG for 1.0.0rc11 --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d91a60..dcf9fa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog of Pmodules +## Version 1.0.0rc11 +* **modulecmd** + * *User visible changes* + * handling of set-alias in modulefile fixed + * *Internal changes and fixes* + * none +* **build-system** + * *User visible changes* + * none + * *Internal changes and fixes* + * none + ## Version 1.0.0rc10 * **modulecmd** * *User visible changes* From 45a6c0530ad5c79fc50482029a5c095bf4958ac6 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 6 Apr 2022 17:30:39 +0200 Subject: [PATCH 09/12] init/csh: undefined DefaultGroups error fixed --- Pmodules/csh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Pmodules/csh b/Pmodules/csh index 5fb9926..cf6f2dc 100644 --- a/Pmodules/csh +++ b/Pmodules/csh @@ -35,13 +35,6 @@ unset prefix unset postfix setenv MODULEPATH -foreach group ( ${DefaultGroups} ) - if ( "${MODULEPATH}" == "" ) then - setenv MODULEPATH "${PMODULES_ROOT}/${group}/${PMODULES_MODULEFILES_DIR}" - else - setenv MODULEPATH "${MODULEPATH}:${PMODULES_ROOT}/${group}/${PMODULES_MODULEFILES_DIR}" - endif -end if (! $?LOADEDMODULES ) then setenv LOADEDMODULES "" From 7f84489095af32187d476cfbd37d69ef55a413b7 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 6 Apr 2022 17:32:57 +0200 Subject: [PATCH 10/12] version set to 1.0.0rc12 --- config/versions.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/versions.conf b/config/versions.conf index 4d6da01..5ffc722 100644 --- a/config/versions.conf +++ b/config/versions.conf @@ -4,6 +4,6 @@ findutils 4.7.0 getopt 1.1.6 gettext 0.21 modules 3.2.10.1 -Pmodules 1.0.0rc11 +Pmodules 1.0.0rc12 Tcl 8.6.10 tcllib 1.20 From b7da791922222a9e340e20673171fd4925259dc1 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 26 Oct 2022 15:15:33 +0200 Subject: [PATCH 11/12] Springdale added as RHEL clone --- Pmodules/libstd.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Pmodules/libstd.bash b/Pmodules/libstd.bash index 1684727..87e3b34 100644 --- a/Pmodules/libstd.bash +++ b/Pmodules/libstd.bash @@ -287,11 +287,11 @@ std.get_os_release_linux() { std::die 4 "Cannot determin OS release!\n" fi - case "${ID}" in - RedHatEnterpriseServer | RedHatEnterprise | Scientific | rhel | centos | CentOS | fedora ) + case "${ID,,}" in + redhatenterpriseserver | redhatenterprise | scientific | springdale | rhel | centos | fedora ) echo "rhel${VERSION_ID%%.*}" ;; - Ubuntu ) + ubuntu ) echo "Ubuntu${VERSION_ID%.*}" ;; * ) From f17a66bd2ce2531ef57174bb32c5f529543ced2c Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 26 Oct 2022 18:25:12 +0200 Subject: [PATCH 12/12] modulecmd: sub-cmds whatis and keyword fixed --- Pmodules/modulecmd.bash.in | 95 ++++++++++++++++++++++++++++++++++---- 1 file changed, 85 insertions(+), 10 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 48e29b7..0d8bf26 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1752,7 +1752,7 @@ subcommand_search() { } print_line_modulefile() { - std::info "$4" + std::info "$1 $4" } print_line_csv() { @@ -2068,7 +2068,7 @@ subcommand_help() { # whatis # Subcommands[whatis]='whatis' -Options[whatis]='-o \?H -l help' +Options[whatis]='-o \?Ha -l help -l all' Help[whatis]=' USAGE: module whatis [modulefile...] @@ -2078,11 +2078,41 @@ USAGE: ' subcommand_whatis() { - if (( $# == 0 )); then - subcommand_generic0 'whatis' - else - subcommand_generic1plus 'whatis' "$@" - fi + local options=() + local args=() + while (( $# > 0 )); do + case $1 in + -\? | --help ) + print_help "${subcommand}" + ;; + -a | --all ) + options+=( '-a' ) + ;; + -- ) + shift 1 + args+=( "$@" ) + break + ;; + * ) + args+=( "$1" ) + ;; + esac + shift + done + + local mod_name='' + local file_name='' + while read mod_name file_name; do + [[ -n ${file_name} ]] || continue + local whatis=$("${modulecmd}" bash \ + whatis \ + "${file_name}" \ + 2>&1 1>/dev/null) + printf "%-25s: %s\n" "${mod_name}" "${whatis/*:}" 1>&2 + done < <(set +x; subcommand_search \ + --print-modulefiles \ + "${options[@]}" \ + "${args[@]}" 2>&1) } ############################################################################## @@ -2091,7 +2121,7 @@ subcommand_whatis() { # Subcommands[apropos]='apropos' Subcommands[keyword]='apropos' -Options[apropos]='-o \?H -l help' +Options[apropos]='-o \?Ha -l help -l all' Help[apropos]=' USAGE: module apropos string @@ -2101,7 +2131,52 @@ USAGE: ' subcommand_apropos() { - subcommand_generic1 'apropos' "$@" + local options=() + local args=() + while (( $# > 0 )); do + case $1 in + -\? | --help ) + print_help "${subcommand}" + ;; + -a | --all ) + options+=( '-a' ) + ;; + -- ) + shift 1 + args+=( "$@" ) + break + ;; + * ) + args+=( "$1" ) + ;; + esac + shift + done + if (( ${#args[@]} == 0 )); then + std::die 3 "%s %s: %s" \ + "${CMD}" "${subcommand}" \ + "no search string specified" + elif (( ${#args[@]} > 1 )); then + std::die 3 "%s %s: %s" \ + "${CMD}" "${subcommand}" \ + "more then one search string specified" + fi + local arg="${args[0]}" + local mod_name='' + local file_name='' + while read mod_name file_name; do + [[ -n ${file_name} ]] || continue + local whatis=$("${modulecmd}" bash \ + whatis \ + "${file_name}" \ + 2>&1 1>/dev/null) + whatis="${whatis/*:}" + if [[ ${whatis,,} =~ ${arg,,} ]]; then + printf "%-25s: %s\n" "${mod_name}" "${whatis/*:}" 1>&2 + fi + done < <(set +x; subcommand_search \ + --print-modulefiles \ + "${options[@]}" 2>&1) } ############################################################################## @@ -2358,7 +2433,7 @@ if (( ${#GroupDepths[@]} == 0 )); then fi case ${subcommand} in - load|purge|search|swap ) + load|purge|search|swap|whatis|apropos ) declare -r tmpfile=$( ${mktemp} /tmp/Pmodules.XXXXXX ) \ || std::die 1 "Oops: unable to create tmp file!" ;;