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

aw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yetus.git


The following commit(s) were added to refs/heads/master by this push:
     new 24d2c57  YETUS-961. Upgrade prototool to include the fix for the 
walktimeout (#105)
24d2c57 is described below

commit 24d2c5711584b4657e119833b4edd2b49d6d3744
Author: Allen Wittenauer <a...@apache.org>
AuthorDate: Mon Apr 6 08:17:40 2020 -0700

    YETUS-961. Upgrade prototool to include the fix for the walktimeout (#105)
---
 .../src/main/shell/test-patch-docker/Dockerfile    |  2 +-
 precommit/src/main/shell/test-patch.d/prototool.sh | 41 +++++++++++++++++-----
 2 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/precommit/src/main/shell/test-patch-docker/Dockerfile 
b/precommit/src/main/shell/test-patch-docker/Dockerfile
index 6071959..a5b5b57 100644
--- a/precommit/src/main/shell/test-patch-docker/Dockerfile
+++ b/precommit/src/main/shell/test-patch-docker/Dockerfile
@@ -276,7 +276,7 @@ RUN add-apt-repository -y ppa:longsleep/golang-backports \
     && rm -rf /var/lib/apt/lists/*
 RUN go get -u github.com/mgechev/revive \
     && go get -u github.com/mrtazz/checkmake \
-    && (GO111MODULE=on go get github.com/uber/prototool/cmd/prototool@v1.9.0) \
+    && (GO111MODULE=on go get 
github.com/uber/prototool/cmd/prototool@8fd43bfa177c73b628d189cb942d0f4c4af4908d)
 \
     && (GO111MODULE=on go get 
github.com/golangci/golangci-lint/cmd/golangci-lint@v1.24.0) \
     && mv /root/go/bin/* /usr/local/bin \
     && rm -rf /root/go /root/.cache/go-build
diff --git a/precommit/src/main/shell/test-patch.d/prototool.sh 
b/precommit/src/main/shell/test-patch.d/prototool.sh
index 913d0b1..2b5f839 100755
--- a/precommit/src/main/shell/test-patch.d/prototool.sh
+++ b/precommit/src/main/shell/test-patch.d/prototool.sh
@@ -25,6 +25,9 @@ PROTOTOOL=${PROTOTOOL:-$(command -v prototool 2>/dev/null)}
 function prototool_usage
 {
   yetus_add_option "--prototool=<path>" "path to prototool executable 
(default: ${PROTOTOOL})"
+  yetus_add_option "--prototool-dir=<path>" "set the starting dir to run 
prototool"
+  yetus_add_option "--prototool-walktimeout=<###u>" "set prototool walktimeout 
value"
+
 }
 
 function prototool_parse_args
@@ -33,10 +36,19 @@ function prototool_parse_args
 
   for i in "$@"; do
     case ${i} in
-    --prototool=*)
-      delete_parameter "${i}"
-      PROTOTOOL=${i#*=}
-    ;;
+      --prototool=*)
+        delete_parameter "${i}"
+        PROTOTOOL=${i#*=}
+      ;;
+      --prototool-basedir=*)
+        delete_parameter "${i}"
+        PROTOTOOL_BASEDIR=${i#*=}
+      ;;
+      --prototool-walktimeout=*)
+        delete_parameter "${i}"
+        PROTOTOOL_WALKTIMEOUT=${i#*=}
+      ;;
+
     esac
   done
 }
@@ -58,10 +70,6 @@ function prototool_precheck
     add_vote_table 0 prototool "prototool was not available."
     delete_test prototool
   fi
-
-  # shellcheck disable=SC2016
-  PROTOTOOL_VERSION=$("${PROTOTOOL}" version 2>/dev/null | "${GREP}" Version | 
"${AWK}" '{print $NF}')
-  add_version_data prototool "${PROTOTOOL_VERSION}"
 }
 
 function prototool_executor
@@ -69,6 +77,7 @@ function prototool_executor
   declare repostatus=$1
   declare prototoolStderr=${repostatus}-prototool-stderr.txt
   declare -a args
+  declare -a protoargs
 
   if ! verify_needed_test prototool; then
     return 0
@@ -89,8 +98,18 @@ function prototool_executor
     args=("cat")
   fi
 
+  if [[ -n "${PROTOTOOL_WALKTIMEOUT}" ]]; then
+    protoargs+=(--walk-timeout "${PROTOTOOL_WALKTIMEOUT}")
+  fi
+
+  ## MUST ALWAYS BE LAST!
+  if [[ -n "${PROTOTOOL_BASEDIR}" ]]; then
+    protoargs+=("${PROTOTOOL_BASEDIR}")
+  fi
+
   pushd "${BASEDIR}" >/dev/null || return 1
-  "${PROTOTOOL}" lint 2> "${PATCH_DIR}/${prototoolStderr}" | \
+
+  "${PROTOTOOL}" lint  "${protoargs[@]}" 2> "${PATCH_DIR}/${prototoolStderr}" 
| \
     "${args[@]}" > "${PATCH_DIR}/${repostatus}-prototool-result.txt"
   popd >/dev/null || return 1
 
@@ -132,6 +151,10 @@ function prototool_postapply
     return 0
   fi
 
+  # shellcheck disable=SC2016
+  PROTOTOOL_VERSION=$("${PROTOTOOL}" version 2>/dev/null | "${GREP}" Version | 
"${AWK}" '{print $NF}')
+  add_version_data prototool "${PROTOTOOL_VERSION}"
+
   prototool_executor patch
 
   calcdiffs "${PATCH_DIR}/branch-prototool-result.txt" \

Reply via email to