This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 4625667 Added DEB packaging for C++ pulsar client lib (#1970)
4625667 is described below
commit 4625667b79ca81d4c1ea2f221eb3fa228a1e96a7
Author: Matteo Merli <[email protected]>
AuthorDate: Fri Jun 15 08:26:01 2018 -0700
Added DEB packaging for C++ pulsar client lib (#1970)
---
pulsar-client-cpp/pkg/deb/.gitignore | 1 +
pulsar-client-cpp/pkg/deb/Dockerfile | 76 +++++++++++++++++
pulsar-client-cpp/pkg/deb/build-deb.sh | 95 ++++++++++++++++++++++
.../build-docker-image.sh} | 9 +-
.../docker-build-deb.sh} | 6 +-
pulsar-client-cpp/pkg/rpm/docker-build-rpm.sh | 2 +-
src/stage-release.sh | 3 +
7 files changed, 180 insertions(+), 12 deletions(-)
diff --git a/pulsar-client-cpp/pkg/deb/.gitignore
b/pulsar-client-cpp/pkg/deb/.gitignore
new file mode 100644
index 0000000..89620f3
--- /dev/null
+++ b/pulsar-client-cpp/pkg/deb/.gitignore
@@ -0,0 +1 @@
+BUILD
diff --git a/pulsar-client-cpp/pkg/deb/Dockerfile
b/pulsar-client-cpp/pkg/deb/Dockerfile
new file mode 100644
index 0000000..8f538ec
--- /dev/null
+++ b/pulsar-client-cpp/pkg/deb/Dockerfile
@@ -0,0 +1,76 @@
+#
+# 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.
+#
+
+# Build pulsar client library in Centos with tools to
+
+FROM debian:9
+
+ RUN apt-get update && \
+ apt-get install -y curl g++ make libcurl4-openssl-dev libssl-dev
python-dev \
+ libxml2-utils git
+
+# Download and compile boost
+RUN curl -O -L
https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz && \
+ tar xvfz boost_1_64_0.tar.gz && \
+ cd /boost_1_64_0 && \
+ ./bootstrap.sh
--with-libraries=program_options,filesystem,regex,thread,system,python && \
+ ./b2 address-model=64 cxxflags=-fPIC link=static threading=multi
variant=release install && \
+ rm -rf /boost_1_64_0.tar.gz /boost_1_64_0
+
+RUN curl -O -L https://github.com/Kitware/CMake/archive/v3.8.2.tar.gz && \
+ tar xvfz v3.8.2.tar.gz && \
+ cd CMake-3.8.2 && \
+ ./configure && \
+ make && make install && \
+ rm -rf /v3.8.2.tar.gz /CMake-3.8.2
+
+# Compile JSON CPP
+RUN curl -O -L
https://github.com/open-source-parsers/jsoncpp/archive/1.8.0.tar.gz && \
+ tar xvfz 1.8.0.tar.gz && \
+ cd jsoncpp-1.8.0 && \
+ cmake . -DCMAKE_POSITION_INDEPENDENT_CODE=ON && \
+ make && make install && \
+ rm -rf /1.8.0.tar.gz /jsoncpp-1.8.0
+
+# Download and copile protoubf
+RUN curl -O -L
https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz
&& \
+ tar xvfz protobuf-cpp-3.3.0.tar.gz && \
+ cd protobuf-3.3.0/ && \
+ CXXFLAGS=-fPIC ./configure && \
+ make && make install && ldconfig && \
+ rm -rf /protobuf-cpp-3.3.0.tar.gz /protobuf-3.3.0
+
+# ZLib
+RUN curl -O -L https://github.com/madler/zlib/archive/v1.2.11.tar.gz && \
+ tar xvfz v1.2.11.tar.gz && \
+ cd zlib-1.2.11 && \
+ CFLAGS="-fPIC -O3" ./configure && \
+ make && make install && \
+ rm -rf /zlib-1.2.11.tar.gz /zlib-1.2.11
+
+# LibCurl
+RUN curl -O -L
https://github.com/curl/curl/releases/download/curl-7_54_0/curl-7.54.0.tar.gz
&& \
+ tar xvfz curl-7.54.0.tar.gz && \
+ cd curl-7.54.0 && \
+ CFLAGS=-fPIC ./configure && \
+ make && make install && \
+ rm -rf /curl-7.54.0.tar.gz /curl-7.54.0
+
+
+RUN apt-get install -y dpkg-dev
diff --git a/pulsar-client-cpp/pkg/deb/build-deb.sh
b/pulsar-client-cpp/pkg/deb/build-deb.sh
new file mode 100755
index 0000000..b0b1781
--- /dev/null
+++ b/pulsar-client-cpp/pkg/deb/build-deb.sh
@@ -0,0 +1,95 @@
+#!/bin/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 -e -x
+
+cd /pulsar
+SRC_ROOT_DIR=$(git rev-parse --show-toplevel)
+cd $SRC_ROOT_DIR/pulsar-client-cpp/pkg/deb
+
+POM_VERSION=`cat ../../../pom.xml | xmllint --format - | sed
"s/xmlns=\".*\"//g" | xmllint --stream --pattern /project/version --debug - |
grep -A 2 "matches pattern" | grep text | sed "s/.* [0-9] //g"`
+# Sanitize VERSION by removing `-incubating` since it's not legal in DEB
+VERSION=`echo $POM_VERSION | awk -F- '{print $1}'`
+
+ROOT_DIR=apache-pulsar-$POM_VERSION
+CPP_DIR=$ROOT_DIR/pulsar-client-cpp
+
+rm -rf BUILD
+mkdir BUILD
+cd BUILD
+tar xfz $SRC_ROOT_DIR/all/target/apache-pulsar-$POM_VERSION-src.tar.gz
+pushd $CPP_DIR
+
+cmake . -DBUILD_TESTS=OFF -DLINK_STATIC=ON
+make pulsarShared pulsarStatic -j 3
+strip lib/libpulsar.*
+popd
+
+DEST_DIR=pulsar-client
+mkdir -p $DEST_DIR/DEBIAN
+cat <<EOF > $DEST_DIR/DEBIAN/control
+Package: pulsar-client
+Version: ${VERSION}
+Maintainer: Apache Pulsar <[email protected]>
+Architecture: amd64
+Description: The Apache Pulsar client contains a C++ and C APIs to interact
with Apache Pulsar brokers.
+EOF
+
+DEVEL_DEST_DIR=pulsar-client-dev
+mkdir -p $DEVEL_DEST_DIR/DEBIAN
+cat <<EOF > $DEVEL_DEST_DIR/DEBIAN/control
+Package: pulsar-client-dev
+Version: ${VERSION}
+Maintainer: Apache Pulsar <[email protected]>
+Architecture: amd64
+Description: The Apache Pulsar client contains a C++ and C APIs to interact
with Apache Pulsar brokers.
+EOF
+
+mkdir -p $DEST_DIR/usr/lib
+mkdir -p $DEVEL_DEST_DIR/usr/lib
+mkdir -p $DEVEL_DEST_DIR/usr/include
+mkdir -p $DEST_DIR/usr/share/doc/pulsar-client-$VERSION
+mkdir -p $DEVEL_DEST_DIR/usr/share/doc/pulsar-client-dev-$VERSION
+
+cp -ar $CPP_DIR/include/pulsar $DEVEL_DEST_DIR/usr/include/
+cp $CPP_DIR/lib/libpulsar.a $DEVEL_DEST_DIR/usr/lib
+cp $CPP_DIR/lib/libpulsar.so.$POM_VERSION $DEST_DIR/usr/lib
+pushd $DEST_DIR/usr/lib
+ln -s libpulsar.so.$POM_VERSION libpulsar.so
+popd
+
+cp $ROOT_DIR/DISCLAIMER $DEST_DIR/usr/share/doc/pulsar-client-$VERSION
+cp $ROOT_DIR/NOTICE $DEST_DIR/usr/share/doc/pulsar-client-$VERSION
+cp $CPP_DIR/pkg/licenses/* $DEST_DIR/usr/share/doc/pulsar-client-$VERSION
+cp $CPP_DIR/pkg/licenses/LICENSE.txt
$DEST_DIR/usr/share/doc/pulsar-client-$VERSION/copyright
+cp $CPP_DIR/pkg/licenses/LICENSE.txt $DEST_DIR/DEBIAN/copyright
+cp $CPP_DIR/pkg/licenses/LICENSE.txt $DEVEL_DEST_DIR/DEBIAN/copyright
+
+cp $DEST_DIR/usr/share/doc/pulsar-client-$VERSION/*
$DEVEL_DEST_DIR/usr/share/doc/pulsar-client-dev-$VERSION
+
+
+## Build actual debian packages
+dpkg-deb --build pulsar-client
+dpkg-deb --build pulsar-client-dev
+
+mkdir DEB
+mv *.deb DEB
+cd DEB
+dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
diff --git a/pulsar-client-cpp/pkg/rpm/docker-build-rpm.sh
b/pulsar-client-cpp/pkg/deb/build-docker-image.sh
similarity index 80%
copy from pulsar-client-cpp/pkg/rpm/docker-build-rpm.sh
copy to pulsar-client-cpp/pkg/deb/build-docker-image.sh
index 11b4592..910aaaa 100755
--- a/pulsar-client-cpp/pkg/rpm/docker-build-rpm.sh
+++ b/pulsar-client-cpp/pkg/deb/build-docker-image.sh
@@ -18,11 +18,4 @@
# under the License.
#
-set -e
-
-ROOT_DIR=$(git rev-parse --show-toplevel)
-
-docker pull apachepulsar/pulsar-build:centos-7
-
-docker run -it -v $ROOT_DIR:/pulsar apachepulsar/pulsar-build:centos-7 \
- /build-rpm.sh
+docker build -t apachepulsar/pulsar-build:debian-9 .
diff --git a/pulsar-client-cpp/pkg/rpm/docker-build-rpm.sh
b/pulsar-client-cpp/pkg/deb/docker-build-deb.sh
similarity index 82%
copy from pulsar-client-cpp/pkg/rpm/docker-build-rpm.sh
copy to pulsar-client-cpp/pkg/deb/docker-build-deb.sh
index 11b4592..35d229e 100755
--- a/pulsar-client-cpp/pkg/rpm/docker-build-rpm.sh
+++ b/pulsar-client-cpp/pkg/deb/docker-build-deb.sh
@@ -22,7 +22,7 @@ set -e
ROOT_DIR=$(git rev-parse --show-toplevel)
-docker pull apachepulsar/pulsar-build:centos-7
+docker pull apachepulsar/pulsar-build:debian-9
-docker run -it -v $ROOT_DIR:/pulsar apachepulsar/pulsar-build:centos-7 \
- /build-rpm.sh
+docker run -it -v $ROOT_DIR:/pulsar apachepulsar/pulsar-build:debian-9 \
+ /pulsar/pulsar-client-cpp/pkg/deb/build-deb.sh
diff --git a/pulsar-client-cpp/pkg/rpm/docker-build-rpm.sh
b/pulsar-client-cpp/pkg/rpm/docker-build-rpm.sh
index 11b4592..0e386cb 100755
--- a/pulsar-client-cpp/pkg/rpm/docker-build-rpm.sh
+++ b/pulsar-client-cpp/pkg/rpm/docker-build-rpm.sh
@@ -25,4 +25,4 @@ ROOT_DIR=$(git rev-parse --show-toplevel)
docker pull apachepulsar/pulsar-build:centos-7
docker run -it -v $ROOT_DIR:/pulsar apachepulsar/pulsar-build:centos-7 \
- /build-rpm.sh
+ /pulsar/pulsar-client-cpp/pkg/rpm/build-rpm.sh
diff --git a/src/stage-release.sh b/src/stage-release.sh
index 4c29df5..c4091e8 100755
--- a/src/stage-release.sh
+++ b/src/stage-release.sh
@@ -38,6 +38,9 @@ cp $PULSAR_PATH/all/target/apache-pulsar-$VERSION-bin.tar.gz
$DEST_PATH
mkdir $DEST_PATH/RPMS
cp -r $PULSAR_PATH/pulsar-client-cpp/pkg/rpm/RPMS/x86_64/* $DEST_PATH/RPMS
+mkdir $DEST_PATH/DEB
+cp -r $PULSAR_PATH/pulsar-client-cpp/pkg/deb/BUILD/DEB/* $DEST_PATH/DEB
+
# Sign all files
cd $DEST_PATH
find . -type f | xargs $PULSAR_PATH/src/sign-release.sh
--
To stop receiving notification emails like this one, please contact
[email protected].