You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2016/08/08 19:09:32 UTC

kudu git commit: build: Make 'download-thirdparty.sh' resilient to failure

Repository: kudu
Updated Branches:
  refs/heads/master d60923c91 -> eaa15dea6


build: Make 'download-thirdparty.sh' resilient to failure

Many contributors work at home on flaky internet connections. This
change does two things:

 - Use gtar on Mac, if available, as I've found it more resilient to
   failures than bsdtar. For example, I just spent 20 minutes debugging
   a build failure in cmake which was due to a truncated tar.

 - Exit if the script doesn't successfully extract, currently a warning
   prefixed with "Error" is logged but the process is left to fail with
   some unknown error later on

Change-Id: Ied07d236b1c9cd2eb78aef7ad372f8d835e09782
Reviewed-on: http://gerrit.cloudera.org:8080/3857
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <to...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/eaa15dea
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/eaa15dea
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/eaa15dea

Branch: refs/heads/master
Commit: eaa15dea662a978d246f5f99321215a7f08416c8
Parents: d60923c
Author: Brock Noland <br...@phdata.io>
Authored: Sun Aug 7 15:58:54 2016 -0500
Committer: Todd Lipcon <to...@apache.org>
Committed: Mon Aug 8 19:09:18 2016 +0000

----------------------------------------------------------------------
 thirdparty/download-thirdparty.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/eaa15dea/thirdparty/download-thirdparty.sh
----------------------------------------------------------------------
diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh
index 147c52b..c3b4f63 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -48,6 +48,11 @@ fetch_and_expand() {
     exit 1
   fi
 
+  TAR_CMD=tar
+  if [[ "$OSTYPE" == "darwin"* ]] && which gtar &>/dev/null; then
+    TAR_CMD=gtar
+  fi
+
   FULL_URL="${CLOUDFRONT_URL_PREFIX}/${FILENAME}"
   SUCCESS=0
   # Loop in case we encounter a corrupted archive and we need to re-download it.
@@ -67,7 +72,7 @@ fetch_and_expand() {
         continue
       fi
     elif [[ "$FILENAME" =~ \.(tar\.gz|tgz)$ ]]; then
-      if ! tar xf "$FILENAME"; then
+      if ! $TAR_CMD xf "$FILENAME"; then
         echo "Error untarring $FILENAME, removing file"
         rm "$FILENAME"
         continue
@@ -83,6 +88,7 @@ fetch_and_expand() {
 
   if [ $SUCCESS -ne 1 ]; then
     echo "Error: failed to fetch and unpack $FILENAME"
+    exit 1
   fi
 
   # Allow for not removing previously-downloaded artifacts.