From 440b95005c7925463fa846382feb6aa0cd76172a Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Fri, 18 Sep 2020 14:30:36 +0200 Subject: [PATCH] Check that direct dependencies exist --- scripts/gh-build-crate.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scripts/gh-build-crate.sh b/scripts/gh-build-crate.sh index 392d6158..ffea3818 100755 --- a/scripts/gh-build-crate.sh +++ b/scripts/gh-build-crate.sh @@ -6,6 +6,26 @@ trap 'echo "Interrupted" >&2 ; exit 1' INT set -o errexit set -o nounset +function check_dependencies_exist() { + for dep in $(alr with | tail +1); do + if [[ $dep =~ ([a-z0-9_]+)[^a-z0-9_] ]]; then # this should always match the crate name + local crate=${BASH_REMATCH[1]} + + if alr list | cut -f1 -d' ' | grep -qw $crate; then + return 0 # found + else + echo "Direct dependency is unknown: $dep (crate name: $crate)" + return 1 + fi + else + echo Could not identify dependency crate name in: $dep + return 1 + fi + done + + return 0 +} + # See whats happening git log --graph --decorate --pretty=oneline --abbrev-commit --all | head -30 @@ -76,6 +96,9 @@ for file in $CHANGES; do alr show --solve --detail --external-detect $milestone solution=$(alr show --solve --detail --external-detect $milestone) + # Check that no direct dependency is unknown + check_dependencies_exist() + # Skip on explicit unavailability if alr show --system $milestone | grep -q 'Available when: False'; then echo SKIPPING crate build: $milestone UNAVAILABLE on system