You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2014/02/11 20:57:11 UTC

svn commit: r1567340 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/example/ solr/example/scripts/map-reduce/set-map-reduce-classpath.sh

Author: markrmiller
Date: Tue Feb 11 19:57:11 2014
New Revision: 1567340

URL: http://svn.apache.org/r1567340
Log:
SOLR-1301: Implement the set-map-reduce-classpath.sh script.

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/example/   (props changed)
    lucene/dev/branches/branch_4x/solr/example/scripts/map-reduce/set-map-reduce-classpath.sh

Modified: lucene/dev/branches/branch_4x/solr/example/scripts/map-reduce/set-map-reduce-classpath.sh
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/example/scripts/map-reduce/set-map-reduce-classpath.sh?rev=1567340&r1=1567339&r2=1567340&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/example/scripts/map-reduce/set-map-reduce-classpath.sh (original)
+++ lucene/dev/branches/branch_4x/solr/example/scripts/map-reduce/set-map-reduce-classpath.sh Tue Feb 11 19:57:11 2014
@@ -1,3 +1,58 @@
 #!/usr/bin/env bash
 
-export HADOOP_CLASSPATH="$sdir/../../../dist/*:$sdir/../../../contrib/map-reduce/lib/*:$sdir/../../../contrib/morphlines-core/lib/*:$sdir/../../../contrib/morphlines-cell/lib/*:$sdir/../../../contrib/extraction/lib/*:$sdir/../../solr-webapp/webapp/WEB-INF/lib/*:$sdir/../../lib/ext/*"
\ No newline at end of file
+######################################################################
+#
+# Running this script will set two environment variables:
+# HADOOP_CLASSPATH
+# HADOOP_LIBJAR: pass this to the -libjar MapReduceIndexBuilder option
+#
+######################################################################
+
+# return absolute path
+function absPath {
+  echo $(cd $(dirname "$1"); pwd)/$(basename "$1")
+}
+
+
+# Find location of this script
+
+sdir="`cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd`"
+
+solr_distrib="$sdir/../../.."
+
+echo `absPath $solr_distrib`
+
+# extract war if necessary
+
+if [ ! -d "$solr_distrib/example/solr-webapp/webapp" ]; then
+   unzip -o $solr_distrib/example/webapps/solr.war -d $solr_distrib/example/solr-webapp/webapp
+fi
+
+# Setup env variables for MapReduceIndexerTool
+
+# Setup HADOOP_CLASSPATH
+
+dir1=`absPath "$solr_distrib/dist"`
+dir2=`absPath "$solr_distrib/dist/solrj-lib"`
+dir3=`absPath "$solr_distrib/contrib/map-reduce/lib"`
+dir4=`absPath "$solr_distrib/contrib/morphlines-core/lib"`
+dir5=`absPath "$solr_distrib/contrib/morphlines-cell/lib"`
+dir6=`absPath "$solr_distrib/contrib/extraction/lib"`
+dir7=`absPath "$solr_distrib/example/solr-webapp/webapp/WEB-INF/lib"`
+
+# Setup -libjar
+
+lib1=`ls -m $dir1/*.jar | tr -d ' \n'`
+lib2=`ls -m $dir2/*.jar | tr -d ' \n' | sed 's/\,[^\,]*\(log4j\|slf4j\)[^\,]*//g'`
+lib3=`ls -m $dir3/*.jar | tr -d ' \n'`
+lib4=`ls -m $dir4/*.jar | tr -d ' \n'`
+lib5=`ls -m $dir5/*.jar | tr -d ' \n'`
+lib6=`ls -m $dir6/*.jar | tr -d ' \n'`
+lib7=`ls -m $dir7/*.jar | tr -d ' \n'`
+
+export HADOOP_CLASSPATH="$dir1/*:$dir2/*:$dir3/*:$dir4/*:$dir5/*:$dir6/*:$dir7/*"
+export HADOOP_LIBJAR="$lib1,$lib2,$lib3,$lib4,$lib5,$lib6,$lib7"
+
+#echo $HADOOP_CLASSPATH
+#echo $HADOOP_LIBJAR
+