tools/checkrelease.sh: auto import KEYS from the release server

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2020-07-18 15:55:38 +08:00 committed by Brennan Ashton
parent f91372c09d
commit 17bd5f3d1a

View File

@ -23,6 +23,7 @@ RETURN_CODE=0
BASE_URL="https://dist.apache.org/repos/dist/dev/incubator/nuttx"
TEMPDIR="/tmp/nuttx-checkrelease"
KEY="$BASE_URL/KEYS"
function validate_url() {
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
@ -46,6 +47,17 @@ function download_release() {
fi
}
function import_key() {
if [[ $(validate_url "$KEY") ]]; then
export GNUPGHOME="$TEMPDIR/.gnupg"
wget -q -O- "$KEY" | gpg --import
echo " OK: $KEY is imported."
else
echo " - Error importing $KEY."
exit 1
fi
}
function check_sha512() {
RELEASE_FILE=$1
echo "Checking $RELEASE_FILE sha512..."
@ -150,7 +162,7 @@ function usage() {
echo "Examples:"
echo
echo " $0 --release 9.1.0-RC1"
echo " $0 --url https://dist.apache.org/repos/dist/dev/incubator/nuttx/9.1.0-RC1/"
echo " $0 --url https://dist.apache.org/repos/dist/dev/incubator/nuttx/9.1.0-RC1"
echo " $0 --dir ./some-dir-that-has-nuttx-and-apps"
echo
}
@ -164,6 +176,7 @@ do
-U|--url)
shift
URL="$1/"
KEY="$1/../KEYS"
;;
-R|--release)
shift
@ -196,6 +209,7 @@ if [[ (-z "$URL") && (-z "$DIRECTORY") ]]; then
fi
download_release
import_key
check_nuttx
check_nuttx_apps
check_sim_nsh_build