Skip to content

Commit 7cdb099

Browse files
committed
Upgrade Pulsar C++ client to 3.1.0-candidate-3
1 parent 9182dd7 commit 7cdb099

9 files changed

Lines changed: 100 additions & 30 deletions

File tree

.github/workflows/ci-build-release-wheels.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,11 @@ jobs:
167167
- name: Download Pulsar C++ client on Windows
168168
shell: bash
169169
run: |
170+
source ./build-support/dep-url.sh
171+
BASE_URL=$(pulsar_cpp_base_url $(grep pulsar-cpp dependencies.yaml | awk '{print $2}'))
170172
mkdir -p ${{ env.PULSAR_CPP_DIR }}
171173
cd ${{ env.PULSAR_CPP_DIR }}
172-
# TODO: switch to official releases
173-
curl -O -L https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static.tar.gz
174+
curl -O -L ${BASE_URL}/x64-windows-static.tar.gz
174175
tar zxf x64-windows-static.tar.gz
175176
mv x64-windows-static/* .
176177
ls -l ${{ env.PULSAR_CPP_DIR }}

.github/workflows/ci-pr-validation.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,11 @@ jobs:
199199
- name: Download Pulsar C++ client on Windows
200200
shell: bash
201201
run: |
202+
source ./build-support/dep-url.sh
203+
BASE_URL=$(pulsar_cpp_base_url $(grep pulsar-cpp dependencies.yaml | awk '{print $2}'))
202204
mkdir -p ${{ env.PULSAR_CPP_DIR }}
203205
cd ${{ env.PULSAR_CPP_DIR }}
204-
# TODO: switch to official releases
205-
curl -O -L https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static.tar.gz
206+
curl -O -L ${BASE_URL}/x64-windows-static.tar.gz
206207
tar zxf x64-windows-static.tar.gz
207208
mv x64-windows-static/* .
208209
ls -l ${{ env.PULSAR_CPP_DIR }}

build-support/copy-deps-versionfile.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ for dir in manylinux2014 manylinux_musl; do
2626
mkdir -p pkg/$dir/.build
2727
cp $ROOT_DIR/dependencies.yaml pkg/$dir/.build
2828
cp $ROOT_DIR/build-support/dep-version.py pkg/$dir/.build
29+
cp $ROOT_DIR/build-support/dep-url.sh pkg/$dir/.build
2930
done

build-support/dep-url.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
21+
pulsar_cpp_base_url() {
22+
if [[ $# -ne 1 ]]; then
23+
echo "Usage: pulsar_cpp_base_url <version>"
24+
exit 1
25+
fi
26+
VERSION=$1
27+
# TODO: use official release url from https://archive.apache.org/
28+
echo "https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-${VERSION}-candidate-3"
29+
}
30+
31+
download_dependency() {
32+
if [[ $# -ne 2 ]]; then
33+
echo "Usage: download_dependency <dependency-name> <dependency-version>"
34+
exit 1
35+
fi
36+
37+
DEP_FILE=$1
38+
DEP=$2
39+
read -r DEP VERSION <<<$(grep $DEP $DEP_FILE | sed 's/://')
40+
41+
if [[ $DEP == "cmake" ]]; then
42+
curl -O -L https://github.com/Kitware/CMake/releases/download/v${VERSION}/cmake-${VERSION}-linux-${ARCH}.tar.gz
43+
elif [[ $DEP == "pulsar-cpp" ]]; then
44+
echo $(pulsar_cpp_base_url $VERSION)/apache-pulsar-client-cpp-${VERSION}.tar.gz
45+
elif [[ $DEP == "pybind11" ]]; then
46+
curl -O -L https://github.com/pybind/pybind11/archive/refs/tags/v${VERSION}.tar.gz
47+
elif [[ $DEP == "boost" ]]; then
48+
VERSION_UNDERSCORE=$(echo $VERSION | sed 's/\./_/g')
49+
curl -O -L https://boostorg.jfrog.io/artifactory/main/release/${VERSION}/source/boost_${VERSION_UNDERSCORE}.tar.gz
50+
elif [[ $DEP == "protobuf" ]]; then
51+
curl -O -L https://github.com/google/protobuf/releases/download/v${VERSION}/protobuf-cpp-${VERSION}.tar.gz
52+
elif [[ $DEP == "zlib" ]]; then
53+
curl -O -L https://github.com/madler/zlib/archive/v${VERSION}.tar.gz
54+
elif [[ $DEP == "zstd" ]]; then
55+
curl -O -L https://github.com/facebook/zstd/releases/download/v${VERSION}/zstd-${VERSION}.tar.gz
56+
elif [[ $DEP == "snappy" ]]; then
57+
curl -O -L https://github.com/google/snappy/archive/refs/tags/${VERSION}.tar.gz
58+
elif [[ $DEP == "openssl" ]]; then
59+
curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${VERSION}.tar.gz
60+
elif [[ $DEP == "curl" ]]; then
61+
VERSION_UNDERSCORE=$(echo $VERSION | sed 's/\./_/g')
62+
curl -O -L https://github.com/curl/curl/releases/download/curl-${VERSION_UNDERSCORE}/curl-${VERSION}.tar.gz
63+
else
64+
echo "Unknown dependency $DEP for version $VERSION"
65+
exit 1
66+
fi
67+
}

build-support/install-dependencies.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ cd `dirname $0`
2424

2525
CPP_CLIENT_VERSION=$(./dep-version.py pulsar-cpp ../dependencies.yaml)
2626
PYBIND11_VERSION=$(./dep-version.py pybind11 ../dependencies.yaml)
27+
source ./dep-url.sh
2728

2829
if [ $USER != "root" ]; then
2930
SUDO="sudo"
@@ -35,7 +36,7 @@ export $(cat /etc/*-release | grep "^ID=")
3536
cd /tmp
3637

3738
# Fetch the client binaries
38-
BASE_URL=https://dist.apache.org/repos/dist/release/pulsar/pulsar-client-cpp-${CPP_CLIENT_VERSION}
39+
BASE_URL=$(pulsar_cpp_base_url ${CPP_CLIENT_VERSION})
3940

4041
UNAME_ARCH=$(uname -m)
4142
if [ $UNAME_ARCH == 'aarch64' ]; then

dependencies.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#
1919

2020
cmake: 3.24.2
21-
pulsar-cpp: 3.0.0
21+
pulsar-cpp: 3.1.0
2222
pybind11: 2.10.1
2323
boost: 1.80.0
2424
protobuf: 3.20.0

pkg/mac/build-pulsar-cpp.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ PREFIX=$CACHE_DIR_CPP_CLIENT/install
3636
DEPS_PREFIX=${CACHE_DIR_DEPS}/install
3737

3838
###############################################################################
39-
40-
curl -O -L https://dist.apache.org/repos/dist/release/pulsar/pulsar-client-cpp-${PULSAR_CPP_VERSION}/apache-pulsar-client-cpp-${PULSAR_CPP_VERSION}.tar.gz
39+
source ./build-support/dep-url.sh
40+
download_dependency ./dependencies.yaml ${PULSAR_CPP_VERSION}
4141
tar xfz apache-pulsar-client-cpp-${PULSAR_CPP_VERSION}.tar.gz
4242

4343
if [ ! -f apache-pulsar-client-cpp-${PULSAR_CPP_VERSION}/.done ]; then

pkg/manylinux2014/Dockerfile

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,26 @@ RUN pip3 install pyyaml
3636

3737
ADD .build/dependencies.yaml /
3838
ADD .build/dep-version.py /usr/local/bin
39+
ADD .build/dep-url.sh /usr/local/bin
40+
RUN . /usr/local/bin/dep-url.sh
3941

4042
# Download and install boost
4143
RUN BOOST_VERSION=$(dep-version.py boost) && \
4244
BOOST_VERSION_UNDESRSCORE=$(echo $BOOST_VERSION | sed 's/\./_/g') && \
43-
curl -O -L https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_UNDESRSCORE}.tar.gz && \
45+
download_dependency /dependencies.yaml boost && \
4446
tar xfz boost_${BOOST_VERSION_UNDESRSCORE}.tar.gz && \
4547
cp -r boost_${BOOST_VERSION_UNDESRSCORE}/boost /usr/include/ && \
4648
rm -rf /boost_${BOOST_VERSION_UNDESRSCORE}.tar.gz /boost_${BOOST_VERSION_UNDESRSCORE}
4749

4850
RUN CMAKE_VERSION=$(dep-version.py cmake) && \
49-
curl -O -L https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-${ARCH}.tar.gz && \
50-
tar xfz cmake-${CMAKE_VERSION}-linux-${ARCH}.tar.gz && \
51+
download_dependency /dependencies.yaml cmake && \
5152
cp cmake-${CMAKE_VERSION}-linux-${ARCH}/bin/* /usr/bin/ && \
5253
cp -r cmake-${CMAKE_VERSION}-linux-${ARCH}/share/cmake-* /usr/share/ && \
5354
rm -rf cmake-${CMAKE_VERSION}-linux-${ARCH} cmake-${CMAKE_VERSION}-linux-${ARCH}.tar.gz
5455

5556
# Download and compile protobuf
5657
RUN PROTOBUF_VERSION=$(dep-version.py protobuf) && \
57-
curl -O -L https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-cpp-${PROTOBUF_VERSION}.tar.gz && \
58+
download_dependency /dependencies.yaml protobuf && \
5859
tar xfz protobuf-cpp-${PROTOBUF_VERSION}.tar.gz && \
5960
cd protobuf-${PROTOBUF_VERSION}/ && \
6061
CXXFLAGS=-fPIC ./configure && \
@@ -63,7 +64,7 @@ RUN PROTOBUF_VERSION=$(dep-version.py protobuf) && \
6364

6465
# ZLib
6566
RUN ZLIB_VERSION=$(dep-version.py zlib) && \
66-
curl -O -L https://github.com/madler/zlib/archive/v${ZLIB_VERSION}.tar.gz && \
67+
download_dependency /dependencies.yaml zlib && \
6768
tar xfz v${ZLIB_VERSION}.tar.gz && \
6869
cd zlib-${ZLIB_VERSION} && \
6970
CFLAGS="-fPIC -O3" ./configure && \
@@ -72,16 +73,15 @@ RUN ZLIB_VERSION=$(dep-version.py zlib) && \
7273

7374
# Zstandard
7475
RUN ZSTD_VERSION=$(dep-version.py zstd) && \
75-
curl -O -L https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}/zstd-${ZSTD_VERSION}.tar.gz && \
76-
tar xfz zstd-${ZSTD_VERSION}.tar.gz && \
76+
download_dependency /dependencies.yaml zstd && \
7777
cd zstd-${ZSTD_VERSION} && \
7878
CFLAGS="-fPIC -O3" make -j8 && \
7979
make install && \
8080
rm -rf /zstd-${ZSTD_VERSION} /zstd-${ZSTD_VERSION}.tar.gz
8181

8282
# Snappy
8383
RUN SNAPPY_VERSION=$(dep-version.py snappy) && \
84-
curl -O -L https://github.com/google/snappy/archive/refs/tags/${SNAPPY_VERSION}.tar.gz && \
84+
download_dependency /dependencies.yaml snappy && \
8585
tar xfz ${SNAPPY_VERSION}.tar.gz && \
8686
cd snappy-${SNAPPY_VERSION} && \
8787
CXXFLAGS="-fPIC -O3" cmake . -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF && \
@@ -90,7 +90,7 @@ RUN SNAPPY_VERSION=$(dep-version.py snappy) && \
9090

9191
RUN OPENSSL_VERSION=$(dep-version.py openssl) && \
9292
OPENSSL_VERSION_UNDERSCORE=$(echo $OPENSSL_VERSION | sed 's/\./_/g') && \
93-
curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${OPENSSL_VERSION_UNDERSCORE}.tar.gz && \
93+
download_dependency /dependencies.yaml openssl && \
9494
tar xfz OpenSSL_${OPENSSL_VERSION_UNDERSCORE}.tar.gz && \
9595
cd openssl-OpenSSL_${OPENSSL_VERSION_UNDERSCORE}/ && \
9696
./config -fPIC --prefix=/usr/local/ssl/ && \
@@ -102,8 +102,7 @@ ENV OPENSSL_ROOT_DIR /usr/local/ssl/
102102

103103
# LibCurl
104104
RUN CURL_VERSION=$(dep-version.py curl) && \
105-
CURL_VERSION_UNDERSCORE=$(echo $CURL_VERSION | sed 's/\./_/g') && \
106-
curl -O -L https://github.com/curl/curl/releases/download/curl-${CURL_VERSION_UNDERSCORE}/curl-${CURL_VERSION}.tar.gz && \
105+
download_dependency /dependencies.yaml curl && \
107106
tar xfz curl-${CURL_VERSION}.tar.gz && \
108107
cd curl-${CURL_VERSION} && \
109108
CFLAGS=-fPIC ./configure --with-ssl=/usr/local/ssl/ --without-zstd && \
@@ -112,7 +111,7 @@ RUN CURL_VERSION=$(dep-version.py curl) && \
112111

113112
# Pulsar client C++
114113
RUN PULSAR_CPP_VERSION=$(dep-version.py pulsar-cpp) && \
115-
curl -O -L https://archive.apache.org/dist/pulsar/pulsar-client-cpp-${PULSAR_CPP_VERSION}/apache-pulsar-client-cpp-${PULSAR_CPP_VERSION}.tar.gz && \
114+
download_dependency /dependencies.yaml pulsar-cpp && \
116115
tar xfz apache-pulsar-client-cpp-${PULSAR_CPP_VERSION}.tar.gz && \
117116
cd apache-pulsar-client-cpp-${PULSAR_CPP_VERSION} && \
118117
cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_STATIC_LIB=OFF -DLINK_STATIC=ON && \

pkg/manylinux_musl/Dockerfile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,20 @@ RUN apk add cmake
3939

4040
ADD .build/dependencies.yaml /
4141
ADD .build/dep-version.py /usr/local/bin
42+
ADD .build/dep-url.sh /usr/local/bin
43+
RUN . /usr/local/bin/dep-url.sh
4244

4345
# Download and install boost
4446
RUN BOOST_VERSION=$(dep-version.py boost) && \
4547
BOOST_VERSION_UNDESRSCORE=$(echo $BOOST_VERSION | sed 's/\./_/g') && \
46-
curl -O -L https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_UNDESRSCORE}.tar.gz && \
48+
download_dependency /dependencies.yaml boost && \
4749
tar xfz boost_${BOOST_VERSION_UNDESRSCORE}.tar.gz && \
4850
cp -r boost_${BOOST_VERSION_UNDESRSCORE}/boost /usr/include/ && \
4951
rm -rf /boost_${BOOST_VERSION_UNDESRSCORE}.tar.gz /boost_${BOOST_VERSION_UNDESRSCORE}
5052

5153
# Download and compile protobuf
5254
RUN PROTOBUF_VERSION=$(dep-version.py protobuf) && \
53-
curl -O -L https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-cpp-${PROTOBUF_VERSION}.tar.gz && \
55+
download_dependency /dependencies.yaml protobuf && \
5456
tar xfz protobuf-cpp-${PROTOBUF_VERSION}.tar.gz && \
5557
cd protobuf-${PROTOBUF_VERSION}/ && \
5658
CXXFLAGS=-fPIC ./configure && \
@@ -59,7 +61,7 @@ RUN PROTOBUF_VERSION=$(dep-version.py protobuf) && \
5961

6062
# ZLib
6163
RUN ZLIB_VERSION=$(dep-version.py zlib) && \
62-
curl -O -L https://github.com/madler/zlib/archive/v${ZLIB_VERSION}.tar.gz && \
64+
download_dependency /dependencies.yaml zlib && \
6365
tar xfz v${ZLIB_VERSION}.tar.gz && \
6466
cd zlib-${ZLIB_VERSION} && \
6567
CFLAGS="-fPIC -O3" ./configure && \
@@ -68,7 +70,7 @@ RUN ZLIB_VERSION=$(dep-version.py zlib) && \
6870

6971
# Zstandard
7072
RUN ZSTD_VERSION=$(dep-version.py zstd) && \
71-
curl -O -L https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}/zstd-${ZSTD_VERSION}.tar.gz && \
73+
download_dependency /dependencies.yaml zstd && \
7274
tar xfz zstd-${ZSTD_VERSION}.tar.gz && \
7375
cd zstd-${ZSTD_VERSION} && \
7476
CFLAGS="-fPIC -O3" make -j8 && \
@@ -77,7 +79,7 @@ RUN ZSTD_VERSION=$(dep-version.py zstd) && \
7779

7880
# Snappy
7981
RUN SNAPPY_VERSION=$(dep-version.py snappy) && \
80-
curl -O -L https://github.com/google/snappy/archive/refs/tags/${SNAPPY_VERSION}.tar.gz && \
82+
download_dependency /dependencies.yaml snappy && \
8183
tar xfz ${SNAPPY_VERSION}.tar.gz && \
8284
cd snappy-${SNAPPY_VERSION} && \
8385
CXXFLAGS="-fPIC -O3" cmake . -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF && \
@@ -86,7 +88,7 @@ RUN SNAPPY_VERSION=$(dep-version.py snappy) && \
8688

8789
RUN OPENSSL_VERSION=$(dep-version.py openssl) && \
8890
OPENSSL_VERSION_UNDERSCORE=$(echo $OPENSSL_VERSION | sed 's/\./_/g') && \
89-
curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${OPENSSL_VERSION_UNDERSCORE}.tar.gz && \
91+
download_dependency /dependencies.yaml openssl && \
9092
tar xfz OpenSSL_${OPENSSL_VERSION_UNDERSCORE}.tar.gz && \
9193
cd openssl-OpenSSL_${OPENSSL_VERSION_UNDERSCORE}/ && \
9294
./config -fPIC --prefix=/usr/local/ssl/ && \
@@ -98,8 +100,7 @@ ENV OPENSSL_ROOT_DIR /usr/local/ssl/
98100

99101
# LibCurl
100102
RUN CURL_VERSION=$(dep-version.py curl) && \
101-
CURL_VERSION_UNDERSCORE=$(echo $CURL_VERSION | sed 's/\./_/g') && \
102-
curl -O -L https://github.com/curl/curl/releases/download/curl-${CURL_VERSION_UNDERSCORE}/curl-${CURL_VERSION}.tar.gz && \
103+
download_dependency /dependencies.yaml curl && \
103104
tar xfz curl-${CURL_VERSION}.tar.gz && \
104105
cd curl-${CURL_VERSION} && \
105106
CFLAGS=-fPIC ./configure --with-ssl=/usr/local/ssl/ --without-zstd && \
@@ -108,8 +109,7 @@ RUN CURL_VERSION=$(dep-version.py curl) && \
108109

109110
# Pulsar client C++
110111
RUN PULSAR_CPP_VERSION=$(dep-version.py pulsar-cpp) && \
111-
curl -O -L https://archive.apache.org/dist/pulsar/pulsar-client-cpp-${PULSAR_CPP_VERSION}/apache-pulsar-client-cpp-${PULSAR_CPP_VERSION}.tar.gz && \
112-
tar xfz apache-pulsar-client-cpp-${PULSAR_CPP_VERSION}.tar.gz && \
112+
download_dependency /dependencies.yaml pulsar-cpp && \
113113
cd apache-pulsar-client-cpp-${PULSAR_CPP_VERSION} && \
114114
cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_STATIC_LIB=OFF -DLINK_STATIC=ON && \
115115
make -j8 && \

0 commit comments

Comments
 (0)