You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by da...@apache.org on 2011/09/26 22:26:06 UTC

svn commit: r1176026 - in /pig/trunk: CHANGES.txt bin/pig build.xml

Author: daijy
Date: Mon Sep 26 20:26:05 2011
New Revision: 1176026

URL: http://svn.apache.org/viewvc?rev=1176026&view=rev
Log:
PIG-2301: Some more bin/pig, build.xml cleanup for 0.9.1

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/bin/pig
    pig/trunk/build.xml

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1176026&r1=1176025&r2=1176026&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Mon Sep 26 20:26:05 2011
@@ -257,6 +257,8 @@ PIG-2221: Couldnt find documentation for
 
 BUG FIXES
 
+PIG-2301: Some more bin/pig, build.xml cleanup for 0.9.1 (daijy)
+
 PIG-2237: LIMIT generates wrong number of records if pig determines no of reducers as more than 1 (daijy)
 
 PIG-2261: Restore support for parenthesis in Pig 0.9 (rding via daijy)

Modified: pig/trunk/bin/pig
URL: http://svn.apache.org/viewvc/pig/trunk/bin/pig?rev=1176026&r1=1176025&r2=1176026&view=diff
==============================================================================
--- pig/trunk/bin/pig (original)
+++ pig/trunk/bin/pig Mon Sep 26 20:26:05 2011
@@ -25,7 +25,7 @@
 #
 #     PIG_CLASSPATH Extra Java CLASSPATH entries.
 #
-#     HADOOP_HOME     Environment HADOOP_HOME
+#     HADOOP_HOME/HADOOP_PREFIX     Environment HADOOP_HOME/HADOOP_PREFIX(0.20.205)
 #
 #     PIG_HEAPSIZE    The maximum amount of heap to use, in MB. 
 #                                        Default is 1000.
@@ -64,13 +64,13 @@ this="$bin/$script"
 # the root of the Pig installation
 export PIG_HOME=`dirname "$this"`/..
 
-if [ ${#PIG_CONF_DIR} -eq 0 ]; then
-    if [ -d ${PIG_HOME}/conf ]; then
+if [ -z "$PIG_CONF_DIR" ]; then
+    if [ -f ${PIG_HOME}/conf/pig.properties ]; then
         PIG_CONF_DIR=${PIG_HOME}/conf
     fi
 fi
 
-if [ ${#PIG_CONF_DIR} -eq 0 ]; then
+if [ -z "$PIG_CONF_DIR" ]; then
     if [ -d /etc/pig ]; then
         # if installed with rpm/deb package
         PIG_CONF_DIR="/etc/pig"
@@ -112,16 +112,26 @@ fi
 # so that filenames w/ spaces are handled correctly in loops below
 IFS=
 
+shopt -s extglob
+shopt -s nullglob
+
 for f in $PIG_HOME/lib/*.jar; do
     CLASSPATH=${CLASSPATH}:$f;
 done
 
+JYTHON_JAR=`echo ${PIG_HOME}/lib/jython*.jar`
+
+if [ -z "$JYTHON_JAR" ]; then
+    JYTHON_JAR=`echo $PIG_HOME/build/ivy/lib/Pig/jython*.jar`
+    if [ -n "$JYTHON_JAR" ]; then
+        CLASSPATH=${CLASSPATH}:$JYTHON_JAR
+    fi
+fi
+
 for f in $PIG_HOME/share/pig/lib/*.jar; do
     CLASSPATH=${CLASSPATH}:$f;
 done
 
-shopt -s nullglob
-shopt -s extglob
 # For Hadoop 0.23.0+
 #
 #if [ -d "${PIG_HOME}/share/hadoop/common" ]; then
@@ -142,13 +152,20 @@ shopt -s extglob
 #    done
 #fi
 
-if [[ ${#HADOOP_HOME} -ne 0 && -d ${HADOOP_HOME} ]]; then
+if [ -n "$HADOOP_PREFIX" ]; then
+    if [ -f $HADOOP_PREFIX/bin/hadoop ]; then
+        HADOOP_BIN=$HADOOP_PREFIX/bin/hadoop
+    fi
+fi
+
+if [[ -z "$HADOOP_BIN" && -n "$HADOOP_HOME" && -d "$HADOOP_HOME" ]]; then
     if [ -f $HADOOP_HOME/bin/hadoop ]; then
         HADOOP_BIN=$HADOOP_HOME/bin/hadoop
     fi
 fi
 
-if [ ${#HADOOP_BIN} -eq 0 ]; then
+if [ -n "$HADOOP_BIN" ]; then
+    # if installed with rpm/deb package
     if [ -f /usr/bin/hadoop ]; then
         HADOOP_BIN=/usr/bin/hadoop
     fi
@@ -201,22 +218,19 @@ PIG_OPTS="$PIG_OPTS -Dpig.log.file=$PIG_
 PIG_OPTS="$PIG_OPTS -Dpig.home.dir=$PIG_HOME"
 
 # run it
-if [ ${#HADOOP_BIN} -ne 0 ]; then
+if [ -n "$HADOOP_BIN" ]; then
     if [ "$debug" == "true" ]; then
         echo "Find hadoop at $HADOOP_BIN"
     fi
-    for f in $PIG_HOME/pig-*withouthadoop.jar; do
-        PIG_JAR=$f;
-    done
+
+    PIG_JAR=`echo $PIG_HOME/pig-*withouthadoop.jar`
 
     # for deb/rpm package, add pig jar in /usr/share/pig
-    if [ ${#PIG_JAR} -eq 0 ]; then
-        for f in $PIG_HOME/share/pig/pig-*withouthadoop.jar; do
-            PIG_JAR=$f;
-        done
+    if [ -z "$PIG_JAR" ]; then
+        PIG_JAR=`echo $PIG_HOME/share/pig/pig-*withouthadoop.jar`
     fi
 
-    if [ ${#PIG_JAR} -ne 0 ]; then
+    if [ -n "$PIG_JAR" ]; then
         CLASSPATH=${CLASSPATH}:$PIG_JAR
     else
         echo "Cannot locate pig-withouthadoop.jar. do 'ant jar-withouthadoop', and try again"
@@ -240,24 +254,25 @@ else
     if [ "$debug" == "true" ]; then
         echo "Cannot find local hadoop installation, using bundled hadoop 20.2"
     fi
-    for f in $PIG_HOME/pig-!(*withouthadoop).jar; do
-        PIG_JAR=$f;
-    done
 
-    if [ ${#PIG_JAR} -ne 0 ]; then
-        CLASSPATH=${CLASSPATH}:$PIG_JAR
+    PIG_JAR=`echo $PIG_HOME/pig!(*withouthadoop).jar`
+    echo $PIG_JAR
+
+    if [ -n "$PIG_JAR" ]; then
+        CLASSPATH="${CLASSPATH}:$PIG_JAR"
     else
-        echo "Cannot locate pig-all.jar. do 'ant jar', and try again"
+        echo "Cannot locate pig.jar. do 'ant jar', and try again"
         exit 1
     fi
 
     CLASS=org.apache.pig.Main
+    COMMAND_LINE="$JAVA $JAVA_HEAP_MAX $PIG_OPTS -classpath $CLASSPATH $CLASS ${remaining[@]}"
     if [ "$debug" == "true" ]; then
         echo "dry run:"
-        echo "$JAVA" $JAVA_HEAP_MAX $PIG_OPTS -classpath "$CLASSPATH" $CLASS "${remaining[@]}"
+        echo "$COMMAND_LINE"
         echo
     else
-        exec "$JAVA" $JAVA_HEAP_MAX $PIG_OPTS -classpath "$CLASSPATH" $CLASS "${remaining[@]}"
+        exec $COMMAND_LINE
     fi
 fi
 shopt -u nullglob

Modified: pig/trunk/build.xml
URL: http://svn.apache.org/viewvc/pig/trunk/build.xml?rev=1176026&r1=1176025&r2=1176026&view=diff
==============================================================================
--- pig/trunk/build.xml (original)
+++ pig/trunk/build.xml Mon Sep 26 20:26:05 2011
@@ -15,7 +15,7 @@
    limitations under the License.
 -->
 
-<project name="Pig" default="jar-withouthadoop" 
+<project name="Pig" default="jar-all" 
 	xmlns:artifact="urn:maven-artifact-ant"
 	xmlns:ivy="antlib:org.apache.ivy.ant">
     <!-- Load all the default properties, and any the user wants    -->
@@ -74,7 +74,7 @@
     <property name="output.jarfile.javadoc" value="${build.dir}/${final.name}-javadoc.jar" />
     <!-- Maintain old pig.jar in top level directory. -->
     <property name="output.jarfile.backcompat.withouthadoop" value="${basedir}/${name}-withouthadoop.jar" />
-    <property name="output.jarfile.backcompat" value="${basedir}/${name}-all.jar" />
+    <property name="output.jarfile.backcompat" value="${basedir}/${name}.jar" />
 
     <!-- test properties -->
     <property name="test.src.dir" value="${basedir}/test" />
@@ -514,6 +514,9 @@
         </jar>
     </target>
 
+    <target name="jar-all" depends="jar,jar-withouthadoop" description="Create pig-all.jar and pig-withouthadoop.jar">
+    </target>
+
     <!-- ================================================================== -->
     <!-- Make pig.jar                                                       -->
     <!-- ================================================================== -->
@@ -878,7 +881,7 @@
 
         <copy file="${output.jarfile.backcompat.withouthadoop}" tofile="${dist.dir}/${final.name}-withouthadoop.jar" />
 
-        <copy file="${output.jarfile.backcompat}" tofile="${dist.dir}/${final.name}-all.jar" />
+        <copy file="${output.jarfile.backcompat}" tofile="${dist.dir}/${final.name}.jar" />
 
         <copy todir="${dist.dir}/" file="ivy.xml" />