modbuild: fix for issue #1371 (select variant to build on cmd line)

This commit is contained in:
2026-03-04 14:19:01 +01:00
parent 118ef2611a
commit dcbaec46b1
2 changed files with 21 additions and 6 deletions
+4
View File
@@ -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
+17 -6
View File
@@ -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
}