Author: mattf
Date: Tue Feb 14 06:18:37 2012
New Revision: 1243785
URL: http://svn.apache.org/viewvc?rev=1243785&view=rev
Log:
HADOOP-8037. Binary tarball does not preserve platform info for native builds,
and RPMs fail to provide needed symlinks for libhadoop.so. Contributed by Matt
Foley.
Added:
hadoop/common/branches/branch-1.0/src/native/packageBinNativeHadoop.sh
Modified:
hadoop/common/branches/branch-1.0/CHANGES.txt
hadoop/common/branches/branch-1.0/build.xml
hadoop/common/branches/branch-1.0/src/native/packageNativeHadoop.sh
hadoop/common/branches/branch-1.0/src/packages/rpm/spec/hadoop.spec
Modified: hadoop/common/branches/branch-1.0/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.0/CHANGES.txt?rev=1243785&r1=1243784&r2=1243785&view=diff
==============================================================================
--- hadoop/common/branches/branch-1.0/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1.0/CHANGES.txt Tue Feb 14 06:18:37 2012
@@ -46,6 +46,10 @@ Release 1.0.1 - 2012.02.12
MAPREDUCE-3343. TaskTracker Out of Memory because of distributed cache.
(Zhao Yunjiong).
+ HADOOP-8037. Binary tarball does not preserve platform info for native
builds,
+ and RPMs fail to provide needed symlinks for libhadoop.so. (Matt Foley)
+
+
Release 1.0.0 - 2011.12.15
NEW FEATURES
Modified: hadoop/common/branches/branch-1.0/build.xml
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.0/build.xml?rev=1243785&r1=1243784&r2=1243785&view=diff
==============================================================================
--- hadoop/common/branches/branch-1.0/build.xml (original)
+++ hadoop/common/branches/branch-1.0/build.xml Tue Feb 14 06:18:37 2012
@@ -1462,16 +1462,16 @@
<!-- -->
<!-- ================================================================== -->
<target name="package" depends="compile, jar, javadoc, docs, cn-docs,
api-report, examples, tools-jar, jar-test, ant-tasks, package-librecordio"
- description="Build distribution">
+ description="assembles multi-platform artifacts for distribution">
<delete dir="${dist.dir}"/>
<mkdir dir="${dist.dir}"/>
- <mkdir dir="${dist.dir}/lib"/>
- <mkdir dir="${dist.dir}/libexec"/>
- <mkdir dir="${dist.dir}/contrib"/>
<mkdir dir="${dist.dir}/bin"/>
+ <mkdir dir="${dist.dir}/contrib"/>
<mkdir dir="${dist.dir}/docs"/>
<mkdir dir="${dist.dir}/docs/api"/>
<mkdir dir="${dist.dir}/docs/jdiff"/>
+ <mkdir dir="${dist.dir}/lib"/>
+ <mkdir dir="${dist.dir}/libexec"/>
<mkdir dir="${dist.dir}/sbin"/>
<mkdir dir="${dist.dir}/share/${name}/templates/conf"/>
@@ -1585,7 +1585,8 @@
<!-- ================================================================== -->
<!-- Make release tarball -->
<!-- ================================================================== -->
- <target name="tar" depends="package" description="Make release tarball">
+ <target name="tar" depends="package" description="Make multi-platform
release tarballs, both source and binary">
+ <!-- build source tarball -->
<macro_tar param.destfile="${build.dir}/${final.name}.tar.gz">
<param.listofitems>
<tarfileset dir="${build.dir}" mode="664">
@@ -1607,15 +1608,38 @@
</tarfileset>
</param.listofitems>
</macro_tar>
+ <!-- build multi-platform binary tarball -->
+ <macro_tar param.destfile="${build.dir}/${final.name}-bin.tar.gz">
+ <param.listofitems>
+ <tarfileset dir="${build.dir}" mode="664">
+ <exclude name="${final.name}/src/**" />
+ <exclude name="${final.name}/docs/**" />
+ <exclude name="${final.name}/bin/*" />
+ <exclude name="${final.name}/sbin/*" />
+ <exclude name="${final.name}/libexec/*" />
+ <exclude name="${final.name}/contrib/*/bin/*" />
+ <include name="${final.name}/**" />
+ </tarfileset>
+ <tarfileset dir="${build.dir}" mode="755">
+ <include name="${final.name}/bin/*" />
+ <include name="${final.name}/sbin/*" />
+ <include name="${final.name}/libexec/*" />
+ <include name="${final.name}/contrib/*/bin/*" />
+ <include name="${final.name}/src/contrib/ec2/bin/*" />
+ <include name="${final.name}/src/contrib/ec2/bin/image/*" />
+ </tarfileset>
+ </param.listofitems>
+ </macro_tar>
</target>
<target name="bin-package" depends="compile, jar, examples, tools-jar,
jar-test, ant-tasks, package-librecordio"
- description="assembles artifacts for binary target">
+ description="assembles platform-specific artifacts for binary
targets">
<delete dir="${dist.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/etc/hadoop"/>
<mkdir dir="${dist.dir}/lib"/>
+ <mkdir dir="${dist.dir}/lib64"/>
<mkdir dir="${dist.dir}/libexec"/>
<mkdir dir="${dist.dir}/sbin"/>
<mkdir dir="${dist.dir}/share/${name}/contrib"/>
@@ -1638,20 +1662,20 @@
</fileset>
</copy>
+ <condition property="lib.data.model" value="lib64" else="lib" >
+ <and>
+ <equals arg1="${sun.arch.data.model}" arg2="64" />
+ </and>
+ </condition>
+
<exec dir="${dist.dir}" executable="sh" failonerror="true">
<env key="BASE_NATIVE_LIB_DIR" value="${lib.dir}/native"/>
<env key="BUILD_NATIVE_DIR" value="${build.dir}/native"/>
- <env key="DIST_LIB_DIR" value="${dist.dir}/native"/>
- <arg line="${native.src.dir}/packageNativeHadoop.sh"/>
+ <env key="DIST_LIB_DIR" value="${dist.dir}/${lib.data.model}"/>
+ <env key="NATIVE_PLATFORM" value="${build.platform}" />
+ <arg line="${native.src.dir}/packageBinNativeHadoop.sh"/>
</exec>
- <move todir="${dist.dir}/lib" flatten="true">
- <fileset dir="${dist.dir}/native">
- <include name="*/*"/>
- </fileset>
- </move>
- <delete dir="${dist.dir}/native"/>
-
<subant target="package">
<!--Pass down the version in case its needed again and the target
distribution directory so contribs know where to install to.-->
@@ -1706,9 +1730,9 @@
</fileset>
</copy>
- <copy todir="${dist.dir}/lib" includeEmptyDirs="false" flatten="true">
+ <copy todir="${dist.dir}/${lib.data.model}" includeEmptyDirs="false"
flatten="true">
<fileset dir="${build.dir}/c++">
- <include name="**/lib/*"/>
+ <include name="${build.platform}/lib/*"/>
</fileset>
</copy>
@@ -1728,7 +1752,7 @@
</target>
<target name="binary-system" depends="bin-package, jar-system,
jar-test-system"
- description="make system test package for deployment">
+ description="make platform-specific system test package for deployment">
<copy todir="${system-test-build-dir}/${final.name}">
<fileset dir="${dist.dir}">
</fileset>
@@ -1738,7 +1762,7 @@
<copy todir="${system-test-build-dir}/${final.name}"
file="${system-test-build-dir}/${test.final.name}.jar" overwrite="true"/>
<macro_tar
- param.destfile="${system-test-build-dir}/${final.name}-bin.tar.gz">
+
param.destfile="${system-test-build-dir}/${final.name}-${os.arch}-bin.tar.gz">
<param.listofitems>
<tarfileset dir="${system-test-build-dir}" mode="664">
<exclude name="${final.name}/bin/*" />
@@ -1753,8 +1777,8 @@
</macro_tar>
</target>
- <target name="binary" depends="bin-package" description="Make tarball
without source and documentation">
- <macro_tar param.destfile="${build.dir}/${final.name}-bin.tar.gz">
+ <target name="binary" depends="bin-package" description="Make
platform-specific binary tarball without source and documentation">
+ <macro_tar
param.destfile="${build.dir}/${final.name}-${os.arch}-bin.tar.gz">
<param.listofitems>
<tarfileset dir="${build.dir}" mode="664">
<exclude name="${final.name}/bin/*" />
@@ -1784,13 +1808,14 @@
</macro_tar>
<copy todir="${package.buildroot}/SOURCES">
<fileset dir="${build.dir}">
- <include name="${final.name}-bin.tar.gz" />
+ <include name="${final.name}-${os.arch}-bin.tar.gz" />
</fileset>
</copy>
<copy file="${src.dir}/packages/rpm/spec/hadoop.spec"
todir="${package.buildroot}/SPECS">
<filterchain>
<replacetokens>
<token key="final.name" value="${final.name}" />
+ <token key="build.arch" value="${os.arch}" />
<token key="version" value="${hadoop.version}" />
<token key="package.release" value="${package.release}" />
<token key="package.build.dir" value="${package.build.dir}" />
@@ -1813,7 +1838,7 @@
<delete dir="${package.buildroot}" quiet="true" verbose="false"/>
</target>
- <target name="deb" depends="ant-tasks, binary" description="Make deb
package">
+ <target name="deb" depends="ant-tasks, bin-package" description="Make deb
package">
<taskdef name="deb"
classname="org.vafer.jdeb.ant.DebAntTask">
<classpath refid="classpath" />
Added: hadoop/common/branches/branch-1.0/src/native/packageBinNativeHadoop.sh
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.0/src/native/packageBinNativeHadoop.sh?rev=1243785&view=auto
==============================================================================
--- hadoop/common/branches/branch-1.0/src/native/packageBinNativeHadoop.sh
(added)
+++ hadoop/common/branches/branch-1.0/src/native/packageBinNativeHadoop.sh Tue
Feb 14 06:18:37 2012
@@ -0,0 +1,61 @@
+#!/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.
+
+
+# packageBinNativeHadoop.sh - A simple script to help package a single set of
+# native-hadoop libraries for bin-packaging
+
+#
+# Note:
+# This script relies on the following environment variables to function
correctly:
+# * BASE_NATIVE_LIB_DIR
+# * BUILD_NATIVE_DIR
+# * DIST_LIB_DIR
+# * NATIVE_PLATFORM
+# All these are setup by build.xml.
+#
+
+TAR='tar cf -'
+UNTAR='tar xfBp -'
+platform=$NATIVE_PLATFORM
+
+# Copy the pre-built libraries in $BASE_NATIVE_LIB_DIR
+if [ -d $BASE_NATIVE_LIB_DIR ]
+then
+ echo "Copying libraries in $BASE_NATIVE_LIB_DIR/$platform to $DIST_LIB_DIR/"
+ if [ ! -d $BASE_NATIVE_LIB_DIR/$platform ]
+ then
+ echo "ERROR: Platform $platform does not exist in $BASE_NATIVE_LIB_DIR"
+ exit -1
+ fi
+ cd $BASE_NATIVE_LIB_DIR/$platform/
+ $TAR *hadoop* | (cd $DIST_LIB_DIR/; $UNTAR)
+fi
+
+# Copy the custom-built libraries in $BUILD_NATIVE_DIR
+if [ -d $BUILD_NATIVE_DIR ]
+then
+ echo "Copying libraries in $BUILD_NATIVE_DIR/$platform/lib to $DIST_LIB_DIR/"
+ if [ ! -d $BUILD_NATIVE_DIR/$platform ]
+ then
+ echo "ERROR: Platform $platform does not exist in $BUILD_NATIVE_DIR"
+ exit -1
+ fi
+ cd $BUILD_NATIVE_DIR/$platform/lib
+ $TAR *hadoop* | (cd $DIST_LIB_DIR/; $UNTAR)
+fi
+
Modified: hadoop/common/branches/branch-1.0/src/native/packageNativeHadoop.sh
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.0/src/native/packageNativeHadoop.sh?rev=1243785&r1=1243784&r2=1243785&view=diff
==============================================================================
--- hadoop/common/branches/branch-1.0/src/native/packageNativeHadoop.sh
(original)
+++ hadoop/common/branches/branch-1.0/src/native/packageNativeHadoop.sh Tue Feb
14 06:18:37 2012
@@ -46,7 +46,7 @@ then
done
fi
-# Copy the custom-built libraries in $BUILD_DIR
+# Copy the custom-built libraries in $BUILD_NATIVE_DIR
if [ -d $BUILD_NATIVE_DIR ]
then
for platform in `ls $BUILD_NATIVE_DIR`
Modified: hadoop/common/branches/branch-1.0/src/packages/rpm/spec/hadoop.spec
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.0/src/packages/rpm/spec/hadoop.spec?rev=1243785&r1=1243784&r2=1243785&view=diff
==============================================================================
--- hadoop/common/branches/branch-1.0/src/packages/rpm/spec/hadoop.spec
(original)
+++ hadoop/common/branches/branch-1.0/src/packages/rpm/spec/hadoop.spec Tue Feb
14 06:18:37 2012
@@ -39,6 +39,7 @@
# Build time settings
%define _build_dir @package.build.dir@
%define _final_name @final.name@
+%define _build_arch @build.arch@
%define debug_package %{nil}
# Disable brp-java-repack-jars for aspect J
@@ -71,7 +72,7 @@ Group: Development/Libraries
Name: %{name}
Version: %{version}
Release: %{release}
-Source0: %{_final_name}-bin.tar.gz
+Source0: %{_final_name}-%{_build_arch}-bin.tar.gz
Source1: %{_final_name}-script.tar.gz
Prefix: %{_prefix}
Prefix: %{_conf_dir}