1
0
mirror of https://github.com/uutils/coreutils synced 2024-07-01 06:54:36 +00:00

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,
- if local path == '<parent directory>/coreutils/', id = "path+file://<parent directory>/coreutils#0.0.26"
- if local path != '<parent directory>/coreutils/', id = "path+file://<coreutils local directory>#coreutils@0.0.26"

Fix uutils/coreutils#6479

Signed-off-by: Laurent Cheylus <foxy@free.fr>
This commit is contained in:
Laurent Cheylus 2024-06-19 17:35:45 +02:00
parent c9f4742f3b
commit e50a3a4471
No known key found for this signature in database

View File

@ -35,6 +35,8 @@ cd "${project_main_dir}" &&
else
# 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(" ")'
# with cargo >= v1.77.0
# - if local path != '<...>/coreutils' id = "path+file://<coreutils local directory>#coreutils@0.0.26"
# - if local path == '<...>/coreutils' id = "path+file://<parent 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