pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject svn commit: r1150968 - in /pig/trunk: ./ bin/ ivy/ src/packages/ src/packages/deb/ src/packages/deb/pig.control/ src/packages/rpm/ src/packages/rpm/spec/ src/packages/templates/ src/packages/templates/conf/
Date Tue, 26 Jul 2011 01:39:04 GMT
Author: daijy
Date: Tue Jul 26 01:39:02 2011
New Revision: 1150968

URL: http://svn.apache.org/viewvc?rev=1150968&view=rev
Log:
PIG-1857: Create an package integration project

Added:
    pig/trunk/src/packages/
    pig/trunk/src/packages/deb/
    pig/trunk/src/packages/deb/pig.control/
    pig/trunk/src/packages/deb/pig.control/conffile
    pig/trunk/src/packages/deb/pig.control/control
    pig/trunk/src/packages/deb/pig.control/postinst
    pig/trunk/src/packages/deb/pig.control/postrm
    pig/trunk/src/packages/deb/pig.control/preinst
    pig/trunk/src/packages/deb/pig.control/prerm
    pig/trunk/src/packages/rpm/
    pig/trunk/src/packages/rpm/spec/
    pig/trunk/src/packages/rpm/spec/pig.spec
    pig/trunk/src/packages/templates/
    pig/trunk/src/packages/templates/conf/
    pig/trunk/src/packages/templates/conf/pig-env.sh
    pig/trunk/src/packages/update-pig-env.sh
Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/bin/pig
    pig/trunk/build.xml
    pig/trunk/ivy.xml
    pig/trunk/ivy/libraries.properties

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1150968&r1=1150967&r2=1150968&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Tue Jul 26 01:39:02 2011
@@ -24,6 +24,8 @@ INCOMPATIBLE CHANGES
 
 IMPROVEMENTS
 
+PIG-1857: Create an package integration project (eyang via daijy)
+
 PIG-1904: Default split destination (azaroth via thejas)
 
 PIG-2125: Make Pig work with hadoop .NEXT (daijy)

Modified: pig/trunk/bin/pig
URL: http://svn.apache.org/viewvc/pig/trunk/bin/pig?rev=1150968&r1=1150967&r2=1150968&view=diff
==============================================================================
--- pig/trunk/bin/pig (original)
+++ pig/trunk/bin/pig Tue Jul 26 01:39:02 2011
@@ -57,20 +57,10 @@ done
 
 # resolve links - $0 may be a softlink
 this="${BASH_SOURCE-$0}"
-while [ -h "$this" ]; do
-    ls=`ls -ld "$this"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
-    if expr "$link" : '.*/.*' > /dev/null; then
-        this="$link"
-    else
-        this=`dirname "$this"`/"$link"
-    fi
-done
 
 # convert relative path to absolute path
-bin=`dirname "$this"`
-script=`basename "$this"`
-bin=`unset CDPATH; cd "$bin"; pwd`
+bin=$(cd -P -- "$(dirname -- "$this")" && pwd -P)
+script="$(basename -- "$this")"
 this="$bin/$script"
 
 # the root of the Pig installation
@@ -87,9 +77,9 @@ then
         PIG_CONF_DIR=$confdir
     fi
 fi
- 
+
 # Allow alternate conf dir location.
-PIG_CONF_DIR="${PIG_CONF_DIR:-$PIG_HOME/conf}"
+PIG_CONF_DIR="${PIG_CONF_DIR:-$PIG_HOME/etc/pig}"
 
 if [ -f "${PIG_CONF_DIR}/pig-env.sh" ]; then
     . "${PIG_CONF_DIR}/pig-env.sh"
@@ -118,6 +108,11 @@ fi
 CLASSPATH="${PIG_CONF_DIR}"
 CLASSPATH=${CLASSPATH}:$JAVA_HOME/lib/tools.jar
 
+# add user-specified CLASSPATH
+if [ "$PIG_CLASSPATH" != "" ]; then
+    CLASSPATH=${CLASSPATH}:${PIG_CLASSPATH}
+fi
+ 
 # for developers, add Pig classes to CLASSPATH
 if [ -d "$PIG_HOME/build/classes" ]; then
     CLASSPATH=${CLASSPATH}:$PIG_HOME/build/classes
@@ -130,7 +125,7 @@ fi
 IFS=
 
 # for releases, add core pig to CLASSPATH
-for f in $PIG_HOME/pig-*-core.jar; do
+for f in $PIG_HOME/share/pig/pig-*-core.jar; do
     CLASSPATH=${CLASSPATH}:$f;
 done
 
@@ -139,7 +134,58 @@ for f in $PIG_HOME/build/pig-*-SNAPSHOT.
     CLASSPATH=${CLASSPATH}:$f;
 done
 
-# Set the version for Hadoop, default to 17
+# locate Hadoop
+# For Hadoop 0.20.203+
+#
+if [ -d "${PIG_HOME}/share/hadoop" ]; then
+    for f in ${PIG_HOME}/share/hadoop/hadoop*.jar; do
+        CLASSPATH=${CLASSPATH}:$f;
+    done
+    for f in ${PIG_HOME}/share/hadoop/lib/*.jar; do
+        CLASSPATH=${CLASSPATH}:$f;
+    done
+fi
+
+
+# For Hadoop 0.23.0+
+#
+#if [ -d "${PIG_HOME}/share/hadoop/common" ]; then
+#    for f in ${PIG_HOME}/share/hadoop/common/hadoop*.jar; do
+#        CLASSPATH=${CLASSPATH}:$f;
+#    done
+#fi
+#
+#if [ -d "${PIG_HOME}/share/hadoop/hdfs" ]; then
+#    for f in ${PIG_HOME}/share/hadoop/hdfs/hadoop*.jar; do
+#        CLASSPATH=${CLASSPATH}:$f;
+#    done
+#fi
+#
+#if [ -d "${PIG_HOME}/share/hadoop/mapreduce" ]; then
+#    for f in ${PIG_HOME}/share/hadoop/mapreduce/hadoop*.jar; do
+#        CLASSPATH=${CLASSPATH}:$f;
+#    done
+#fi
+
+if [ -d "${PIG_HOME}/etc/hadoop" ]; then
+    CLASSPATH=${CLASSPATH}:${PIG_HOME}/etc/hadoop;
+fi
+
+# locate ZooKeeper
+if [ -d "${PIG_HOME}/share/zookeeper" ]; then
+    for f in ${PIG_HOME}/share/zookeeper/zookeeper-*.jar; do
+        CLASSPATH=${CLASSPATH}:$f
+    done
+fi
+
+# locate HBase
+if [ -d "${PIG_HOME}/share/hbase" ]; then
+    for f in ${PIG_HOME}/share/hbase/hbase-*.jar; do
+        CLASSPATH=${CLASSPATH}:$f
+    done
+fi
+
+# Set the version for Hadoop, default to 20
 PIG_HADOOP_VERSION="${PIG_HADOOP_VERSION:-20}"
 # add libs to CLASSPATH.    There can be more than one version of the hadoop
 # libraries in the lib dir, so don't blindly add them all.    Only add the one
@@ -160,12 +206,7 @@ done
 # if using HBase, likely want to include HBase config
 HBASE_CONF_DIR=${HBASE_CONF_DIR:-/etc/hbase}
 if [ -n "$HBASE_CONF_DIR" ] && [ -d "$HBASE_CONF_DIR" ]; then
-  CLASSPATH=$HBASE_CONF_DIR:$CLASSPATH
-fi
-
-# add user-specified CLASSPATH last
-if [ "$PIG_CLASSPATH" != "" ]; then
-    CLASSPATH=${CLASSPATH}:${PIG_CLASSPATH}
+    CLASSPATH=$HBASE_CONF_DIR:$CLASSPATH
 fi
 
 # default log directory & file

Modified: pig/trunk/build.xml
URL: http://svn.apache.org/viewvc/pig/trunk/build.xml?rev=1150968&r1=1150967&r2=1150968&view=diff
==============================================================================
--- pig/trunk/build.xml (original)
+++ pig/trunk/build.xml Tue Jul 26 01:39:02 2011
@@ -28,11 +28,12 @@
     <!-- name and version properties -->
     <property name="name" value="pig" />
     <property name="Name" value="Pig" />
-	<property name="ant-task.version" value="2.0.10" />
-	<property name="pig.pom" value="${basedir}/ivy/pig.pom" />
-  	<property name="pigsmoke.pom" value="${basedir}/ivy/pigsmoke.pom" />
-  	<property name="pigunit.pom" value="${basedir}/ivy/pigunit.pom" />
-	<property name="version" value="0.10.0-SNAPSHOT" />
+    <property name="ant-task.version" value="2.0.10" />
+    <property name="pig.pom" value="${basedir}/ivy/pig.pom" />
+    <property name="pigsmoke.pom" value="${basedir}/ivy/pigsmoke.pom" />
+    <property name="pigunit.pom" value="${basedir}/ivy/pigunit.pom" />
+    <property name="pig.version" value="0.10.0" />
+    <property name="version" value="${pig.version}-SNAPSHOT" />
     <property name="final.name" value="${name}-${version}" />
 
     <!-- source properties -->
@@ -200,6 +201,14 @@
     <property name="jdiff.stable" value="0.8.0"/>
     <property name="jdiff.stable.javadoc" value="http://hadoop.apache.org/${name}/docs/r${jdiff.stable}/api/"/>

 
+    <!-- Packaging properties -->
+    <property name="package.release" value="1"/>
+    <property name="package.prefix" value="/usr"/>
+    <property name="package.conf.dir" value="/etc/pig"/>
+    <property name="package.log.dir" value="/var/log/pig"/>
+    <property name="package.buildroot" value="/tmp/pig_package_build_${user.name}"/>
+    <property name="package.build.dir" value="/tmp/pig_package_build_${user.name}/BUILD"/>
+
     <!-- ====================================================== -->
     <!-- Stuff needed by all targets                            -->
     <!-- ====================================================== -->
@@ -426,7 +435,7 @@
     <!-- ================================================================== -->
     <!-- Documentation                                                      -->
     <!-- ================================================================== -->
-    <target name="javadoc" depends="jar, ivy-javadoc" description="Create documentation">
+    <target name="javadoc" depends="jar-withouthadoop, ivy-javadoc" description="Create
documentation">
         <mkdir dir="${build.javadoc}" />
         <javadoc overview="${src.dir}/overview.html" packagenames="org.apache.pig.*" destdir="${build.javadoc}"
author="true" version="true" use="true" windowtitle="${Name} ${version} API" doctitle="${Name}
${version} API" bottom="Copyright &amp;copy; ${year} The Apache Software Foundation">
             <packageset dir="${src.dir}" />
@@ -759,78 +768,83 @@
     <!-- ================================================================== -->
     <target name="package" depends="docs, api-report" description="Create a Pig release">
         <mkdir dir="${dist.dir}" />
-        <mkdir dir="${dist.dir}/lib" />
-        <mkdir dir="${dist.dir}/conf" />
-        <mkdir dir="${dist.dir}/scripts" />
-        <mkdir dir="${dist.dir}/docs" />
-        <mkdir dir="${dist.dir}/docs/api" />
-        <mkdir dir="${dist.dir}/docs/jdiff"/>
-        <mkdir dir="${dist.dir}/license" />
+        <mkdir dir="${dist.dir}/etc/pig" />
+        <mkdir dir="${dist.dir}/share/pig/scripts" />
+        <mkdir dir="${dist.dir}/share/pig/templates/conf" />
+        <mkdir dir="${dist.dir}/share/doc/pig" />
+        <mkdir dir="${dist.dir}/share/doc/pig/api" />
+        <mkdir dir="${dist.dir}/share/doc/pig/jdiff"/>
+        <mkdir dir="${dist.dir}/share/doc/pig/license" />
 
-        <copy todir="${dist.dir}/lib" includeEmptyDirs="false">
+        <copy todir="${dist.dir}/share/pig/lib" includeEmptyDirs="false">
             <!--fileset dir="${ivy.lib.dir}"/-->
             <fileset dir="${lib.dir}"/>
         </copy>
 
-        <copy file="${output.jarfile.backcompat}" tofile="${dist.dir}/${final.name}-core.jar"
/>
-
-        <copy todir="${dist.dir}/" file="ivy.xml" />
-
-        <copy todir="${dist.dir}/ivy">
-            <fileset dir="ivy" />
-        </copy>
+        <copy file="${output.jarfile.backcompat}" tofile="${dist.dir}/share/pig/${final.name}-core.jar"
/>
 
         <copy todir="${dist.dir}/bin">
             <fileset dir="bin" />
         </copy>
 
-        <copy todir="${dist.dir}/docs">
+        <copy todir="${dist.dir}/share/doc/pig">
             <fileset dir="${build.docs}" />
         </copy>
 
-		<copy todir="${dist.dir}/conf" file="conf/pig.properties"/>
+        <copy todir="${dist.dir}/etc/pig" file="conf/pig.properties"/>
 
-        <copy todir="${dist.dir}/src" includeEmptyDirs="true">
-            <fileset dir="${src.dir}" />
-        </copy>
-
-        <copy todir="${dist.dir}/lib-src" includeEmptyDirs="true">
-            <fileset dir="${src.lib.dir}" />
-        </copy>
-
-        <copy todir="${dist.dir}/test" includeEmptyDirs="true">
+        <copy todir="${dist.dir}/share/pig/test" includeEmptyDirs="true">
             <fileset dir="${test.src.dir}" />
         </copy>
 
-        <copy todir="${dist.dir}/tutorial" includeEmptyDirs="true">
+        <copy todir="${dist.dir}/share/pig/tutorial" includeEmptyDirs="true">
             <fileset dir="tutorial" />
         </copy>
 
-        <copy todir="${dist.dir}/contrib" includeEmptyDirs="true">
+        <copy todir="${dist.dir}/share/pig/contrib" includeEmptyDirs="true">
             <fileset dir="contrib" />
         </copy>
 
-        <copy todir="${dist.dir}/" file="build.xml" />
-
-        <copy todir="${dist.dir}">
+        <copy todir="${dist.dir}/share/doc/pig">
             <fileset dir=".">
                 <include name="*.txt" />
             </fileset>
         </copy>
 
-        <copy todir="${dist.dir}/license">
+        <copy todir="${dist.dir}/share/doc/pig/license">
             <fileset dir="license" />
         </copy>
 
+        <copy todir="${dist.dir}/share/pig/templates/conf">
+            <fileset dir="src/packages/templates/conf"/>
+        </copy>
+
         <chmod perm="ugo+x" type="file">
             <fileset dir="${dist.dir}/bin" />
         </chmod>
 
+        <copy file="${basedir}/src/packages/update-pig-env.sh" tofile="${dist.dir}/sbin/update-pig-env.sh"/>
+
     </target>
 
     <!-- ================================================================== -->
-    <!-- Make release tarball                                               -->
+    <!-- Make release packages                                              -->
     <!-- ================================================================== -->
+    <target name="source" description="Source distribution">
+      <mkdir dir="${build.dir}"/>
+      <tar compression="gzip" longfile="gnu" destfile="${build.dir}/${name}-source-${version}.tar.gz">
+          <tarfileset dir="${basedir}" mode="644">
+              <exclude name="bin/*"/>
+              <exclude name="build/**"/>
+              <exclude name="pig.jar"/>
+              <exclude name="src-gen/**"/>
+          </tarfileset>
+          <tarfileset dir="${basedir}" mode="755">
+              <include name="bin/*"/>
+          </tarfileset> 
+      </tar>
+    </target>
+
     <target name="tar" depends="package" description="Create release tarball">
         <tar compression="gzip" longfile="gnu" destfile="${build.dir}/${final.name}.tar.gz">
             <tarfileset dir="${build.dir}" mode="664">
@@ -842,7 +856,94 @@
             </tarfileset>
         </tar>
     </target>
+
+    <target name="rpm" depends="jar-withouthadoop, tar" description="Make rpm package">
+        <mkdir dir="${package.buildroot}/BUILD" />
+        <mkdir dir="${package.buildroot}/RPMS" />
+        <mkdir dir="${package.buildroot}/SRPMS" />
+        <mkdir dir="${package.buildroot}/SOURCES" />
+        <mkdir dir="${package.buildroot}/SPECS" />
+        <copy todir="${package.buildroot}/SOURCES">
+            <fileset dir="${build.dir}">
+                <include name="${final.name}.tar.gz" />
+                <include name="${final.name}-withouthadoop.jar" />
+            </fileset>
+        </copy>
+        <copy file="${src.dir}/packages/rpm/spec/pig.spec" todir="${package.buildroot}/SPECS">
+            <filterchain>
+                <replacetokens>
+                    <token key="final.name" value="${final.name}" />
+                    <token key="version" value="${pig.version}" />
+                    <token key="package.release" value="${package.release}" />
+                    <token key="package.build.dir" value="${package.build.dir}" />
+                    <token key="package.prefix" value="${package.prefix}" />
+                    <token key="package.conf.dir" value="${package.conf.dir}" />
+                    <token key="package.log.dir" value="${package.log.dir}" />
+                </replacetokens>
+            </filterchain>
+        </copy>
+        <rpm specFile="pig.spec" command="-bb" topDir="${package.buildroot}" cleanBuildDir="true"
failOnError="true"/>
+        <copy todir="${build.dir}/" flatten="true">
+            <fileset dir="${package.buildroot}/RPMS">
+                <include name="**/${name}*.rpm" />
+            </fileset>
+            <fileset dir="${package.buildroot}/SRPMS">
+                <include name="**/${name}*.rpm" />
+            </fileset>
+        </copy>
+        <delete dir="${package.buildroot}" quiet="true" verbose="false"/>
+    </target>
    
+    <target name="deb" depends="jar-withouthadoop, tar" description="Make deb package">
+        <taskdef name="deb"
+            classname="org.vafer.jdeb.ant.DebAntTask">
+            <classpath refid="classpath" />
+        </taskdef>
+        <mkdir dir="${package.build.dir}/pig.control" />
+        <copy todir="${package.build.dir}/pig.control">
+            <fileset dir="${src.dir}/packages/deb/pig.control">
+                <exclude name="control" />
+            </fileset>
+        </copy>
+        <copy file="${build.dir}/${final.name}-withouthadoop.jar" tofile="${build.dir}/${final.name}/share/pig/${final.name}-core.jar"
overwrite="true" />
+        <copy file="${src.dir}/packages/deb/pig.control/control" todir="${package.build.dir}/pig.control">
+            <filterchain>
+                <replacetokens>
+                    <token key="final.name" value="${final.name}" />
+                    <token key="version" value="${pig.version}" />
+                    <token key="package.release" value="${package.release}" />
+                    <token key="package.build.dir" value="${package.build.dir}" />
+                    <token key="package.prefix" value="${package.prefix}" />
+                    <token key="package.conf.dir" value="${package.conf.dir}" />
+                    <token key="package.log.dir" value="${package.log.dir}" />
+                </replacetokens>
+            </filterchain>
+        </copy>
+        <deb destfile="${package.buildroot}/${name}_${pig.version}-${package.release}_${os.arch}.deb"
control="${package.build.dir}/pig.control">
+            <tarfileset dir="${build.dir}/${final.name}" filemode="644" prefix="/usr">
+                <exclude name="bin/*" />
+                <exclude name="conf" />
+                <exclude name="conf/*" />
+                <exclude name="etc/**" />
+                <include name="**" />
+            </tarfileset>
+            <tarfileset dir="${build.dir}/${final.name}" filemode="755" prefix="/usr">
+                <include name="bin/*" />
+                <include name="sbin/*" />
+            </tarfileset>
+            <tarfileset dir="${build.dir}/${final.name}/etc/pig" filemode="644" prefix="/etc/pig">
+                <include name="**" />
+            </tarfileset>
+        </deb>
+
+        <copy todir="${build.dir}/" flatten="true">
+            <fileset dir="${package.buildroot}">
+                <include name="**/${name}*.deb" />
+            </fileset>
+        </copy>
+        <delete dir="${package.buildroot}" quiet="true" verbose="false"/>
+    </target>
+
     <!-- ================================================================== -->
     <!-- Findbugs                                                           -->
     <!-- ================================================================== -->

Modified: pig/trunk/ivy.xml
URL: http://svn.apache.org/viewvc/pig/trunk/ivy.xml?rev=1150968&r1=1150967&r2=1150968&view=diff
==============================================================================
--- pig/trunk/ivy.xml (original)
+++ pig/trunk/ivy.xml Tue Jul 26 01:39:02 2011
@@ -126,5 +126,8 @@
 
     <dependency org="hsqldb" name="hsqldb" rev="${hsqldb.version}"
       conf="test->default" />
+    <dependency org="org.vafer" name="jdeb" rev="${jdeb.version}"
+      conf="compile->master">
+    </dependency>
     </dependencies>
 </ivy-module>

Modified: pig/trunk/ivy/libraries.properties
URL: http://svn.apache.org/viewvc/pig/trunk/ivy/libraries.properties?rev=1150968&r1=1150967&r2=1150968&view=diff
==============================================================================
--- pig/trunk/ivy/libraries.properties (original)
+++ pig/trunk/ivy/libraries.properties Tue Jul 26 01:39:02 2011
@@ -16,7 +16,7 @@
 #These are the versions of our dependencies (in alphabetical order)
 apacheant.version=1.7.1
 antlr.version=2.7.6
-pig.version=0.8.0
+pig.version=0.9.0
 
 avro.version=1.4.1
 commons-beanutils.version=1.7.0
@@ -33,6 +33,7 @@ hbase.version=0.90.0
 hsqldb.version=1.8.0.10
 jackson.version=1.6.0
 javacc.version=4.2
+jdeb.version=0.8
 jdiff.version=1.0.9
 jetty-util.version=6.1.14
 jline.version=0.9.94

Added: pig/trunk/src/packages/deb/pig.control/conffile
URL: http://svn.apache.org/viewvc/pig/trunk/src/packages/deb/pig.control/conffile?rev=1150968&view=auto
==============================================================================
--- pig/trunk/src/packages/deb/pig.control/conffile (added)
+++ pig/trunk/src/packages/deb/pig.control/conffile Tue Jul 26 01:39:02 2011
@@ -0,0 +1 @@
+/etc/pig

Added: pig/trunk/src/packages/deb/pig.control/control
URL: http://svn.apache.org/viewvc/pig/trunk/src/packages/deb/pig.control/control?rev=1150968&view=auto
==============================================================================
--- pig/trunk/src/packages/deb/pig.control/control (added)
+++ pig/trunk/src/packages/deb/pig.control/control Tue Jul 26 01:39:02 2011
@@ -0,0 +1,9 @@
+Package: pig
+Version: @version@
+Section: misc
+Priority: optional
+Architecture: all
+Depends: sun-java6-jre, hadoop
+Maintainer: Apache Software Foundation <user@pig.apache.org>
+Description: Apache Pig is a platform for analyzing large data sets that consists of a high-level
language for expressing data analysis programs, coupled with infrastructure for evaluating
these programs. The salient property of Pig programs is that their structure is amenable to
substantial parallelization, which in turns enables them to handle very large data sets.
+Distribution: development

Added: pig/trunk/src/packages/deb/pig.control/postinst
URL: http://svn.apache.org/viewvc/pig/trunk/src/packages/deb/pig.control/postinst?rev=1150968&view=auto
==============================================================================
--- pig/trunk/src/packages/deb/pig.control/postinst (added)
+++ pig/trunk/src/packages/deb/pig.control/postinst Tue Jul 26 01:39:02 2011
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# 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.
+
+bash /usr/sbin/update-pig-env.sh \
+  --prefix=/usr \
+  --bin-dir=/usr/bin \
+  --conf-dir=/etc/pig \
+  --log-dir=/var/log/pig

Added: pig/trunk/src/packages/deb/pig.control/postrm
URL: http://svn.apache.org/viewvc/pig/trunk/src/packages/deb/pig.control/postrm?rev=1150968&view=auto
==============================================================================
--- pig/trunk/src/packages/deb/pig.control/postrm (added)
+++ pig/trunk/src/packages/deb/pig.control/postrm Tue Jul 26 01:39:02 2011
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# 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.
+
+exit 0

Added: pig/trunk/src/packages/deb/pig.control/preinst
URL: http://svn.apache.org/viewvc/pig/trunk/src/packages/deb/pig.control/preinst?rev=1150968&view=auto
==============================================================================
--- pig/trunk/src/packages/deb/pig.control/preinst (added)
+++ pig/trunk/src/packages/deb/pig.control/preinst Tue Jul 26 01:39:02 2011
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# 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.
+
+getent group hadoop 2>/dev/null >/dev/null || /usr/sbin/groupadd -r hadoop

Added: pig/trunk/src/packages/deb/pig.control/prerm
URL: http://svn.apache.org/viewvc/pig/trunk/src/packages/deb/pig.control/prerm?rev=1150968&view=auto
==============================================================================
--- pig/trunk/src/packages/deb/pig.control/prerm (added)
+++ pig/trunk/src/packages/deb/pig.control/prerm Tue Jul 26 01:39:02 2011
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# 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.
+bash /usr/sbin/update-pig-env.sh \
+  --prefix=/usr \
+  --bin-dir=/usr/bin \
+  --conf-dir=/etc/pig \
+  --log-dir=/var/log/pig \
+  --uninstal

Added: pig/trunk/src/packages/rpm/spec/pig.spec
URL: http://svn.apache.org/viewvc/pig/trunk/src/packages/rpm/spec/pig.spec?rev=1150968&view=auto
==============================================================================
--- pig/trunk/src/packages/rpm/spec/pig.spec (added)
+++ pig/trunk/src/packages/rpm/spec/pig.spec Tue Jul 26 01:39:02 2011
@@ -0,0 +1,138 @@
+#   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.
+
+#
+# RPM Spec file for Pig version @version@
+#
+
+%define name         pig
+%define version      @version@
+%define release      @package.release@
+
+# Installation Locations
+%define _prefix      @package.prefix@
+%define _bin_dir     %{_prefix}/bin
+%define _conf_dir    @package.conf.dir@
+%define _include_dir %{_prefix}/include
+%define _lib_dir     %{_prefix}/lib
+%define _lib64_dir   %{_prefix}/lib64
+%define _libexec_dir %{_prefix}/libexec
+%define _log_dir     @package.log.dir@
+%define _man_dir     %{_prefix}/man
+%define _pid_dir     @package.pid.dir@
+%define _sbin_dir    %{_prefix}/sbin
+%define _share_dir   %{_prefix}/share/pig
+%define _src_dir     %{_prefix}/src
+%define _var_dir     %{_prefix}/var/lib
+
+# Build time settings
+%define _build_dir  @package.build.dir@
+%define _final_name @final.name@
+%define debug_package %{nil}
+
+# Disable brp-java-repack-jars
+%define __os_install_post    \
+    /usr/lib/rpm/redhat/brp-compress \
+    %{!?__debug_package:/usr/lib/rpm/redhat/brp-strip %{__strip}} \
+    /usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} \
+    /usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} \
+    /usr/lib/rpm/brp-python-bytecompile %{nil}
+
+Summary: Apache Pig is a platform for analyzing large data sets that consists of a high-level
language for expressing data analysis programs.
+License: Apache License, Version 2.0
+URL: http://pig.apache.org/
+Vendor: Apache Software Foundation
+Group: Development/Libraries
+Name: %{name}
+Version: %{version}
+Release: %{release} 
+Source0: %{_final_name}.tar.gz
+Source1: %{_final_name}-withouthadoop.jar
+Prefix: %{_prefix}
+Prefix: %{_conf_dir}
+Prefix: %{_log_dir}
+Buildroot: %{_build_dir}
+Requires: hadoop, sh-utils, textutils
+AutoReqProv: no
+Provides: pig
+
+%description
+Apache Pig is a platform for analyzing large data sets that consists of a high-level language
for expressing data analysis programs, coupled with infrastructure for evaluating these programs.
The salient property of Pig programs is that their structure is amenable to substantial parallelization,
which in turns enables them to handle very large data sets.
+
+#%package conf-pseudo
+#Summary: Default Hadoop configuration templates
+#Group: System/Daemons
+#Requires: %{name} == %{version}
+#
+#%description conf-pseudo
+#Installation of this RPM will setup your machine to run in pseudo-distributed mode
+#where each Hadoop daemon runs in a separate Java process.
+
+%prep
+%setup -n %{_final_name}
+
+%build
+if [ -d ${RPM_BUILD_DIR}%{_prefix} ]; then
+  rm -rf ${RPM_BUILD_DIR}%{_prefix}
+fi
+
+if [ -d ${RPM_BUILD_DIR}%{_log_dir} ]; then
+  rm -rf ${RPM_BUILD_DIR}%{_log_dir}
+fi
+
+if [ -d ${RPM_BUILD_DIR}%{_conf_dir} ]; then
+  rm -rf ${RPM_BUILD_DIR}%{_conf_dir}
+fi
+
+if [ -d ${RPM_BUILD_DIR}%{_pid_dir} ]; then
+  rm -rf ${RPM_BUILD_DIR}%{_pid_dir}
+fi
+
+mkdir -p ${RPM_BUILD_DIR}%{_prefix}
+mkdir -p ${RPM_BUILD_DIR}%{_log_dir}
+mkdir -p ${RPM_BUILD_DIR}%{_conf_dir}
+
+#########################
+#### INSTALL SECTION ####
+#########################
+%install
+mv ${RPM_BUILD_DIR}/%{_final_name}/etc/pig/* ${RPM_BUILD_DIR}%{_conf_dir}
+rm -rf ${RPM_BUILD_DIR}/%{_final_name}/etc/pig
+mv ${RPM_BUILD_DIR}/%{_final_name}/* ${RPM_BUILD_DIR}%{_prefix}
+cp -f ${RPM_BUILD_DIR}/../SOURCES/%{_final_name}-withouthadoop.jar ${RPM_BUILD_DIR}%{_share_dir}/%{_final_name}-core.jar
+
+%pre
+
+%post
+bash ${RPM_INSTALL_PREFIX0}/sbin/update-pig-env.sh \
+       --prefix=${RPM_INSTALL_PREFIX0} \
+       --bin-dir=${RPM_INSTALL_PREFIX0}/bin \
+       --conf-dir=${RPM_INSTALL_PREFIX1} \
+       --log-dir=${RPM_INSTALL_PREFIX2}
+
+%preun
+bash ${RPM_INSTALL_PREFIX0}/sbin/update-pig-env.sh \
+       --prefix=${RPM_INSTALL_PREFIX0} \
+       --bin-dir=${RPM_INSTALL_PREFIX0}/bin \
+       --conf-dir=${RPM_INSTALL_PREFIX1} \
+       --log-dir=${RPM_INSTALL_PREFIX2} \
+       --uninstall
+
+%files 
+%defattr(-,root,root)
+%attr(0755,root,hadoop) %{_log_dir}
+%config %{_conf_dir}
+%{_prefix}
+

Added: pig/trunk/src/packages/templates/conf/pig-env.sh
URL: http://svn.apache.org/viewvc/pig/trunk/src/packages/templates/conf/pig-env.sh?rev=1150968&view=auto
==============================================================================
--- pig/trunk/src/packages/templates/conf/pig-env.sh (added)
+++ pig/trunk/src/packages/templates/conf/pig-env.sh Tue Jul 26 01:39:02 2011
@@ -0,0 +1,16 @@
+# 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.
+
+export JAVA_HOME=${JAVA_HOME}

Added: pig/trunk/src/packages/update-pig-env.sh
URL: http://svn.apache.org/viewvc/pig/trunk/src/packages/update-pig-env.sh?rev=1150968&view=auto
==============================================================================
--- pig/trunk/src/packages/update-pig-env.sh (added)
+++ pig/trunk/src/packages/update-pig-env.sh Tue Jul 26 01:39:02 2011
@@ -0,0 +1,153 @@
+#!/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.
+
+# This script configures pig-env.sh and symlinkis directories for 
+# relocating package locations.
+
+usage() {
+  echo "
+usage: $0 <parameters>
+  Required parameters:
+     --prefix=PREFIX             path to install into
+
+  Optional parameters:
+     --arch=i386                 OS Architecture
+     --bin-dir=PREFIX/bin        Executable directory
+     --conf-dir=/etc/pig         Configuration directory
+     --log-dir=/var/log/pig      Log directory
+  "
+  exit 1
+}
+
+template_generator() {
+  REGEX='(\$\{[a-zA-Z_][a-zA-Z_0-9]*\})'
+  cat $1 |
+  while read line ; do
+    while [[ "$line" =~ $REGEX ]] ; do
+      LHS=${BASH_REMATCH[1]}
+      RHS="$(eval echo "\"$LHS\"")"
+      line=${line//$LHS/$RHS}
+    done
+    echo $line >> $2
+  done
+}
+
+OPTS=$(getopt \
+  -n $0 \
+  -o '' \
+  -l 'arch:' \
+  -l 'prefix:' \
+  -l 'bin-dir:' \
+  -l 'conf-dir:' \
+  -l 'lib-dir:' \
+  -l 'log-dir:' \
+  -l 'uninstall' \
+  -- "$@")
+
+if [ $? != 0 ] ; then
+    usage
+fi
+
+eval set -- "${OPTS}"
+while true ; do
+  case "$1" in
+    --arch)
+      ARCH=$2 ; shift 2
+      ;;
+    --prefix)
+      PREFIX=$2 ; shift 2
+      ;;
+    --bin-dir)
+      BIN_DIR=$2 ; shift 2
+      ;;
+    --log-dir)
+      LOG_DIR=$2 ; shift 2
+      ;;
+    --lib-dir)
+      LIB_DIR=$2 ; shift 2
+      ;;
+    --conf-dir)
+      CONF_DIR=$2 ; shift 2
+      ;;
+    --uninstall)
+      UNINSTALL=1; shift
+      ;;
+    --)
+      shift ; break
+      ;;
+    *)
+      echo "Unknown option: $1"
+      usage
+      exit 1
+      ;;
+  esac
+done
+
+for var in PREFIX; do
+  if [ -z "$(eval "echo \$$var")" ]; then
+    echo Missing param: $var
+    usage
+  fi
+done
+
+ARCH=${ARCH:-i386}
+BIN_DIR=${BIN_DIR:-$PREFIX/bin}
+CONF_DIR=${CONF_DIR:-$PREFIX/etc/pig}
+LIB_DIR=${LIB_DIR:-$PREFIX/share/pig}
+LOG_DIR=${LOG_DIR:-$PREFIX/var/log}
+UNINSTALL=${UNINSTALL:-0}
+PIG_HOME=${PREFIX}
+
+if [ "${ARCH}" != "i386" ]; then
+  LIB_DIR=${LIB_DIR}64
+fi
+
+. /etc/default/hadoop-env.sh
+
+if [ -e /etc/default/hbase-env.sh ]; then
+  . /etc/default/hbase-env.sh
+fi
+
+if [ "${UNINSTALL}" -eq "1" ]; then
+  # Remove symlinks
+  if [ "${CONF_DIR}" != "${PREFIX}/etc/pig" ]; then
+    rm -f ${PREFIX}/etc/pig
+  fi
+else
+  # Create symlinks
+  if [ "${CONF_DIR}" != "${PREFIX}/etc/pig" ]; then
+    if [ ! -e ${PREFIX}/etc/pig ]; then
+      ln -sf ${CONF_DIR} ${PREFIX}/etc/pig
+    fi
+  fi
+
+  mkdir -p ${LOG_DIR}
+  chown root:hadoop ${LOG_DIR}
+  chmod 777 ${LOG_DIR}
+
+  TFILE="/tmp/$(basename $0).$$.tmp"
+  if [ -z "${JAVA_HOME}" ]; then
+    if [ -e /etc/lsb-release ]; then
+      JAVA_HOME=`update-alternatives --config java | grep java | cut -f2 -d':' | cut -f2
-d' ' | sed -e 's/\/bin\/java//'`
+    else
+      JAVA_HOME=/usr/java/default
+    fi
+  fi
+  template_generator ${PREFIX}/share/pig/templates/conf/pig-env.sh $TFILE
+  cp ${TFILE} ${CONF_DIR}/pig-env.sh
+  rm -f ${TFILE}
+fi



Mime
View raw message