You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by bt...@apache.org on 2020/07/18 18:29:39 UTC

[incubator-nuttx] branch master updated: tools/checkrelease.sh: auto import KEYS from the release server

This is an automated email from the ASF dual-hosted git repository.

btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 17bd5f3  tools/checkrelease.sh: auto import KEYS from the release server
17bd5f3 is described below

commit 17bd5f3d1a8ac448ba552893d33cba0e13f98a4a
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Jul 18 15:55:38 2020 +0800

    tools/checkrelease.sh: auto import KEYS from the release server
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 tools/checkrelease.sh | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/tools/checkrelease.sh b/tools/checkrelease.sh
index 99e3281..fe3f720 100755
--- a/tools/checkrelease.sh
+++ b/tools/checkrelease.sh
@@ -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