accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikewalch <...@git.apache.org>
Subject [GitHub] accumulo pull request #160: ACCUMULO-4490: Simplify Accumulo scripts and con...
Date Tue, 08 Nov 2016 15:28:07 GMT
Github user mikewalch commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/160#discussion_r87011593
  
    --- Diff: assemble/bin/accumulo ---
    @@ -15,173 +15,189 @@
     # See the License for the specific language governing permissions and
     # limitations under the License.
     
    -# 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 )"
    -   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 )"
    -script=$( basename "${SOURCE}" )
    -# Stop: Resolve Script Directory
    +function build_native() {
    +  native_tarball=${ACCUMULO_LIB_DIR}/accumulo-native.tar.gz
    +  final_native_target="${ACCUMULO_LIB_DIR}/native"
     
    -. "${bin}"/config.sh
    +  if [[ ! -f $native_tarball ]]; then
    +      echo "Could not find native code artifact: ${native_tarball}";
    +      exit 1
    +  fi
     
    -START_JAR="${ACCUMULO_HOME}/lib/accumulo-start.jar"
    +  # Make the destination for the native library
    +  mkdir -p "${final_native_target}" || exit 1
     
    -#
    -# Resolve a program to its installation directory
    -#
    -locationByProgram()
    -{
    -   RESULT=$( which "$1" )
    -   if [[ "$?" != 0 && -z "${RESULT}" ]]; then
    -      echo "Cannot find '$1' and '$2' is not set in $ACCUMULO_CONF_DIR/accumulo-env.sh"
    +  # Make a directory for us to unpack the native source into
    +  TMP_DIR=$(mktemp -d /tmp/accumulo-native.XXXX) || exit 1
    +
    +  # Unpack the tarball to our temp directory
    +  if ! tar xf "${native_tarball}" -C "${TMP_DIR}"
    +  then
    +      echo "Failed to unpack native tarball to ${TMP_DIR}"
           exit 1
    -   fi
    -   while [ -h "${RESULT}" ]; do # resolve $RESULT until the file is no longer a symlink
    -      DIR="$( cd -P "$( dirname "$RESULT" )" && pwd )"
    -      RESULT="$(readlink "${RESULT}")"
    -      [[ "${RESULT}" != /* ]] && RESULT="${DIR}/${RESULT}" # if $RESULT was a
relative symlink, we need to resolve it relative to the path where the symlink file was located
    -   done
    -   # find the relative home directory, accounting for an extra bin directory
    -   RESULT=$(dirname "$(dirname "${RESULT}")")
    -   echo "Auto-set ${2} to '${RESULT}'.  To suppress this message, set ${2} in conf/accumulo-env.sh"
    -   eval "${2}=${RESULT}"
    -}
    +  fi
     
    -test -z "${JAVA_HOME}"      && locationByProgram java JAVA_HOME
    -test -z "${HADOOP_PREFIX}"  && locationByProgram hadoop HADOOP_PREFIX
    -test -z "${ZOOKEEPER_HOME}" && locationByProgram zkCli.sh ZOOKEEPER_HOME
    +  # Move to the first (only) directory in our unpacked tarball
    +  native_dir=$(find "${TMP_DIR}" -maxdepth 1 -mindepth 1 -type d)
     
    -DEFAULT_GENERAL_JAVA_OPTS=""
    +  cd "${native_dir}" || exit 1
     
    -#
    -# ACCUMULO_XTRAJARS is where all of the commandline -add items go into for reading by
accumulo.
    -# It also holds the JAR run with the jar command and, if possible, any items in the JAR
manifest's Class-Path.
    -#
    -if [ "$1" = "-add" ] ; then
    -    export ACCUMULO_XTRAJARS="$2"
    -    shift 2
    -else
    -    export ACCUMULO_XTRAJARS=""
    -fi
    -if [ "$1" = "jar" -a -f "$2" ] ; then
    -    if [[ $2 =~ ^/ ]]; then
    -      jardir="$(dirname "$2")"
    -      jarfile="$2"
    -    else
    -      jardir="$(pwd)"
    -      jarfile="${jardir}/${2}"
    -    fi
    -    if jar tf "$jarfile" | grep -q META-INF/MANIFEST.MF ; then
    -      cp="$(unzip -p "$jarfile" META-INF/MANIFEST.MF | grep ^Class-Path: | sed 's/^Class-Path:
*//')"
    -      if [[ -n "$cp" ]] ; then
    -         for j in $cp; do
    -            if [[ "$j" != "Class-Path:" ]] ; then
    -               ACCUMULO_XTRAJARS="${jardir}/${j},$ACCUMULO_XTRAJARS"
    -            fi
    -         done
    -      fi
    -    fi
    -    ACCUMULO_XTRAJARS="${jarfile},$ACCUMULO_XTRAJARS"
    -fi
    +  # Make the native library
    +  export USERFLAGS="$@"
    +  if ! make
    --- End diff --
    
    fix made


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message