accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [1/6] accumulo git commit: ACCUMULO-3786 Add error checks to build_native_library.sh
Date Mon, 11 May 2015 18:08:49 GMT
Repository: accumulo
Updated Branches:
  refs/heads/1.6 fa22fa431 -> 7813f507b
  refs/heads/1.7 9546b10a7 -> 98f42c762
  refs/heads/master bc4874ca6 -> 5e0552741


ACCUMULO-3786 Add error checks to build_native_library.sh

* Adds additional error checks when building native library
* Incorporates script style standards from ACCUMULO-2423 back to 1.6 branch (to ease merging)


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

Branch: refs/heads/1.6
Commit: 7813f507b49ed4247c17b365d5dcbe78da4c6ec5
Parents: fa22fa4
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Mon May 11 14:02:16 2015 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Mon May 11 14:02:16 2015 -0400

----------------------------------------------------------------------
 assemble/bin/build_native_library.sh | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/7813f507/assemble/bin/build_native_library.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/build_native_library.sh b/assemble/bin/build_native_library.sh
index 907ce2c..c2531ee 100755
--- a/assemble/bin/build_native_library.sh
+++ b/assemble/bin/build_native_library.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#! /usr/bin/env bash
 
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -17,18 +17,18 @@
 
 # Start: Resolve Script Directory
 SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
-   bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+while [[ -h "$SOURCE" ]]; do # resolve $SOURCE until the file is no longer a symlink
+   bin=$( cd -P "$( dirname "$SOURCE" )" && pwd )
    SOURCE="$(readlink "$SOURCE")"
    [[ $SOURCE != /* ]] && SOURCE="$bin/$SOURCE" # if $SOURCE was a relative symlink,
we need to resolve it relative to the path where the symlink file was located
 done
-bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+bin=$( cd -P "$( dirname "$SOURCE" )" && pwd )
 script=$( basename "$SOURCE" )
 # Stop: Resolve Script Directory
 
 
-lib="${bin}/../lib"
-native_tarball="${lib}/accumulo-native.tar.gz"
+lib=${bin}/../lib
+native_tarball=${lib}/accumulo-native.tar.gz
 final_native_target="${lib}/native"
 
 if [[ ! -f $native_tarball ]]; then
@@ -37,36 +37,36 @@ if [[ ! -f $native_tarball ]]; then
 fi
 
 # Make the destination for the native library
-mkdir -p "${final_native_target}"
+mkdir -p "${final_native_target}" || exit 1
 
 # Make a directory for us to unpack the native source into
-TMP_DIR=`mktemp -d /tmp/accumulo-native.XXXX` || exit 1
+TMP_DIR=$(mktemp -d /tmp/accumulo-native.XXXX) || exit 1
 
 # Unpack the tarball to our temp directory
 tar xf "${native_tarball}" -C "${TMP_DIR}"
 
-if [[ $? -ne 0 ]]; then
+if [[ $? != 0 ]]; then
     echo "Failed to unpack native tarball to ${TMP_DIR}"
     exit 1
 fi
 
 # Move to the first (only) directory in our unpacked tarball
-native_dir=`find "${TMP_DIR}" -maxdepth 1 -mindepth 1 -type d`
+native_dir=$(find "${TMP_DIR}" -maxdepth 1 -mindepth 1 -type d)
 
-cd "${native_dir}"
+cd "${native_dir}" || exit 1
 
 # Make the native library
-export USERFLAGS=$@
+export USERFLAGS="$@"
 make
 
 # Make sure it didn't fail
-if [[ $? -ne 0 ]]; then
+if [[ $? != 0 ]]; then
     echo "Make failed!"
     exit 1
 fi
 
 # "install" the artifact
-cp libaccumulo.* "${final_native_target}"
+cp libaccumulo.* "${final_native_target}" || exit 1
 
 # Clean up our temp directory
 rm -rf "${TMP_DIR}"


Mime
View raw message