show-utils.sh: fix jq query to get coreutils deps

In jq query, the correct regex to select .id is ".*coreutils[ |@]\\d+\\.\\d+\\.\\d+"

- with cargo v1.76, id = "coreutils 0.0.26 (path+file://<coreutils local directory>)"
- with cargo v1.77, id = "path+file://<coreutils local directory>#coreutils@0.0.26"

Fix uutils/coreutils#6242

Signed-off-by: Laurent Cheylus <foxy@free.fr>
This commit is contained in:
Laurent Cheylus 2024-05-01 10:40:50 +02:00 committed by Ben Wiederhake
parent 99d234af87
commit 3b96ff1d10

View file

@ -33,5 +33,8 @@ cd "${project_main_dir}" &&
echo "WARN: missing \`jq\` (install with \`sudo apt install jq\`); falling back to default (only fully cross-platform) utility list" 1>&2
echo "$default_utils"
else
cargo metadata "$@" --format-version 1 | jq -r '[.resolve.nodes[] | select(.id|match(".*coreutils#\\d+\\.\\d+\\.\\d+")) | .deps[] | select(.pkg|match("uu_")) | .name | sub("^uu_"; "")] | sort | join(" ")'
# Find 'coreutils' id with regex
# with cargo v1.76.0, id = "coreutils 0.0.26 (path+file://<coreutils local directory>)"
# with cargo v1.77.0, id = "path+file://<coreutils local directory>#coreutils@0.0.26"
cargo metadata "$@" --format-version 1 | jq -r '[.resolve.nodes[] | select(.id|match(".*coreutils[ |@]\\d+\\.\\d+\\.\\d+")) | .deps[] | select(.pkg|match("uu_")) | .name | sub("^uu_"; "")] | sort | join(" ")'
fi