From ae56b59ef5afb5908446f7e031795a19ecd06aaf Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Mon, 13 Jun 2022 10:23:58 +0200 Subject: [PATCH] modbuild: new key 'with' to specify hierarchical dependencies --- Pmodules/modbuild.in | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Pmodules/modbuild.in b/Pmodules/modbuild.in index b042cdb..995b817 100755 --- a/Pmodules/modbuild.in +++ b/Pmodules/modbuild.in @@ -509,10 +509,21 @@ build_modules_yaml(){ local fname="$2" local version="$3" local idx="$4" - _result=( $(yq -Ne e ".\"${version}\"[${idx}].dependencies" \ + _result=( $(yq -Ne e ".\"${version}\"[${idx}]|(.with, .dependencies)" \ "${fname}" 2>/dev/null) ) - (( $? == 0 )) && return || : - _result=() + if (( $? != 0 )); then + # neither .with nor .dependencies are set + _result=() + return + fi + # if one of .with, .dependencies is not set, the vaulue is + # returned as 'null'. + local -i i + for ((i=0; i<${#_result[@]}; i++)); do + if [[ ${_result[$i]} == 'null' ]]; then + unset _result[$i] + fi + done } local name="$1"