From 69e6ae18f79da75049921db0bce9c00ee02ee4bc Mon Sep 17 00:00:00 2001 From: Alejandro R Mosteo Date: Thu, 23 Jun 2022 11:33:40 +0200 Subject: [PATCH] Fix detection of compiler crates in test script (#556) * Be a bit more clever detecting a compiler dependency * Work around premature closing of pipe Co-authored-by: GHA --- scripts/gh-build-crate.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/gh-build-crate.sh b/scripts/gh-build-crate.sh index 2b6cd3fe..dd545945 100755 --- a/scripts/gh-build-crate.sh +++ b/scripts/gh-build-crate.sh @@ -133,11 +133,15 @@ for file in $CHANGES; do if grep -iq 'gnat_' <<< $solution && ! grep -iq 'gnat_external' <<< $solution; then gnat_dep=$(grep -E -o '^ gnat_[a-z0-9_]*=\S*' <<< $solution | tail -1 | xargs) gnat_dep=${gnat_dep:-gnat_native} - echo "INSTALLING indexed gprbuild compatible with $gnat_dep" - alr toolchain --select $gnat_dep gprbuild - # -E for regex, -o for only the matched part, xargs to trim space - # We must give both the gnat in the solution and gprbuild, so both are compatible - # Even if we default to gnat_native, that would select the appropriate gprbuild + if alr show $gnat_dep | grep 'Provides: gnat=' >/dev/null; then + echo "INSTALLING indexed toolchain compatible with $gnat_dep" + alr toolchain --select $gnat_dep gprbuild + # -E for regex, -o for only the matched part, xargs to trim space + # We must give both the gnat in the solution and gprbuild, so both are compatible + # Even if we default to gnat_native, that would select the appropriate gprbuild + else + echo "Dependency $gnat_dep is not a GNAT compiler dependency, treating it as a regular crate" + fi fi # Detect whether the crate is binary to skip build