From 81a10f5b557d635f18fb70738fc3106d8688dc64 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 30 Jun 2022 18:20:26 +0200 Subject: [PATCH] modbuild: new keyword 'systems' YAML variants files implemented The new keyword obsoletes the need of having differend variants files for different systems. --- Pmodules/modbuild.in | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Pmodules/modbuild.in b/Pmodules/modbuild.in index 7ca8915..c392ce9 100755 --- a/Pmodules/modbuild.in +++ b/Pmodules/modbuild.in @@ -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 \