From a72edd2b10322315fea6e7abc8700a8a78100f3c Mon Sep 17 00:00:00 2001 From: Tsz-wo Sze Date: Mon, 24 Aug 2009 22:06:54 +0000 Subject: [PATCH] HADOOP-6152. Fix classpath variables in bin/hadoop-config.sh and some other scripts. Contributed by Aaron Kimball git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@807404 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ bin/hadoop-config.sh | 58 ++++++++++++++++++++++++++++++++------------ bin/hdfs | 2 +- bin/mapred | 2 +- bin/rcc | 2 +- 5 files changed, 48 insertions(+), 19 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 73e5040530..b0a3c4e4e6 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -938,6 +938,9 @@ Trunk (unreleased changes) HADOOP-6103. Clones the classloader as part of Configuration clone. (Amareshwari Sriramadasu via ddas) + HADOOP-6152. Fix classpath variables in bin/hadoop-config.sh and some + other scripts. (Aaron Kimball via szetszwo) + Release 0.20.1 - Unreleased INCOMPATIBLE CHANGES diff --git a/bin/hadoop-config.sh b/bin/hadoop-config.sh index 7d4406b36e..4e8629b83c 100644 --- a/bin/hadoop-config.sh +++ b/bin/hadoop-config.sh @@ -115,9 +115,6 @@ fi if [ -d "$HADOOP_CORE_HOME/build/test/classes" ]; then CLASSPATH=${CLASSPATH}:$HADOOP_CORE_HOME/build/test/classes fi -if [ -d "$HADOOP_CORE_HOME/build/tools" ]; then - CLASSPATH=${CLASSPATH}:$HADOOP_CORE_HOME/build/tools -fi # so that filenames w/ spaces are handled correctly in loops below IFS= @@ -157,13 +154,6 @@ for f in $HADOOP_CORE_HOME/lib/jsp-2.1/*.jar; do CLASSPATH=${CLASSPATH}:$f; done -for f in $HADOOP_CORE_HOME/hadoop-*-tools.jar; do - TOOL_PATH=${TOOL_PATH}:$f; -done -for f in $HADOOP_CORE_HOME/build/hadoop-*-tools.jar; do - TOOL_PATH=${TOOL_PATH}:$f; -done - # add user-specified CLASSPATH last if [ "$HADOOP_CLASSPATH" != "" ]; then CLASSPATH=${CLASSPATH}:${HADOOP_CLASSPATH} @@ -189,7 +179,6 @@ unset IFS if $cygwin; then HADOOP_CORE_HOME=`cygpath -w "$HADOOP_CORE_HOME"` HADOOP_LOG_DIR=`cygpath -w "$HADOOP_LOG_DIR"` - TOOL_PATH=`cygpath -p -w "$TOOL_PATH"` fi # setup 'java.library.path' for native-hadoop code if necessary JAVA_LIBRARY_PATH='' @@ -228,12 +217,12 @@ HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.policy.file=$HADOOP_POLICYFILE" if [ "$HADOOP_HDFS_HOME" = "" ]; then if [ -d "${HADOOP_HOME}/hdfs" ]; then HADOOP_HDFS_HOME=$HADOOP_HOME/hdfs - echo Found HDFS installed at $HADOOP_HDFS_HOME + #echo Found HDFS installed at $HADOOP_HDFS_HOME fi fi if [ -d "${HADOOP_HDFS_HOME}" ]; then - for f in $HADOOP_HDFS_HOME/hadoop-*-hdfs.jar; do + for f in $HADOOP_HDFS_HOME/hadoop-hdfs-*.jar; do CLASSPATH=${CLASSPATH}:$f; done @@ -247,14 +236,51 @@ if [ -d "${HADOOP_HDFS_HOME}" ]; then fi fi +# cygwin path translation +if $cygwin; then + HADOOP_HDFS_HOME=`cygpath -w "$HADOOP_HDFS_HOME"` +fi + # set mapred home if mapred is present if [ "$HADOOP_MAPRED_HOME" = "" ]; then if [ -d "${HADOOP_HOME}/mapred" ]; then HADOOP_MAPRED_HOME=$HADOOP_HOME/mapred - echo Found MAPRED installed at $HADOOP_MAPRED_HOME + #echo Found MAPRED installed at $HADOOP_MAPRED_HOME fi fi +if [ -d "${HADOOP_MAPRED_HOME}" ]; then + for f in $HADOOP_MAPRED_HOME/hadoop-mapred-*.jar; do + CLASSPATH=${CLASSPATH}:$f + done + + for f in $HADOOP_MAPRED_HOME/lib/*.jar; do + CLASSPATH=${CLASSPATH}:$f + done + + if [ -d "$HADOOP_MAPRED_HOME/build/classes" ]; then + CLASSPATH=${CLASSPATH}:$HADOOP_MAPRED_HOME/build/classes + fi + + if [ -d "$HADOOP_MAPRED_HOME/build/tools" ]; then + CLASSPATH=${CLASSPATH}:$HADOOP_MAPRED_HOME/build/tools + fi + + for f in $HADOOP_MAPRED_HOME/hadoop-mapred-tools-*.jar; do + TOOL_PATH=${TOOL_PATH}:$f; + done + for f in $HADOOP_MAPRED_HOME/build/hadoop-mapred-tools-*.jar; do + TOOL_PATH=${TOOL_PATH}:$f; + done +fi + +# cygwin path translation +if $cygwin; then + HADOOP_MAPRED_HOME=`cygpath -w "$HADOOP_MAPRED_HOME"` + TOOL_PATH=`cygpath -p -w "$TOOL_PATH"` +fi + + # TODO:remove this when dir structure is changed -export HADOOP_HDFS_HOME=$HADOOP_HOME -export HADOOP_MAPRED_HOME=$HADOOP_HOME +#export HADOOP_HDFS_HOME=$HADOOP_HOME +#export HADOOP_MAPRED_HOME=$HADOOP_HOME diff --git a/bin/hdfs b/bin/hdfs index 94b2754bc1..ce62260d7e 100755 --- a/bin/hdfs +++ b/bin/hdfs @@ -94,7 +94,7 @@ fi if [ -d "$HADOOP_HDFS_HOME/webapps" ]; then CLASSPATH=${CLASSPATH}:$HADOOP_HDFS_HOME fi -for f in $HADOOP_HDFS_HOME/hadoop-*-hdfs.jar; do +for f in $HADOOP_HDFS_HOME/hadoop-hdfs-*.jar; do CLASSPATH=${CLASSPATH}:$f; done diff --git a/bin/mapred b/bin/mapred index b345274027..c56a19da23 100755 --- a/bin/mapred +++ b/bin/mapred @@ -84,7 +84,7 @@ fi if [ -d "$HADOOP_MAPRED_HOME/webapps" ]; then CLASSPATH=${CLASSPATH}:$HADOOP_MAPRED_HOME fi -for f in $HADOOP_MAPRED_HOME/hadoop-*-mapred.jar; do +for f in $HADOOP_MAPRED_HOME/hadoop-mapred-*.jar; do CLASSPATH=${CLASSPATH}:$f; done diff --git a/bin/rcc b/bin/rcc index a39745be6f..a023da021f 100755 --- a/bin/rcc +++ b/bin/rcc @@ -72,7 +72,7 @@ IFS= if [ -d "$HADOOP_HOME/webapps" ]; then CLASSPATH=${CLASSPATH}:$HADOOP_HOME fi -for f in $HADOOP_HOME/hadoop-*-core.jar; do +for f in $HADOOP_HOME/hadoop-core-*.jar; do CLASSPATH=${CLASSPATH}:$f; done