From 800f4b760505206ff31a4bf5ab0bee42fd7ba678 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 3 Sep 2020 16:20:16 +0200 Subject: [PATCH 1/3] libpbuild.bash: pbuild::make_all(): comments added to args --- Pmodules/libpbuild.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Pmodules/libpbuild.bash b/Pmodules/libpbuild.bash index 7ad68aa..9c9a376 100644 --- a/Pmodules/libpbuild.bash +++ b/Pmodules/libpbuild.bash @@ -915,8 +915,9 @@ pbuild::make_all() { } build_target() { - local dir="$1" - local target="$2" + local dir="$1" # src or build directory, depends on target + local target="$2" # prep, configure, compile or install + if [[ -e "${BUILD_DIR}/.${target}" ]] && \ [[ ${force_rebuild} != 'yes' ]]; then return 0 From ccb02fdf27c8b828f62881460dda99e054b70c1d Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 3 Sep 2020 16:21:39 +0200 Subject: [PATCH 2/3] modulecmd.bash.in: implement use-flags with arrays --- Pmodules/modulecmd.bash.in | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 5319f01..311b269 100755 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -463,15 +463,21 @@ subcommand_load() { fi fi local found='' - for flag in "${UseFlags[@]/#/_}" ""; do - # :FIXME: this doesn't work if ${m} is a - # modulename without version - if is_available "${m}${flag}"; then - m+="${flag}" + for flag in "${!UseFlags[@]}"; do + # :FIXME: this doesn't work if ${m} is a + # modulename without version + if is_available "${m}_${flag}"; then + m+="_${flag}" found=':' break fi done + if [[ ! "${found}" ]]; then + # no use-flags set + if is_available "${m}"; then + found=':' + fi + fi if [[ ! "${found}" ]]; then std::info "%s %s: module unavailable -- %s\n" \ "${CMD}" 'load' "${m}" From be117060435fbec66358b42fb2d1b1395a44db92 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 3 Sep 2020 16:23:36 +0200 Subject: [PATCH 3/3] modulecmd.bash.in: implement use-flags with arrays --- Pmodules/modulecmd.bash.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 311b269..b2fb27a 100755 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1033,7 +1033,7 @@ subcommand_use() { done std::info "\nUsed flags:\n" - for flag in "${UseFlags//:/ }"; do + for flag in "${!UseFlags[@]}"; do std::info "\t${flag}\n" done @@ -1061,7 +1061,7 @@ subcommand_use() { fi if [[ "${arg}" =~ "flag=" ]]; then # argument is flag - std::append_path UseFlags "${arg/flag=}" + UseFlags["${arg/flag=}"]=1 return fi if [[ -z ${GroupDepths[${arg}]} ]] && [[ -d "${PMODULES_ROOT}/${arg}" ]]; then @@ -1164,7 +1164,7 @@ subcommand_unuse() { fi if [[ "${arg}" =~ "flag=" ]]; then # argument is flag - std::remove_path UseFlags "${arg/flag=}" + unset UseFlags["${arg/flag=}"] return fi if [[ -n ${GroupDepths[${arg}]} ]] && @@ -1338,7 +1338,7 @@ pmodules_init() { declare -gx MODULEPATH='' declare -Ag GroupDepths='()' - declare -g UseFlags=() + declare -Ag UseFlags=() reset_modulepath reset_used_groups reset_used_releases