Repository: hadoop
Updated Branches:
refs/heads/branch-2 48b8c9947 -> c33603be3
HADOOP-12662. The build should fail if a -Dbundle option fails (Kai Zheng via
cmccabe)
(cherry picked from commit 2a303865391657648281270114bccc32fd4c051a)
Conflicts:
BUILDING.txt
hadoop-common-project/hadoop-common/src/CMakeLists.txt
hadoop-project-dist/pom.xml
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/c33603be
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c33603be
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c33603be
Branch: refs/heads/branch-2
Commit: c33603be3602315dacf6fb20b5652b2b0cf50d24
Parents: 48b8c99
Author: Colin Patrick Mccabe <[email protected]>
Authored: Fri Jan 15 14:05:21 2016 -0800
Committer: Colin Patrick Mccabe <[email protected]>
Committed: Fri Jan 15 14:10:13 2016 -0800
----------------------------------------------------------------------
BUILDING.txt | 6 +-
hadoop-common-project/hadoop-common/CHANGES.txt | 3 +
hadoop-project-dist/pom.xml | 75 ++++++++++++++++----
3 files changed, 69 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c33603be/BUILDING.txt
----------------------------------------------------------------------
diff --git a/BUILDING.txt b/BUILDING.txt
index 3982d7f..6e20a42 100644
--- a/BUILDING.txt
+++ b/BUILDING.txt
@@ -145,7 +145,8 @@ Maven build goals:
installed snappy using a package manager.
* Use -Dbundle.snappy to copy the contents of the snappy.lib directory into
the final tar file. This option requires that -Dsnappy.lib is also given,
- and it ignores the -Dsnappy.prefix option.
+ and it ignores the -Dsnappy.prefix option. If -Dsnappy.lib isn't given, the
+ bundling and building will fail.
OpenSSL build options:
@@ -166,7 +167,8 @@ Maven build goals:
installed openssl using a package manager.
* Use -Dbundle.openssl to copy the contents of the openssl.lib directory into
the final tar file. This option requires that -Dopenssl.lib is also given,
- and it ignores the -Dopenssl.prefix option.
+ and it ignores the -Dopenssl.prefix option. If -Dopenssl.lib isn't given,
the
+ bundling and building will fail.
Tests options:
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c33603be/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt
b/hadoop-common-project/hadoop-common/CHANGES.txt
index bfbba55..3e79878 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -30,6 +30,9 @@ Release 2.9.0 - UNRELEASED
HADOOP-12713. Disable spurious checkstyle checks. (wang)
+ HADOOP-12662. The build should fail if a -Dbundle option fails (Kai Zheng
+ via cmccabe)
+
BUG FIXES
HADOOP-12655. TestHttpServer.testBindAddress bind port range is wider
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c33603be/hadoop-project-dist/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-project-dist/pom.xml b/hadoop-project-dist/pom.xml
index 0ed936a..543d43e 100644
--- a/hadoop-project-dist/pom.xml
+++ b/hadoop-project-dist/pom.xml
@@ -339,44 +339,93 @@
<target>
<!-- Using Unix script to preserve symlinks -->
<echo
file="${project.build.directory}/dist-copynativelibs.sh">
+
+ # Bundle a native library if requested. Exit 1 in case
error happens.
+ # Usage: bundle_native_lib bundleOption libOption
libPattern libDir
+ function bundle_native_lib() {
+ bundleOption="$1"
+ libOption="$2"
+ libPattern="$3"
+ libDir="$4"
+
+ echo "Checking to bundle with:"
+ echo "bundleOption=${bundleOption},
libOption=${libOption}, libDir=${libDir}, pattern=${libPattern}"
+
+ if [[ "${bundleOption}" != "true" ]]; then
+ return
+ fi
+
+ if [[ -z "${libDir}" ]] || [[ ! -d ${libDir} ]]; then
+ echo "The required option $libOption isn't given or
invalid. Bundling the lib failed"
+ exit 1
+ fi
+
+ cd "$libDir"
+ $$TAR *$libPattern* | (cd $${TARGET_DIR}/; $$UNTAR)
+ if [[ $? -ne 0 ]]; then
+ echo "Bundling library with ${libOption} failed "
+ exit 1
+ fi
+ }
+
BUILD_DIR="${project.build.directory}"
TAR='tar cf -'
UNTAR='tar xfBp -'
LIB_DIR="${BUILD_DIR}/native/target/usr/local/lib"
- if [ -d $${LIB_DIR} ] ; then
+
+ set -o pipefail
+
+ if [[ -d $${LIB_DIR} ]]; then
TARGET_DIR="${BUILD_DIR}/${project.artifactId}-${project.version}/lib/native"
mkdir -p $${TARGET_DIR}
cd $${LIB_DIR}
$$TAR lib* | (cd $${TARGET_DIR}/; $$UNTAR)
- if [ "${bundle.snappy}" = "true" ] ; then
- cd "${snappy.lib}"
- $$TAR *snappy* | (cd $${TARGET_DIR}/; $$UNTAR)
- fi
- if [ "${bundle.openssl}" = "true" ] ; then
- cd "${openssl.lib}"
- $$TAR *crypto* | (cd $${TARGET_DIR}/; $$UNTAR)
+ if [[ $? -ne 0 ]]; then
+ echo "Bundling lib files failed"
+ exit 1
fi
+
+ echo bundle_native_lib "${bundle.snappy}" "snappy.lib"
"snappy" "${snappy.lib}"
+ bundle_native_lib "${bundle.snappy}" "snappy.lib"
"snappy" "${snappy.lib}"
+
+ echo bundle_native_lib "${bundle.openssl}"
"openssl.lib" "crypto" "${openssl.lib}"
+ bundle_native_lib "${bundle.openssl}" "openssl.lib"
"crypto" "${openssl.lib}"
fi
+
BIN_DIR="${BUILD_DIR}/bin"
- if [ -d $${BIN_DIR} ] ; then
+ if [[ -d $${BIN_DIR} ]] ; then
TARGET_BIN_DIR="${BUILD_DIR}/${project.artifactId}-${project.version}/bin"
mkdir -p $${TARGET_BIN_DIR}
cd $${BIN_DIR}
$$TAR * | (cd $${TARGET_BIN_DIR}/; $$UNTAR)
- if [ "${bundle.snappy.in.bin}" = "true" ] ; then
- if [ "${bundle.snappy}" = "true" ] ; then
+ if [[ $? -ne 0 ]]; then
+ echo "Bundling bin files failed"
+ exit 1
+ fi
+
+ if [[ "${bundle.snappy.in.bin}" == "true" ]]; then
+ if [[ "${bundle.snappy}" == "true" ]]; then
cd "${snappy.lib}"
$$TAR *snappy* | (cd $${TARGET_BIN_DIR}/; $$UNTAR)
+ if [[ $? -ne 0 ]]; then
+ echo "Bundling snappy bin files failed"
+ exit 1
+ fi
fi
fi
- if [ "${bundle.openssl.in.bin}" = "true" ] ; then
- if [ "${bundle.openssl}" = "true" ] ; then
+ if [[ "${bundle.openssl.in.bin}" == "true" ]]; then
+ if [[ "${bundle.openssl}" == "true" ]]; then
cd "${openssl.lib}"
$$TAR *crypto* | (cd $${TARGET_BIN_DIR}/; $$UNTAR)
+ if [[ $? -ne 0 ]]; then
+ echo "Bundling openssl bin files failed"
+ exit 1
+ fi
fi
fi
fi
</echo>
+
<exec executable="${shell-executable}"
dir="${project.build.directory}" failonerror="true">
<arg line="./dist-copynativelibs.sh"/>
</exec>