Updated Branches: refs/heads/master b826647b0 -> ab10ddf2f
BIGTOP-504. provide a functionality for detecting libjvm.so in bigtop-utils (Sean Mackrory via rvs) Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/ab10ddf2 Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/ab10ddf2 Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/ab10ddf2 Branch: refs/heads/master Commit: ab10ddf2f8b3e3320886724a2d431dd064aa27c8 Parents: b826647 Author: Roman Shaposhnik <[email protected]> Authored: Mon Feb 18 18:50:42 2013 -0800 Committer: Roman Shaposhnik <[email protected]> Committed: Mon Feb 18 18:50:48 2013 -0800 ---------------------------------------------------------------------- .../src/common/bigtop-utils/bigtop-detect-javahome | 1 + .../src/common/bigtop-utils/bigtop-detect-javalibs | 50 +++++++++++++++ .../src/common/bigtop-utils/bigtop-utils.default | 3 + .../src/common/hadoop/install_hadoop.sh | 11 ++- bigtop-packages/src/deb/bigtop-utils/rules | 1 + bigtop-packages/src/deb/hadoop/control | 2 +- .../src/rpm/bigtop-utils/SPECS/bigtop-utils.spec | 4 + 7 files changed, 67 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/ab10ddf2/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome b/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome index 6c2b6eb..b818afa 100644 --- a/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome +++ b/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome @@ -47,3 +47,4 @@ if [ -z "$JAVA_HOME" ]; then fi done fi + http://git-wip-us.apache.org/repos/asf/bigtop/blob/ab10ddf2/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javalibs ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javalibs b/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javalibs new file mode 100644 index 0000000..985b0d6 --- /dev/null +++ b/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javalibs @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# Override JAVA_NATIVE_PATH in the file below if you want to disable +# automatic library detection +[ -r /etc/default/bigtop-utils ] && . /etc/default/bigtop-utils + +# ensure that java has already been found +if [ -z "$JAVA_HOME" ]; then + echo "JAVA_HOME must be set before calling bigtop-detect-javalibs" + exit 1 +fi + +# attempt to find native java libraries +if [ -z "$JAVA_NATIVE_PATH" ]; then + for library in $JAVA_NATIVE_LIBS; do + if [ -z "$JAVA_NATIVE_PATH" ]; then + libraries_predicate="-name $library" + else + libraries_predicate="$libraries_predicate -o -name $library" + fi + done + library_paths=`find -L ${JAVA_HOME} \( $libraries_predicate \) -exec dirname {} \; | sort -u` + for library_path in $library_paths; do + if [ -z "$JAVA_NATIVE_PATH" ]; then + export JAVA_NATIVE_PATH="$library_path" + else + export JAVA_NATIVE_PATH="$library_path:$JAVA_NATIVE_PATH" + fi + done + if [ -z "$JAVA_NATIVE_PATH" ]; then + echo "Unable to find native Java libraries in $JAVA_HOME" + exit 2 + fi +fi + http://git-wip-us.apache.org/repos/asf/bigtop/blob/ab10ddf2/bigtop-packages/src/common/bigtop-utils/bigtop-utils.default ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/bigtop-utils/bigtop-utils.default b/bigtop-packages/src/common/bigtop-utils/bigtop-utils.default index 8a1b285..153906d 100644 --- a/bigtop-packages/src/common/bigtop-utils/bigtop-utils.default +++ b/bigtop-packages/src/common/bigtop-utils/bigtop-utils.default @@ -15,3 +15,6 @@ # Override JAVA_HOME detection for all bigtop packages # export JAVA_HOME + +# Provide a colon-delimited list of directories to search for native Java libraries (e.g. libjvm.so) +# export JAVA_NATIVE_PATH http://git-wip-us.apache.org/repos/asf/bigtop/blob/ab10ddf2/bigtop-packages/src/common/hadoop/install_hadoop.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/hadoop/install_hadoop.sh b/bigtop-packages/src/common/hadoop/install_hadoop.sh index a704c32..e5e3a36 100755 --- a/bigtop-packages/src/common/hadoop/install_hadoop.sh +++ b/bigtop-packages/src/common/hadoop/install_hadoop.sh @@ -283,10 +283,13 @@ fi export HADOOP_LIBEXEC_DIR=${SYSTEM_LIBEXEC_DIR#${PREFIX}} if [ "\${LD_LIBRARY_PATH}" = "" ]; then - export LD_LIBRARY_PATH=/usr/lib - for f in \`find \${JAVA_HOME}/ -name client -prune -o -name libjvm.so -exec dirname {} \;\`; do - export LD_LIBRARY_PATH=\$f:\${LD_LIBRARY_PATH} - done + export JAVA_NATIVE_LIBS="libjvm.so" + if [ -e /usr/libexec/bigtop-detect-javalibs ]; then + . /usr/libexec/bigtop-detect-javalibs + elif [ -e /usr/lib/bigtop-utils/bigtop-detect-javalibs ]; then + . /usr/lib/bigtop-utils/bigtop-detect-javalibs + fi + export LD_LIBRARY_PATH=\${JAVA_NATIVE_PATH}:/usr/lib fi # Pulls all jars from hadoop client package http://git-wip-us.apache.org/repos/asf/bigtop/blob/ab10ddf2/bigtop-packages/src/deb/bigtop-utils/rules ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/bigtop-utils/rules b/bigtop-packages/src/deb/bigtop-utils/rules index 984b2ff..92e9ad3 100644 --- a/bigtop-packages/src/deb/bigtop-utils/rules +++ b/bigtop-packages/src/deb/bigtop-utils/rules @@ -32,5 +32,6 @@ override_dh_auto_install: # Copy repo file install -d -p -m 755 debian/bigtop-utils/usr/lib/bigtop-utils/ install -p -m 755 debian/bigtop-detect-javahome debian/bigtop-utils/usr/lib/bigtop-utils/ + install -p -m 755 debian/bigtop-detect-javalibs debian/bigtop-utils/usr/lib/bigtop-utils/ install -d -p -m 755 debian/bigtop-utils/etc/default install -p -m 644 debian/bigtop-utils.default debian/bigtop-utils/etc/default/bigtop-utils http://git-wip-us.apache.org/repos/asf/bigtop/blob/ab10ddf2/bigtop-packages/src/deb/hadoop/control ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/hadoop/control b/bigtop-packages/src/deb/hadoop/control index 8e019b3..82cf345 100644 --- a/bigtop-packages/src/deb/hadoop/control +++ b/bigtop-packages/src/deb/hadoop/control @@ -81,7 +81,7 @@ Description: The Hadoop MapReduce (MRv2) Package: hadoop-hdfs-fuse Architecture: i386 amd64 -Depends: ${shlibs:Depends}, hadoop-hdfs (= ${source:Version}), hadoop-client (= ${source:Version}), libfuse2, fuse-utils +Depends: ${shlibs:Depends}, hadoop-hdfs (= ${source:Version}), hadoop-client (= ${source:Version}), libfuse2, fuse-utils, bigtop-utils (> 0.6) Enhances: hadoop Description: Mountable HDFS These projects (enumerated below) allow HDFS to be mounted (on most flavors of Unix) as a standard file system using http://git-wip-us.apache.org/repos/asf/bigtop/blob/ab10ddf2/bigtop-packages/src/rpm/bigtop-utils/SPECS/bigtop-utils.spec ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/rpm/bigtop-utils/SPECS/bigtop-utils.spec b/bigtop-packages/src/rpm/bigtop-utils/SPECS/bigtop-utils.spec index 6aebda9..0e0083d 100644 --- a/bigtop-packages/src/rpm/bigtop-utils/SPECS/bigtop-utils.spec +++ b/bigtop-packages/src/rpm/bigtop-utils/SPECS/bigtop-utils.spec @@ -31,6 +31,7 @@ BuildArch: noarch Source0: bigtop-detect-javahome Source1: LICENSE Source2: bigtop-utils.default +Source3: bigtop-detect-javalibs # "which" command is needed for a lot of projects. # It is part of the package "util-linux" on suse and "which" everywhere else @@ -51,6 +52,7 @@ This includes a collection of useful tools and files for Bigtop install -p -m 644 %{SOURCE0} . install -p -m 644 %{SOURCE1} . install -p -m 644 %{SOURCE2} . +install -p -m 644 %{SOURCE3} . %build @@ -59,6 +61,7 @@ install -p -m 644 %{SOURCE2} . install -d -p -m 755 $RPM_BUILD_ROOT%{_libexecdir}/ install -d -p -m 755 $RPM_BUILD_ROOT/etc/default install -p -m 755 %{SOURCE0} $RPM_BUILD_ROOT%{_libexecdir}/ +install -p -m 755 %{SOURCE3} $RPM_BUILD_ROOT%{_libexecdir}/ install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/default/bigtop-utils %clean @@ -71,6 +74,7 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) /etc/default/bigtop-utils %{_libexecdir}/bigtop-detect-javahome +%{_libexecdir}/bigtop-detect-javalibs %changelog
