diff --git a/CHANGELOG.md b/CHANGELOG.md index 136b5d1..c383b6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ GroupDepths($group) was undefined in the function get\_load\_hints(). (#1368) +### Build system +* Bugfix: Selecting the variant to build on the cmd-line did not work. + (#1371) + ## Version 2.0.5 ### modulecmd diff --git a/Pmodules/modbuild.in b/Pmodules/modbuild.in index 2bb9c51..7a66e36 100644 --- a/Pmodules/modbuild.in +++ b/Pmodules/modbuild.in @@ -1272,15 +1272,26 @@ build_modules_yaml_v1(){ } - # build this variant? - local -- build_variant="${opt_variant:-${config['default_variant']}}" - if [[ ":${config['variant']}:" != *:${build_variant}:* ]]; then - debug "don't build this variant: ${config['variant']} != *:${build_variant}:*" - return 0 - fi + check_variant(){ + local -- build_variant="${opt_variant:-${config['default_variant']}}" + # don't build if a variant has be specified on the command line or + # a default variant has been set in the config file, but no + # variant name is defined here + [[ -n ${build_variant} && -z ${config['variant']} ]] && return 1 + [[ -z ${config['variant']} ]] && return 1 + set -o noglob + local -a items=( "${config['variant'],,}" ) + set +o noglob + local item='' + for item in "${items[@]}"; do + [[ "${opt_variant}" == "${item}" ]] && return 0 + done + } + check_kernel module_config || return 1 check_target_cpu module_config || return 1 check_system module_config || return 1 + check_variant module_config || return 1 return 0 }