arduino-pico/tests/ci/pkgrefs_test.sh
Earle F. Philhower, III 8016a932f3
Add astyle format, boards.txt, and package check (#166)
Miscellaneous CI checks for code style, boards.txt update, and that all
referenced packages are available.
2021-05-24 15:01:03 -07:00

24 lines
758 B
Bash
Executable file

#!/bin/bash
set -e
fail=0
for i in $(cat ./package/package_pico_index.template.json | jq '.packages[0]."tools" | .[] | .systems[] | "\(.url) \(.checksum)"' | sort -u | sed 's/ /@/'); do
url=$(echo $i | sed 's/@/ /' | cut -f2 -d\" | cut -f1 -d' ')
sha=$(echo $i | sed 's/@/ /' | cut -f2 -d\" | cut -f2 -d' ' | cut -f2 -d:)
echo "INFO: Checking $url"
rm -f file.bin
wget --quiet -O file.bin $url
calc=$(sha256sum file.bin | cut -f1 -d" ")
if [ "$sha" != "$calc" ]; then
echo "ERROR: Download failed or SHA mismatch for $url"
echo "ERROR: Expected $sha"
echo "ERROR: Received $calc"
fail=1
fi
done
if [ $fail -ne 0 ]; then
echo ERROR: Package file integrity check failed
exit 1
fi