Skip to content

Commit

Permalink
HADOOP-12892. fix/rewrite create-release (aw)
Browse files Browse the repository at this point in the history
  • Loading branch information
aw-was-here committed Apr 27, 2016
1 parent 919a1d8 commit 7b1c37a
Show file tree
Hide file tree
Showing 10 changed files with 867 additions and 261 deletions.
623 changes: 623 additions & 0 deletions dev-support/bin/create-release

Large diffs are not rendered by default.

164 changes: 164 additions & 0 deletions dev-support/bin/dist-copynativelibs
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
#!/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.

set -o pipefail

# Bundle a native library if requested. Exit 1 in case error happens.
# Usage: bundle_native_lib bundleoption liboption libpattern libdir
function bundle_native_lib()
{
declare bundleoption="$1"
declare liboption="$2"
declare libpattern="$3"
declare libdir="$4"


echo "Checking to bundle with:"
echo "bundleoption=${bundleoption}, liboption=${liboption}, pattern=${libpattern} libdir=${libdir}"

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}" || exit 1
${TAR} ./*"${libpattern}"* | (cd "${TARGET_DIR}"/ || exit 1; ${UNTAR})
if [[ $? -ne 0 ]]; then
echo "Bundling library with ${liboption} failed "
exit 1
fi
}

function bundle_native_bin
{
declare bundleoption="$1"
declare libbundle="$2"
declare binoption="$3"
declare binpattern="$4"
declare libdir="$5"

echo "Checking to bundle with:"
echo "bundleoption=${bundleoption}, libbundle=${libbundle}, binoption=${binoption}, libdir=${libdir}, binpattern=${binpattern}"


if [[ "${bundleoption}" != "true" ]]; then
return
fi

if [[ "${libbundle}" != "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}" || exit 1
${TAR} ./*"${libpattern}"* | (cd "${TARGET_BIN_DIR}"/ || exit 1 ; ${UNTAR})
if [[ $? -ne 0 ]]; then
echo "Bundling bin files for ${binoption} failed"
exit 1
fi
}

for i in "$@"; do
case "${i}" in
--version=*)
VERSION=${i#*=}
;;
--artifactid=*)
ARTIFACTID=${i#*=}
;;
--builddir=*)
BUILD_DIR=${i#*=}
;;
--isallib=*)
ISALLIB=${i#*=}
;;
--isalbundle=*)
ISALBUNDLE=${i#*=}
;;
--opensslbinbundle=*)
OPENSSLBINBUNDLE=${i#*=}
;;
--openssllib=*)
OPENSSLLIB=${i#*=}
;;
--openssllibbundle=*)
OPENSSLLIBBUNDLE=${i#*=}
;;
--snappybinbundle=*)
SNAPPYBINBUNDLE=${i#*=}
;;
--snappylib=*)
SNAPPYLIB=${i#*=}
;;
--snappylibbundle=*)
SNAPPYLIBBUNDLE=${i#*=}
;;

esac
done

TAR='tar cf -'
UNTAR='tar xfBp -'
LIB_DIR="${BUILD_DIR}/native/target/usr/local/lib"
BIN_DIR="${BUILD_DIR}/bin"
TARGET_DIR="${BUILD_DIR}/${ARTIFACTID}-${VERSION}/lib/native"
TARGET_BIN_DIR="${BUILD_DIR}/${ARTIFACTID}-${VERSION}/bin"


# Most systems

if [[ -d "${LIB_DIR}" ]]; then
mkdir -p "${TARGET_DIR}"
cd "${LIB_DIR}" || exit 1
${TAR} lib* | (cd "${TARGET_DIR}"/ || exit 1; ${UNTAR})
if [[ $? -ne 0 ]]; then
echo "Bundling lib files failed"
exit 1
fi

bundle_native_lib "${SNAPPYLIBBUNDLE}" "snappy.lib" "snappy" "${SNAPPYLIB}"

bundle_native_lib "${OPENSSLLIBBUNDLE}" "openssl.lib" "crypto" "${OPENSSLLIB}"

bundle_native_lib "${ISALBUNDLE}" "isal.lib" "isa" "${ISALLIB}"
fi

# Windows

# Windows doesn't have a LIB_DIR, everything goes into bin

if [[ -d "${BIN_DIR}" ]] ; then
mkdir -p "${TARGET_BIN_DIR}"
cd "${BIN_DIR}" || exit 1
${TAR} ./* | (cd "${TARGET_BIN_DIR}"/ || exit 1; ${UNTAR})
if [[ $? -ne 0 ]]; then
echo "Bundling bin files failed"
exit 1
fi

bundle_native_bin "${SNAPPYBINBUNDLE}" "${SNAPPYLIBBUNDLE}" "snappy.lib" "snappy" "${SNAPPYLIB}"

bundle_native_bin "${OPENSSLBINBUNDLE}" "${OPENSSLLIBBUNDLE}" "openssl.lib" "crypto" "${OPENSSLLIB}"

fi
2 changes: 2 additions & 0 deletions dev-support/bin/dist-layout-stitching
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ run copy "${ROOT}/hadoop-common-project/hadoop-common/target/hadoop-common-${VER
run copy "${ROOT}/hadoop-common-project/hadoop-nfs/target/hadoop-nfs-${VERSION}" .
run copy "${ROOT}/hadoop-hdfs-project/hadoop-hdfs/target/hadoop-hdfs-${VERSION}" .
run copy "${ROOT}/hadoop-hdfs-project/hadoop-hdfs-nfs/target/hadoop-hdfs-nfs-${VERSION}" .
run copy "${ROOT}/hadoop-hdfs-project/hadoop-hdfs-client/target/hadoop-hdfs-client-${VERSION}" .
run copy "${ROOT}/hadoop-hdfs-project/hadoop-hdfs-native-client/target/hadoop-hdfs-native-client-${VERSION}" .
run copy "${ROOT}/hadoop-yarn-project/target/hadoop-yarn-project-${VERSION}" .
run copy "${ROOT}/hadoop-mapreduce-project/target/hadoop-mapreduce-${VERSION}" .
run copy "${ROOT}/hadoop-tools/hadoop-tools-dist/target/hadoop-tools-dist-${VERSION}" .
Expand Down
144 changes: 0 additions & 144 deletions dev-support/create-release.sh

This file was deleted.

43 changes: 31 additions & 12 deletions dev-support/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,38 @@ WORKDIR /root
# Install common dependencies from packages
######
RUN apt-get update && apt-get install --no-install-recommends -y \
git curl ant make maven \
cmake gcc g++ \
protobuf-compiler libprotoc-dev \
protobuf-c-compiler libprotobuf-dev \
build-essential libtool \
zlib1g-dev pkg-config libssl-dev \
snappy libsnappy-dev \
bzip2 libbz2-dev \
libjansson-dev \
fuse libfuse-dev \
ant \
build-essential \
bzip2 \
cmake \
curl \
doxygen \
fuse \
g++ \
gcc \
git \
gnupg-agent \
make \
maven \
libbz2-dev \
libcurl4-openssl-dev \
python python2.7 pylint \
openjdk-7-jdk doxygen
libfuse-dev \
libjansson-dev \
libprotobuf-dev \
libprotoc-dev \
libsnappy-dev \
libssl-dev \
libtool \
openjdk-7-jdk \
pinentry-curses \
pkg-config \
protobuf-compiler \
protobuf-c-compiler \
python \
python2.7 \
pylint \
snappy \
zlib1g-dev

# Fixing the Apache commons / Maven dependency problem under Ubuntu:
# See http://wiki.apache.org/commons/VfsProblems
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
<outputDirectory>/share/doc/hadoop/${hadoop.component}</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/native/libhdfs</directory>
<directory>${basedir}/src/main/native/libhdfs/include/hdfs</directory>
<includes>
<include>hdfs.h</include>
</includes>
Expand Down
4 changes: 4 additions & 0 deletions hadoop-hdfs-project/hadoop-hdfs-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
<name>Apache Hadoop HDFS Client</name>
<packaging>jar</packaging>

<properties>
<hadoop.component>hdfs</hadoop.component>
</properties>

<dependencies>
<dependency>
<groupId>com.squareup.okhttp</groupId>
Expand Down
Loading

0 comments on commit 7b1c37a

Please sign in to comment.