From 60c9122603991e3aaf90c9b0c075c67f8fe39773 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Wed, 13 Dec 2023 20:40:39 +0800 Subject: [PATCH] fix: asf checker and gpr --- bin/asf-check | 13 +++++++++---- bin/gpr | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/asf-check b/bin/asf-check index 6a9e7d7..1212881 100755 --- a/bin/asf-check +++ b/bin/asf-check @@ -67,7 +67,7 @@ check() { # check unexpected binary files echo "** CHECK UNEXPRECTED BINARY FILES **" - UNEXPRECTED_BIN_FILES="$(find $SRC -type f ! -size 0 ! -name '*.png' ! -name '*.ico' -exec grep -IL . '{}' \;)" + UNEXPRECTED_BIN_FILES="$(find $SRC -type f ! -size 0 ! -name '*.jpg' ! -name '*.png' ! -name '*.ico' -exec grep -IL . '{}' \;)" if [ -n "$UNEXPRECTED_BIN_FILES" ]; then printf "Found unexpected binary files: \n%s\n" "$UNEXPRECTED_BIN_FILES" else @@ -79,12 +79,17 @@ check() { echo "** CHECK ASF HEADER **" HEADER="$(cat $SRC/backend/.golangci-goheader.template)" test -n "$HEADER" - for FN in $(find "$SRC" -name '*.go'); do - if ! grep -qF "$HEADER" $FN; then + OIFS="$IFS" + IFS=' +' + for FN in `find "$SRC" -name '*.go'`; do + echo "$FN" + if ! grep -qF "$HEADER" "$FN"; then echo $FN has no ASF header exit -1 fi done + IFS="$OIFS" for FN in $(find "$SRC" -name '*.js' -not -path './config-ui/node_modules/*'); do if ! cut -c4- $FN | grep -qF "$HEADER"; then echo $FN has no ASF header @@ -95,7 +100,7 @@ check() { echo " -+1 ++1 (binding) I checked these items: - Download links are valid. diff --git a/bin/gpr b/bin/gpr index 17604c1..fe1d58a 100755 --- a/bin/gpr +++ b/bin/gpr @@ -11,6 +11,7 @@ if [ -n "$PROXY_HOST" ] && [ -n "$PROXY_PORT" ]; then fi BRANCH=$(git branch --show-current) +# UPSTREAM_BRANCH=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} | awk -F/ '{print $2}') UPSTREAM_BRANCH=$(HTTPS_PROXY=$HTTP_PROXY git remote show upstream | grep -oP 'HEAD branch: \K\w+') ORIGIN_NAME=${1:-origin} ORIGIN_URL=$(git remote get-url $ORIGIN_NAME)