[pig] - Add in bin and env script - Rework layout

Peter MacKinnon pmackinn at fedoraproject.org
Fri Feb 14 21:29:56 UTC 2014


commit 7289c1ef654573b59ca7ce06257cad87434b1879
Author: Peter MacKinnon <pmackinn at redhat.com>
Date:   Fri Feb 14 16:28:11 2014 -0500

    - Add in bin and env script
    - Rework layout

 pig-env.sh |   43 +++++++++++++++++++++++++++++++++++++++++++
 pig.spec   |   42 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 84 insertions(+), 1 deletions(-)
---
diff --git a/pig-env.sh b/pig-env.sh
new file mode 100644
index 0000000..d208572
--- /dev/null
+++ b/pig-env.sh
@@ -0,0 +1,43 @@
+# 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.
+
+JAVA_HOME=/usr/lib/jvm/jre
+
+HADOOP_HOME=/usr
+HADOOP_CONF_DIR=/etc/hadoop
+HBASE_HOME=/usr
+HBASE_CONF_DIR=/etc/hbase
+ZOOKEEPER_HOME=/usr
+PIG_CONF_DIR=/etc/pig
+
+# 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
diff --git a/pig.spec b/pig.spec
index 407976a..92bc895 100644
--- a/pig.spec
+++ b/pig.spec
@@ -7,12 +7,13 @@
 
 Name:          pig
 Version:       0.12.0
-Release:       1%{?dist}
+Release:       2%{?dist}
 Summary:       Apache Pig
 
 License:       ASL 2.0
 URL:           http://pig.apache.org/
 Source0:       http://www.apache.org/dist/%{name}/%{name}-%{version}/%{name}-%{version}-src.tar.gz
+Source1:       pig-env.sh
 # numerous multi-line dependency mods
 Patch0:        pig-ivy-dependency-modifications-and-removal-for-hadoop.patch
 
@@ -39,6 +40,15 @@ BuildRequires: xmvn >= 1.5.0
 BuildArch:     noarch
 ExcludeArch:   %{arm}
 
+Requires: avro-mapred
+Requires: avro-trevni
+Requires: hadoop-tests
+Requires: hbase
+Requires: htrace
+Requires: java
+Requires: jetty8
+Requires: json_simple
+
 %description
 Apache Pig is a platform for analyzing large data sets that 
 consists of a high-level language for expressing data analysis 
@@ -101,26 +111,56 @@ ant -Doffline=true -Divy.mode=local -Divysettings.xml=/etc/ivy/ivysettings.xml \
 
 %install
 
+# create the root from here
+install -d -m 0755 %{buildroot}%{_datadir}/%{name}
+install -d -m 0755 %{buildroot}%{_datadir}/%{name}/bin
+install -d -m 0755 %{buildroot}%{_datadir}/%{name}/lib
+
+# bin
+install -dm 755 %{buildroot}%{_bindir}
+cp -p bin/%{name} %{buildroot}%{_datadir}/%{name}/bin
+ln -s %{_datadir}/%{name}/bin/%{name} %{buildroot}%{_bindir}/%{name}
+
+# conf
 mkdir -p %{buildroot}%{_sysconfdir}/%{name}
 cp -p conf/log4j.properties.template %{buildroot}%{_sysconfdir}/%{name}/log4j.properties
 cp -p conf/pig.properties %{buildroot}%{_sysconfdir}/%{name}
+cp %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}
 
+# jar
 install -d -m 0755 %{buildroot}%{_javadir}/%{name}
 install -d -m 0755 %{buildroot}%{_mavenpomdir}
 install -m 0644 build/%{name}-%{version}-withouthadoop.jar %{buildroot}%{_javadir}/%{name}.jar
+ln -s %{_javadir}/%{name}.jar %{buildroot}%{_datadir}/%{name}/%{name}-withouthadoop.jar
 %add_maven_depmap org.apache.pig:pig:%{version} %{name}.jar
 
+# lib
+cp build/ivy/lib/Pig/*.jar %{buildroot}%{_datadir}/%{name}/lib
+# throw away a few test compilation deps which we likely don't need
+# we're probably still covered by the mondo hadoop classpath
+for j in high-scale-lib hsqldb junit metrics-core netty protobuf-java xalan xercesImpl; do
+    rm %{buildroot}%{_datadir}/%{name}/lib/$j*.jar
+done
+%{_bindir}/xmvn-subst %{buildroot}%{_datadir}/%{name}/lib
+
+# javadocs
 mkdir -p %{buildroot}%{_javadocdir}
 cp -r build/docs %{buildroot}%{_javadocdir}/%{name}
 
 %files -f .mfiles
 %doc LICENSE.txt NOTICE.txt README.txt
 %{_sysconfdir}/%{name}
+%{_bindir}/%{name}
+%{_datadir}/%{name}
 
 %files javadoc
 %doc LICENSE.txt NOTICE.txt
 %{_javadocdir}/%{name}
 
 %changelog
+* Fri Feb 14 2014 Peter MacKinnon <pmackinn at redhat.com> 0.12.0-2
+- Add in bin and env script
+- Rework layout
+
 * Mon Jan 13 2014 Peter MacKinnon <pmackinn at redhat.com> 0.12.0-1
 - Initial rpm


More information about the scm-commits mailing list