modbuild: new keyword 'systems' YAML variants files implemented

The new keyword obsoletes the need of having differend variants files
for different systems.
This commit is contained in:
2022-06-30 18:20:26 +02:00
parent 5dbc1cf9a3
commit 81a10f5b55
+28 -1
View File
@@ -489,6 +489,19 @@ build_modules_yaml(){
_result='base'
}
yaml_get_systems(){
local -n _result="$1"
local fname="$2"
local version="$3"
local idx="$4"
_result=$(yq -Ne e ".\"${version}\"[${idx}].systems" \
"${fname}" 2>/dev/null)
(( $? == 0 )) && return
_result=$(yq -Ne e ".systems" "${fname}" 2>/dev/null)
(( $? == 0 )) && return
_result='any'
}
yaml_get_dependencies(){
local -n _result="$1"
local fname="$2"
@@ -544,7 +557,21 @@ build_modules_yaml(){
yaml_get_dependencies deps "${fname}" "${v}" $i
ol_inst_root="${OverlayInfo[${ol_name}:inst_root]}"
ol_mod_root="${OverlayInfo[${ol_name}:mod_root]}"
local systems
yaml_get_systems systems "${fname}" "${v}" $i
# build module if
# - systems is any
# - opt_system is listed in systems
local build_it='no'
if [[ "${systems}" == 'any' ]]; then
build_it='yes'
fi
if [[ ,${systems}, == *,${opt_system},* ]]; then
build_it='yes'
fi
[[ ${build_it} == 'no' ]] && continue
if (( ${#deps[@]} > 0 )); then
while read -a with_modules; do
pbuild.build_module \