From 196443339f2e2a29db6b039b1cf2fc717cd7f950 Mon Sep 17 00:00:00 2001 From: Nicolas Richart <networms@gmail.ch> Date: Sat, 15 Mar 2025 00:01:48 +0100 Subject: [PATCH] more debug capabilities --- ci/debug/spack_lock_info.sh | 44 ++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/ci/debug/spack_lock_info.sh b/ci/debug/spack_lock_info.sh index da1df32..9b5e42e 100755 --- a/ci/debug/spack_lock_info.sh +++ b/ci/debug/spack_lock_info.sh @@ -69,15 +69,32 @@ get_name_dep(){ } +get_all_dependent(){ + jq --arg h "$1" -c '.concrete_specs + | to_entries + | .[] + | select(.value.dependencies | length != 0) + | select(.value.dependencies[] | select(.hash | match($h))) + | { + name: .value.name, + key: .key, + version: .value.version, + compiler: (.value.compiler | "\(.version)"), + target: (.value.arch.target | if type == "object" then .name else . end) + }' $2 +} + + usage() { echo "-h [hash]" echo "-n [name]" echo "-f [file]" } -OPTSTRING=":h:n:f:a" +OPTSTRING=":h:n:f:a:d" all=0 +dependent=0 hash="" name="" file="" @@ -92,6 +109,9 @@ while getopts ${OPTSTRING} opt; do n) name=${OPTARG} ;; + d) + dependent=1 + ;; a) all=1 ;; @@ -108,22 +128,30 @@ while getopts ${OPTSTRING} opt; do esac done -if [ "x$file" == "x" ] +if [ "x$file" = "x" ] then echo "No file specified" usage exit 1 fi -echo "name ($name), hash ($hash), file($file), all($all)" +#echo "name ($name), hash ($hash), file($file), all($all)" -if [ "x$hash" != "x" ] +if [ $dependent -eq 1 ] then - if [ $all -eq 1 ] + if [ "x$hash" != "x" ] + then + get_all_dependent $hash $file + fi +else + if [ "x$hash" != "x" ] then - get_all_dep $hash $file - else - get_hash_dep $hash $file + if [ $all -eq 1 ] + then + get_all_dep $hash $file + else + get_hash_dep $hash $file + fi fi fi -- GitLab