提交 1f6e01ad authored 作者: testing's avatar testing

fix

上级 b806ca8d
......@@ -166,6 +166,7 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
&& ln -sf /dev/stderr /var/log/nginx/error.log
ADD ./librdkafka /usr/local/librdkafka
RUN cd /bin/ && \
......@@ -219,6 +220,10 @@ rm -f cyrus-sasl-2.1.27.tar.gz && \
./configure --prefix=/usr --disable-sample --disable-obsolete_cram_attr --disable-obsolete_digest_attr --enable-static --disable-shared \
--disable-checkapop --disable-cram --disable-digest --enable-scram --disable-otp --disable-gssapi --with-dblib=none --with-pic && \
make && \
make install && \
cd /usr/local/librdkafka && \
./configure && \
make && \
make install && \
docker-php-ext-install gd && \
docker-php-ext-configure gd \
......@@ -235,7 +240,7 @@ make install && \
pecl install -o -f redis && \
echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini && \
pecl install -o -f rdkafka && \
echo "extension=rdkafka.so" > /usr/local/etc/php/conf.d/rdkafka.ini && \
echo "extension=rdkafka.so" > /usr/local/etc/php/conf.d/librdkafka.ini && \
docker-php-source delete && \
mkdir -p /etc/nginx && \
mkdir -p /var/www/app && \
......
version: 1.9.1-R-post{build}
pull_requests:
do_not_increment_build_number: true
image: Visual Studio 2019
configuration: Release
environment:
runtime: v142
matrix:
- platform: x64
arch: x64
- platform: win32
arch: x86
install:
- ps: "& .\\win32\\install-coapp.ps1"
# Update vcpkg (is outdated on the VS 2015 image)
- cmd: |
cd "C:\Tools\vcpkg"
git pull -q
.\bootstrap-vcpkg.bat
cd %appveyor_build_folder%
cache:
- c:\tools\vcpkg\installed
- C:\Users\appveyor\AppData\Local\vcpkg\archives
- C:\Users\appveyor\AppData\Local\vcpkg\installed
nuget:
account_feed: true
project_feed: true
disable_publish_on_pr: true
before_build:
- cmd: vcpkg --feature-flags=versions install --triplet %arch%-windows
build:
project: win32/librdkafka.sln
publish_nuget: true
publish_nuget_symbols: true
include_nuget_references: true
parallel: true
verbosity: normal
test_script:
- cmd: cd tests && ..\win32\outdir\%runtime%\%PLATFORM%\%CONFIGURATION%\tests.exe -l -Q -p1 && cd ..
artifacts:
- path: test_report*.json
name: Test report
- path: '*.nupkg'
name: Packages
- path: '**\*.dll'
name: Libraries
- path: '**\*.lib'
name: Libraries
- path: '**\*.pdb'
name: Libraries
- path: '**\*.exe'
name: Executables
#before_deploy:
after_test:
- ps: >-
# FIXME: Add to Deployment condition above:
# APPVEYOR_REPO_TAG = true
# This is the CoApp .autopkg file to create.
$autopkgFile = "win32/librdkafka.autopkg"
pwd
ls $autopkgFile
# Get the ".autopkg.template" file, replace "@version" with the Appveyor version number, then save to the ".autopkg" file.
cat ($autopkgFile + ".template") | % { $_ -replace "@version", $env:appveyor_build_version } > $autopkgFile
# Use the CoApp tools to create NuGet native packages from the .autopkg.
Write-NuGetPackage $autopkgFile
# Push all newly created .nupkg files as Appveyor artifacts for later deployment.
Get-ChildItem .\*.nupkg | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
deploy:
- provider: S3
access_key_id:
secure: 3SmFFB3J1WWjLqxouvH8zLdcmrFNVHHbkROb+2BBVJE=
secret_access_key:
secure: VT0D5uzlaJI6gfZbemKCnf0MMh6qnlcmioVADK0oCkW6syz+n17VzWScRjvAifPm
region: us-west-1
bucket: librdkafka-ci-packages
folder: librdkafka/p-librdkafka__bld-appveyor__plat-windows__arch-$(platform)__bldtype-$(configuration)__tag-$(APPVEYOR_REPO_TAG_NAME)__sha-$(APPVEYOR_REPO_COMMIT)__bid-$(APPVEYOR_BUILD_ID)
artifact: /.*\.(nupkg)/
max_error_retry: 3
on:
APPVEYOR_REPO_TAG: true
notifications:
- provider: Email
to:
- magnus@edenhill.se
on_build_success: false
on_build_failure: true
on_build_status_changed: true
---
BasedOnStyle: LLVM
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: 'true'
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'false'
AlignEscapedNewlines: Right
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllArgumentsOnNextLine: 'true'
AllowAllConstructorInitializersOnNextLine: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'true'
BinPackArguments: 'true'
BinPackParameters: 'false'
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializers: AfterColon
BreakStringLiterals: 'true'
ColumnLimit: '80'
DerivePointerAlignment: 'false'
SortIncludes: 'false'
IncludeBlocks: Preserve
IndentCaseLabels: 'false'
IndentPPDirectives: None
IndentWidth: '8'
Language: Cpp
MaxEmptyLinesToKeep: '3'
PointerAlignment: Right
ReflowComments: 'true'
SpaceAfterCStyleCast: 'false'
SpaceAfterLogicalNot: 'false'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCpp11BracedList: 'true'
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: 'true'
SpaceInEmptyParentheses: 'false'
SpacesBeforeTrailingComments: '2'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
TabWidth: '8'
UseTab: Never
...
---
BasedOnStyle: Google
AlignConsecutiveMacros: 'true'
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'false'
AlignEscapedNewlines: Right
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllArgumentsOnNextLine: 'true'
AllowAllConstructorInitializersOnNextLine: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'true'
BinPackArguments: 'true'
BinPackParameters: 'false'
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializers: AfterColon
BreakStringLiterals: 'true'
ColumnLimit: '80'
DerivePointerAlignment: 'false'
SortIncludes: 'false'
IncludeBlocks: Preserve
IndentCaseLabels: 'false'
IndentPPDirectives: None
IndentWidth: '2'
Language: Cpp
MaxEmptyLinesToKeep: '3'
PointerAlignment: Right
ReflowComments: 'true'
SpaceAfterCStyleCast: 'false'
SpaceAfterLogicalNot: 'false'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCpp11BracedList: 'true'
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: 'true'
SpaceInEmptyParentheses: 'false'
SpacesBeforeTrailingComments: '2'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
TabWidth: '8'
UseTab: Never
...
((nil
(compile-command . "LC_ALL=C make -C $(git rev-parse --show-toplevel) -kw -j"))
(c-mode
(c-file-style . "linux")
(tab-width . 8)
(indent-tabs-mode . nil))
)
(if (file-exists-p (concat (dir-locals-find-file "./") "TAGS"))
(visit-tags-table (concat (dir-locals-find-file "./") "TAGS")))
{
"targets": {
"xenial-amd64": {
"buildenv": "xenial-amd64",
"builddeps": [
"build-essential",
"python3",
"zlib1g-dev",
"libssl-dev",
"libsasl2-dev",
"libzstd-dev"
],
"buildcmd": [
"./configure",
"make -j ${PARALLEL}",
"make -C tests build"
],
"testcmd": [
"make -C tests run_local_quick"
],
},
"xenial-i386": {
"_comment": "including liblz4-dev here to verify that WITH_LZ4_EXT works",
"buildenv": "xenial-i386",
"builddeps": [
"build-essential",
"python3",
"zlib1g-dev",
"libssl-dev",
"libsasl2-dev",
"liblz4-dev",
"libzstd-dev"
],
"buildcmd": [
"./configure",
"make -j ${PARALLEL}",
"make -C tests build"
],
"testcmd": [
"make -C tests run_local_quick"
],
},
"xenial-armhf": {
"buildenv": "xenial-armhf",
"builddeps": [
"build-essential",
"python3",
"zlib1g-dev",
"libssl-dev",
"libsasl2-dev",
"libzstd-dev"
],
"buildcmd": [
"./configure",
"make -j ${PARALLEL}",
"make -j ${PARALLEL} -C tests build",
],
"testcmd": [
"cd tests",
"./run-test.sh -p1 -l",
"cd .."
],
},
"stretch-mips": {
"buildenv": "stretch-mips",
"builddeps": [
"build-essential",
"python3",
"zlib1g-dev",
"libssl-dev",
"libsasl2-dev",
"libzstd-dev"
],
"buildcmd": [
"./configure",
"make -j ${PARALLEL}",
"make -j ${PARALLEL} -C tests build",
],
"testcmd": [
"cd tests",
"./run-test.sh -p1 -l",
"cd .."
],
},
"cmake-xenial-amd64": {
"buildenv": "xenial-amd64",
"builddeps": [
"build-essential",
"python3",
"zlib1g-dev",
"libssl-dev",
"libsasl2-dev",
"cmake"
],
"buildcmd": [
"cmake -H. -B_builds -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Debug",
"cmake --build _builds",
],
"testcmd": [
"cd _builds",
"ctest -VV -R RdKafkaTestBrokerLess"
],
}
},
"artifacts": ["config.log", "Makefile.config", "config.h"]
}
# Files to not check/fix coding style for.
# These files are imported from other sources and we want to maintain
# them in the original form to make future updates easier.
src/lz4.c
src/lz4.h
src/lz4frame.c
src/lz4frame.h
src/lz4hc.c
src/lz4hc.h
src/queue.h
src/crc32c.c
src/crc32c.h
src/snappy.c
src/snappy.h
src/snappy_compat.h
src/tinycthread.c
src/tinycthread.h
src/regexp.h
# Print rd_kafka_msgq_t
define dump_msgq
set $rkmq = $arg0
set $rkm = $rkmq.rkmq_msgs.tqh_first
set $exp_msgid = 0
set $cnt = 0
while $rkm != 0
set $msgid = $rkm.rkm_u.producer.msgid
printf "#%d ((rd_kafka_msgq_t *)%p) msgid %llu\n", $cnt, $rkm, $msgid
if $exp_msgid != 0 && $exp_msgid != $msgid
printf " ^ WARNING: expected msgid %llu, not %llu\n", $exp_msgid, $msgid
end
set $exp_msgid = $msgid + 1
set $rkm = $rkm.rkm_link.tqe_next
set $cnt++
end
end
Read the FAQ first: https://github.com/edenhill/librdkafka/wiki/FAQ
Do NOT create issues for questions, use the discussion forum: https://github.com/edenhill/librdkafka/discussions
Description
===========
<your issue description goes here>
How to reproduce
================
<your steps how to reproduce goes here, or remove section if not relevant>
**IMPORTANT**: Always try to reproduce the issue on the latest released version (see https://github.com/edenhill/librdkafka/releases), if it can't be reproduced on the latest version the issue has been fixed.
Checklist
=========
**IMPORTANT**: We will close issues where the checklist has not been completed.
Please provide the following information:
- [x] librdkafka version (release number or git tag): `<REPLACE with e.g., v0.10.5 or a git sha. NOT "latest" or "current">`
- [ ] Apache Kafka version: `<REPLACE with e.g., 0.10.2.3>`
- [ ] librdkafka client configuration: `<REPLACE with e.g., message.timeout.ms=123, auto.reset.offset=earliest, ..>`
- [ ] Operating system: `<REPLACE with e.g., Centos 5 (x64)>`
- [ ] Provide logs (with `debug=..` as necessary) from librdkafka
- [ ] Provide broker log excerpts
- [ ] Critical issue
name: check
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
sudo apt update
sudo apt install -y python3 python3-pip python3-setuptools libcurl4-openssl-dev libssl-dev libsasl2-dev
python3 -m pip install -r tests/requirements.txt
- run: |
./configure --CFLAGS="-std=c99" --CXXFLAGS="-std=c++98" --install-deps --enable-devel --disable-lz4-ext --prefix="$PWD/dest"
- run: |
make -j
make -C tests -j build
- run: |
examples/rdkafka_example -V || true
examples/rdkafka_example -X builtin.features
- run: |
make -C tests run_local_quick
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
sudo apt update
sudo apt install -y python3 python3-pip python3-setuptools clang-format
python3 -m pip install -r packaging/tools/requirements.txt
- name: Style checker
run: make style-check
config.h
config.log*
config.cache
Makefile.config
rdkafka*.pc
*~
\#*
*.o
*.so
*.so.?
*.dylib
*.a
*.d
librdkafka*.lds
core
vgcore.*
*dSYM/
*.offset
SOURCES
gmon.out
*.gz
*.tgz
*.bz2
*.deb
*.rpm
staging-docs
tmp
stats*.json
test_report*.json
cov-int
gdbrun*.gdb
TAGS
vcpkg_installed
version: v1.0
name: M1 Pipeline
agent:
machine:
type: s1-prod-mac-m1
blocks:
- name: 'Build, Test, Package'
task:
jobs:
- name: 'Build'
env_vars:
- name: CC
value: gcc
commands:
- cd $SEM_WORKSPACE
- checkout
- export WORKSPACE=$SEM_WORKSPACE/librdkafka
- cd $WORKSPACE
- mkdir dest artifacts
- ./configure --install-deps --source-deps-only --enable-static --disable-lz4-ext --prefix="$WORKSPACE/dest" --enable-strip
- make -j2 all examples check
- make -j2 -C tests build
- make -C tests run_local_quick
- make install
- cd $WORKSPACE/dest
- tar cvzf ${WORKSPACE}/artifacts/librdkafka-${CC}.tar.gz .
- artifact push job ${WORKSPACE}/artifacts/librdkafka-${CC}.tar.gz
- cd $WORKSPACE
- sha256sum artifacts/*
language: c
dist: xenial
cache: ccache
addons:
apt:
packages:
- python3
- python3-pip
- python3-setuptools
# required by openssl installer
- perl
env:
global:
- secure: "q7DQ6KCiQyMEpBf8mxPFl6hY9JEoaOUdIaLh1IuYn5TctiNIA+J6O/bL/dyDSy2Yjor61WAiiMOh77eMykm1wPl72kqjR97ui0uCq7BQQn4MWtKrXXi0eWLF3bYt2FbUGJZvrM0xeoWzSYT6np7CKu8ssgL8Fvr4bmf152IpdQ8="
- secure: "XpFExynXwbSr6vTuGsZVyqF4sti+UmRxX2sztjpTdaIH0yo60d6KYT0SRW7BLdZNA6/XI1l1GPTAwcDwTM1XasnnFrD7i88uZsAneA/xEgZTGXtnVVWPJAcVoX/75Rxeibc8CfSc5MO9QmBMiGGuI3S6HHCj4RzCJacBhOjIhfA="
matrix:
include:
- name: "Linux GCC: +Debian packages +BuiltinRegex +Strict"
if: tag IS present
os: linux
compiler: gcc
env:
- ADDITIONAL_BUILDS="debian"
- ADDITIONAL_BUILD_FLAGS="--source-deps-only"
- LINKAGE=std
before_script:
- ./configure --install-deps --disable-lz4-ext --disable-regex-ext --prefix="$PWD/dest" --enable-strip
- name: "RPM packages"
if: tag IS present
os: linux
compiler: gcc
env: ADDITIONAL_BUILDS="centos" SKIP_MAKE=y
- name: "Linux clang: +alpine +manylinux +werror"
os: linux
compiler: clang
env: ADDITIONAL_BUILDS="alpine manylinux2010_x86_64" ADDITIONAL_BUILD_FLAGS="--source-deps-only" LINKAGE=std
before_script:
- ./configure --install-deps --disable-lz4-ext --prefix="$PWD/dest" --enable-werror --enable-strip
- name: "Linux clang: +static +alpine-static -gssapi"
if: tag IS present
os: linux
compiler: clang
env: ADDITIONAL_BUILDS="alpine-static" LINKAGE=static
before_script:
- ./configure --enable-static --install-deps --source-deps-only --disable-gssapi --disable-lz4-ext --prefix="$PWD/dest" --enable-strip
- name: "OSX GCC"
if: tag IS PRESENT
os: osx
compiler: gcc
env: LINKAGE=std HOMEBREW_NO_AUTO_UPDATE=1
before_script:
- ./configure --install-deps --source-deps-only --disable-lz4-ext --prefix="$PWD/dest" --enable-strip
- name: "OSX clang: +static"
if: tag IS PRESENT
os: osx
compiler: clang
env: LINKAGE=static HOMEBREW_NO_AUTO_UPDATE=1
before_script:
- ./configure --install-deps --source-deps-only --disable-lz4-ext --prefix="$PWD/dest" --enable-static --enable-strip
- name: "Windows MinGW-w64 Dynamic"
if: tag IS PRESENT
os: windows
env:
- LINKAGE=std
- SKIP_MAKE=y
before_install:
- source ./packaging/mingw-w64/travis-before-install.sh
before_script:
- ./packaging/mingw-w64/configure-build-msys2-mingw.sh
- name: "Windows MinGW-w64 Static"
os: windows
env:
- LINKAGE=static
- SKIP_MAKE=y
before_install:
- source ./packaging/mingw-w64/travis-before-install.sh
before_script:
- ./packaging/mingw-w64/configure-build-msys2-mingw-static.sh
- ./packaging/mingw-w64/run-tests.sh
- name: "Linux GCC: +integration-tests +copyright-check +doc-check +devel +code-cov +c99 +c++98"
os: linux
dist: xenial
language: python
python: 3.8
compiler: gcc
env: NO_ARTIFACTS=y RUN_INTEGRATION_TESTS=y COPYRIGHT_CHECK=y DOC_CHECK=y
before_script:
- wget -O rapidjson-dev.deb https://launchpad.net/ubuntu/+archive/primary/+files/rapidjson-dev_1.1.0+dfsg2-3_all.deb
- sudo dpkg -i rapidjson-dev.deb
- python -m pip install -U pip
- python -m pip -V
- python -m pip install -r tests/requirements.txt
- sudo apt update
- sudo apt install -y doxygen graphviz gdb
- ./configure --CFLAGS="-std=c99" --CXXFLAGS="-std=c++98" --install-deps --enable-devel --disable-lz4-ext --prefix="$PWD/dest"
- ./packaging/tools/rdutcoverage.sh
- name: "Linux GCC arm64: +static -gssapi"
os: linux
arch: arm64
dist: bionic
compiler: gcc
env: LINKAGE=std
before_script:
- ./configure --disable-gssapi --install-deps --source-deps-only --enable-static --disable-lz4-ext --prefix="$PWD/dest" --enable-strip
- name: "Linux GCC s390x: +devel"
if: tag IS PRESENT
os: linux
arch: s390x
dist: bionic
compiler: gcc
env: NO_ARTIFACTS=y
before_script:
- sudo apt install -y gdb
- ./configure --enable-devel --disable-lz4-ext --prefix="$PWD/dest"
install:
- ccache -s || echo "CCache is not available."
- rm -rf artifacts dest
- mkdir dest artifacts
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then sudo apt update || true; fi
- if [[ $TRAVIS_DIST == "trusty" || $TRAVIS_DIST == "xenial" ]]; then sudo apt-get install -y libssl1.0.0 libssl-dev ; fi
- if [[ $TRAVIS_DIST == "bionic" || $TRAVIS_DIST == "focal" ]]; then sudo apt-get install -y libssl1.1 libssl-dev ; fi
- if [[ -n $DOCKER_PASSWORD && $TRAVIS_OS_NAME == "linux" ]]; then echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin ; fi
before_cache:
- if [[ $TRAVIS_OS_NAME == windows ]]; then $msys2 pacman --sync --clean --noconfirm ; fi
script:
- if [[ $SKIP_MAKE != y ]]; then (make -j2 all examples check && make -j2 -C tests build) || travis_terminate 1 ; fi
# Tag: Run quick local test suite on
# No tag: Run unit tests.
- if [[ $SKIP_MAKE != y && $RUN_INTEGRATION_TESTS != y ]]; then if [[ -n $TRAVIS_TAG ]]; then make -C tests run_local_quick; else make -C tests unit ; fi ; fi
- if [[ $SKIP_MAKE != y ]]; then make install || travis_terminate 1 ; fi
- if [[ -z $NO_ARTIFACTS ]]; then (cd dest && tar cvzf ../artifacts/librdkafka-${CC}.tar.gz .) ; fi
- if [[ -n $TRAVIS_TAG ]]; then for distro in $ADDITIONAL_BUILDS ; do packaging/tools/distro-build.sh $distro $ADDITIONAL_BUILD_FLAGS --enable-strip || travis_terminate 1 ; done ; fi
- if [[ $COPYRIGHT_CHECK == y ]]; then make copyright-check || travis_terminate 1; fi
- if [[ $DOC_CHECK == y ]]; then make docs || travis_terminate 1 ; fi
- if [[ -z $TRAVIS_TAG && $RUN_INTEGRATION_TESTS == y ]]; then (cd tests && travis_retry ./interactive_broker_version.py -c "make quick" 2.8.1) || travis_terminate 1 ; fi
- if [[ -f tests/core ]] && (which gdb >/dev/null); then (cd tests && LD_LIBRARY_PATH=../src:../src-cpp gdb ./test-runner core < backtrace.gdb) ; fi
- sha256sum artifacts/* || true
deploy:
provider: s3
access_key_id:
secure: "sRsKY1YoPDb3b+9hHnBv4tDSdyB/FraYEKI1/+aKmqWxvOI6xYYFFP0Tvn6f4Rgk0wzYmxO/5V+cR+fmKxVhb1pItFXOdVqML0ilOTP5gtlOPUeHu9fytqw3q7GgMV8JR75g60BNVko9vZegtd2LIq6FWzAIvPSUJOAw7qekjGU="
secret_access_key:
secure: "ZDjH6Z9CJr2yo7Splm+0xpo30QbO+cpeqxFUn1d9XOyLZQ0dapr6iboxdPlJaCOIhqVUWXS0IJgFwCW+5vWb9Za6tFumP1MtJGiwE6bqr820G8E02umwSvbNijr44h+EyxQcxP71Ljjk22Pfu7SLKWqMJ/iIzcYe6Z6Sz8obSWA="
bucket: librdkafka-ci-packages
region: us-west-1
skip_cleanup: true
local-dir: artifacts
upload-dir: librdkafka/p-librdkafka__bld-travis__plat-${TRAVIS_OS_NAME}__arch-${TRAVIS_CPU_ARCH}__tag-${TRAVIS_TAG}__sha-${TRAVIS_COMMIT}__bid-${TRAVIS_JOB_NUMBER}__lnk-${LINKAGE}
on:
repo: edenhill/librdkafka
all_branches: true
tags: true
condition: $NO_ARTIFACTS != y
cmake_minimum_required(VERSION 3.2)
include("packaging/cmake/parseversion.cmake")
parseversion("src/rdkafka.h")
project(RdKafka VERSION ${RDKAFKA_VERSION})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/packaging/cmake/Modules/")
# Options. No 'RDKAFKA_' prefix to match old C++ code. {
# This option doesn't affect build in fact, only C code
# (see 'rd_kafka_version_str'). In CMake the build type feature usually used
# (like Debug, Release, etc.).
option(WITHOUT_OPTIMIZATION "Disable optimization" OFF)
option(ENABLE_DEVEL "Enable development asserts, checks, etc" OFF)
option(ENABLE_REFCNT_DEBUG "Enable refcnt debugging" OFF)
set(TRYCOMPILE_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/packaging/cmake/try_compile")
set(BUILT_WITH "CMAKE")
# Toolchain {
list(APPEND BUILT_WITH "${CMAKE_C_COMPILER_ID}")
list(APPEND BUILT_WITH "${CMAKE_CXX_COMPILER_ID}")
# }
# PkgConfig {
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
set(WITH_PKGCONFIG ON)
list(APPEND BUILT_WITH "PKGCONFIG")
endif()
# }
# LIBM {
include(CheckLibraryExists)
check_library_exists(m pow "" WITH_HDRHISTOGRAM)
if(WITH_HDRHISTOGRAM)
list(APPEND BUILT_WITH "HDRHISTOGRAM")
endif()
# }
# ZLIB {
find_package(ZLIB QUIET)
if(ZLIB_FOUND)
set(with_zlib_default ON)
else()
set(with_zlib_default OFF)
endif()
option(WITH_ZLIB "With ZLIB" ${with_zlib_default})
if(WITH_ZLIB)
list(APPEND BUILT_WITH "ZLIB")
endif()
# }
# CURL {
find_package(CURL QUIET)
if(CURL_FOUND)
set(with_curl_default ON)
else()
set(with_curl_default OFF)
endif()
option(WITH_CURL "With CURL" ${with_curl_default})
if(WITH_CURL)
list(APPEND BUILT_WITH "CURL")
endif()
# }
# ZSTD {
find_package(ZSTD QUIET)
if(ZSTD_FOUND)
set(with_zstd_default ON)
else()
set(with_zstd_default OFF)
endif()
option(WITH_ZSTD "With ZSTD" ${with_zstd_default})
if(WITH_ZSTD)
list(APPEND BUILT_WITH "ZSTD")
endif()
# }
# LibDL {
try_compile(
WITH_LIBDL
"${CMAKE_CURRENT_BINARY_DIR}/try_compile"
"${TRYCOMPILE_SRC_DIR}/dlopen_test.c"
LINK_LIBRARIES "${CMAKE_DL_LIBS}"
)
if(WITH_LIBDL)
list(APPEND BUILT_WITH "LIBDL")
endif()
# }
# WITH_PLUGINS {
if(WITH_LIBDL OR WIN32)
set(with_plugins_default ON)
else()
set(with_plugins_default OFF)
endif()
option(WITH_PLUGINS "With plugin support" ${with_plugins_default})
if(WITH_PLUGINS)
list(APPEND BUILT_WITH "PLUGINS")
endif()
# }
# OpenSSL {
if(WITH_BUNDLED_SSL) # option from 'h2o' parent project
set(with_ssl_default ON)
else()
find_package(OpenSSL QUIET)
if(OpenSSL_FOUND)
set(with_ssl_default ON)
else()
set(with_ssl_default OFF)
endif()
endif()
option(WITH_SSL "With SSL" ${with_ssl_default})
if(WITH_SSL)
list(APPEND BUILT_WITH "SSL")
endif()
# }
# SASL {
if(WIN32)
set(with_sasl_default ON)
else()
if(PkgConfig_FOUND)
pkg_check_modules(SASL libsasl2)
if(SASL_FOUND)
set(with_sasl_default ON)
else()
try_compile(
WITH_SASL_CYRUS_BOOL
"${CMAKE_CURRENT_BINARY_DIR}/try_compile"
"${TRYCOMPILE_SRC_DIR}/libsasl2_test.c"
LINK_LIBRARIES "-lsasl2"
)
if(WITH_SASL_CYRUS_BOOL)
set(with_sasl_default ON)
set(SASL_LIBRARIES "-lsasl2")
else()
set(with_sasl_default OFF)
endif()
endif()
endif()
endif()
option(WITH_SASL "With SASL" ${with_sasl_default})
if(WITH_SASL)
if(SASL_FOUND)
link_directories(${SASL_LIBRARY_DIRS})
endif()
if(WITH_SSL)
set(WITH_SASL_SCRAM ON)
set(WITH_SASL_OAUTHBEARER ON)
list(APPEND BUILT_WITH "SASL_SCRAM SASL_OAUTHBEARER")
endif()
if(NOT WIN32)
set(WITH_SASL_CYRUS ON)
list(APPEND BUILT_WITH "SASL_CYRUS")
endif()
endif()
# }
if(WITH_SSL AND WITH_CURL)
set(WITH_OAUTHBEARER_OIDC ON)
endif()
# LZ4 {
option(ENABLE_LZ4_EXT "Enable external LZ4 library support" ON)
set(WITH_LZ4_EXT OFF)
if(ENABLE_LZ4_EXT)
find_package(LZ4)
if(LZ4_FOUND)
set(WITH_LZ4_EXT ON)
list(APPEND BUILT_WITH "LZ4_EXT")
else()
message(STATUS "Using bundled LZ4 implementation.")
endif()
endif()
# }
option(RDKAFKA_BUILD_STATIC "Build static rdkafka library" OFF)
option(RDKAFKA_BUILD_EXAMPLES "Build examples" ON)
option(RDKAFKA_BUILD_TESTS "Build tests" ON)
if(WIN32)
option(WITHOUT_WIN32_CONFIG "Avoid including win32_config.h on cmake builds" ON)
endif(WIN32)
# In:
# * TRYCOMPILE_SRC_DIR
# Out:
# * HAVE_ATOMICS_32
# * HAVE_ATOMICS_32_SYNC
# * HAVE_ATOMICS_64
# * HAVE_ATOMICS_64_SYNC
# * HAVE_REGEX
# * HAVE_STRNDUP
# * HAVE_PTHREAD_SETNAME_GNU
# * HAVE_PTHREAD_SETNAME_DARWIN
# * HAVE_PTHREAD_SETNAME_FREEBSD
# * WITH_C11THREADS
# * WITH_CRC32C_HW
# * LINK_ATOMIC
include("packaging/cmake/try_compile/rdkafka_setup.cmake")
if(WITH_C11THREADS)
list(APPEND BUILT_WITH "C11THREADS")
endif()
if(WITH_CRC32C_HW)
list(APPEND BUILT_WITH "CRC32C_HW")
endif()
set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
# In:
# * WITHOUT_OPTIMIZATION
# * ENABLE_DEVEL
# * ENABLE_REFCNT_DEBUG
# * HAVE_ATOMICS_32
# * HAVE_ATOMICS_32_SYNC
# * HAVE_ATOMICS_64
# * HAVE_ATOMICS_64_SYNC
# * WITH_ZLIB
# * WITH_SSL
# * WITH_SASL
# * HAVE_REGEX
# * HAVE_STRNDUP
# * HAVE_PTHREAD_SETNAME_GNU
# * HAVE_PTHREAD_SETNAME_DARWIN
# * HAVE_PTHREAD_SETNAME_FREEBSD
list(APPEND BUILT_WITH "SNAPPY")
list(APPEND BUILT_WITH "SOCKEM")
string(REPLACE ";" " " BUILT_WITH "${BUILT_WITH}")
configure_file("packaging/cmake/config.h.in" "${GENERATED_DIR}/config.h")
# Installation (https://github.com/forexample/package-example) {
include(GNUInstallDirs)
set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(project_version "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(targets_export_name "${PROJECT_NAME}Targets")
set(namespace "${PROJECT_NAME}::")
include(CMakePackageConfigHelpers)
# In:
# * targets_export_name
# * PROJECT_NAME
configure_package_config_file(
"packaging/cmake/Config.cmake.in"
"${project_config}"
INSTALL_DESTINATION "${config_install_dir}"
)
write_basic_package_version_file(
"${project_version}"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
install(
FILES "${project_config}" "${project_version}" "packaging/cmake/Modules/FindLZ4.cmake"
DESTINATION "${config_install_dir}"
)
install(
EXPORT "${targets_export_name}"
NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}"
)
install(
FILES LICENSES.txt
DESTINATION "share/licenses/librdkafka"
)
add_subdirectory(src)
add_subdirectory(src-cpp)
if(RDKAFKA_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if(RDKAFKA_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at rdkafka@edenhill.se. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
# Contributing to librdkafka
(This document is based on [curl's CONTRIBUTE.md](https://github.com/curl/curl/blob/master/docs/CONTRIBUTE.md) - thank you!)
This document is intended to offer guidelines on how to best contribute to the
librdkafka project. This concerns new features as well as bug fixes and
general improvements.
### License and copyright
When contributing with code, you agree to put your changes and new code under
the same license librdkafka is already using unless stated and agreed
otherwise.
When changing existing source code, you do not alter the copyright of the
original file(s). The copyright will still be owned by the original creator(s)
or those who have been assigned copyright by the original author(s).
By submitting a patch to the librdkafka, you are assumed to have the right
to the code and to be allowed by your employer or whatever to hand over that
patch/code to us. We will credit you for your changes as far as possible, to
give credit but also to keep a trace back to who made what changes. Please
always provide us with your full real name when contributing!
Official librdkafka project maintainer(s) assume ownership of all accepted
submissions.
## Write a good patch
### Follow code style
When writing C code, follow the code style already established in
the project. Consistent style makes code easier to read and mistakes less
likely to happen.
clang-format is used to check, and fix, the style for C/C++ files,
while flake8 and autopep8 is used for the Python scripts.
You should check the style before committing by running `make style-check-changed`
from the top-level directory, and if any style errors are reported you can
automatically fix them using `make style-fix-changed` (or just run
that command directly).
The Python code may need some manual fixing since autopep8 is unable to fix
all warnings reported by flake8, in particular it will not split long lines,
in which case a ` # noqa: E501` may be needed to turn off the warning.
See the end of this document for the C style guide to use in librdkafka.
### Write Separate Changes
It is annoying when you get a huge patch from someone that is said to fix 511
odd problems, but discussions and opinions don't agree with 510 of them - or
509 of them were already fixed in a different way. Then the person merging
this change needs to extract the single interesting patch from somewhere
within the huge pile of source, and that gives a lot of extra work.
Preferably, each fix that correct a problem should be in its own patch/commit
with its own description/commit message stating exactly what they correct so
that all changes can be selectively applied by the maintainer or other
interested parties.
Also, separate changes enable bisecting much better when we track problems
and regression in the future.
### Patch Against Recent Sources
Please try to make your patches against latest master branch.
### Test Cases
Bugfixes should also include a new test case in the regression test suite
that verifies the bug is fixed.
Create a new tests/00<freenumber>-<short_bug_description>.c file and
try to reproduce the issue in its most simple form.
Verify that the test case fails for earlier versions and passes with your
bugfix in-place.
New features and APIs should also result in an added test case.
Submitted patches must pass all existing tests.
For more information on the test suite see [tests/README.md]
## How to get your changes into the main sources
File a [pull request on github](https://github.com/edenhill/librdkafka/pulls)
Your change will be reviewed and discussed there and you will be
expected to correct flaws pointed out and update accordingly, or the change
risk stalling and eventually just get deleted without action. As a submitter
of a change, you are the owner of that change until it has been merged.
Make sure to monitor your PR on github and answer questions and/or
fix nits/flaws. This is very important. We will take lack of replies as a
sign that you're not very anxious to get your patch accepted and we tend to
simply drop such changes.
When you adjust your pull requests after review, please squash the
commits so that we can review the full updated version more easily
and keep history cleaner.
For example:
# Interactive rebase to let you squash/fixup commits
$ git rebase -i master
# Mark fixes-on-fixes commits as 'fixup' (or just 'f') in the
# first column. These will be silently integrated into the
# previous commit, so make sure to move the fixup-commit to
# the line beneath the parent commit.
# Since this probably rewrote the history of previously pushed
# commits you will need to make a force push, which is usually
# a bad idea but works good for pull requests.
$ git push --force origin your_feature_branch
### Write good commit messages
A short guide to how to write good commit messages.
---- start ----
[area]: [short line describing the main effect] [(#issuenumber)]
-- empty line --
[full description, no wider than 72 columns that describe as much as
possible as to why this change is made, and possibly what things
it fixes and everything else that is related]
---- stop ----
Example:
cgrp: Restart query timer on all heartbeat failures (#10023)
If unhandled errors were received in HeartbeatResponse
the cgrp could get stuck in a state where it would not
refresh its coordinator.
**Important**: Rebase your PR branch on top of master (`git rebase -i master`)
and squash interim commits (to make a clean and readable git history)
before pushing. Use force push to keep your history clean even after
the initial PR push.
**Note**: Good PRs with bad commit messages or messy commit history
such as "fixed review comment", will be squashed up in
to a single commit with a proper commit message.
### Add changelog
If the changes in the PR affects the end user in any way, such as for a user
visible bug fix, new feature, API or doc change, etc, a release changelog item
needs to be added to [CHANGELOG.md](CHANGELOG.md) for the next release.
Add a single line to the appropriate section (Enhancements, Fixes, ..)
outlining the change, an issue number (if any), and your name or GitHub
user id for attribution.
E.g.:
```
## Enhancements
* Improve commit() async parameter documentation (Paul Nit, #123)
```
# librdkafka C style guide
## Function and globals naming
Use self-explanatory hierarchical snake-case naming.
Pretty much all symbols should start with `rd_kafka_`, followed by
their subsystem (e.g., `cgrp`, `broker`, `buf`, etc..), followed by an
action (e.g, `find`, `get`, `clear`, ..).
## Variable naming
For existing types use the type prefix as variable name.
The type prefix is typically the first part of struct member fields.
Example:
* `rd_kafka_broker_t` has field names starting with `rkb_..`, thus broker
variable names should be named `rkb`
For other types use reasonably concise but descriptive names.
`i` and `j` are typical int iterators.
## Variable declaration
Variables must be declared at the head of a scope, no in-line variable
declarations are allowed.
## Indenting
Use 8 spaces indent, same as the Linux kernel.
In emacs, use `c-set-style "linux`.
For C++, use Google's C++ style.
Fix formatting issues by running `make style-fix` prior to committing.
## Comments
Use `/* .. */` comments, not `// ..`
For functions, use doxygen syntax, e.g.:
/**
* @brief <short description>
* ..
* @returns <something..>
*/
Make sure to comment non-obvious code and situations where the full
context of an operation is not easily graspable.
Also make sure to update existing comments when the code changes.
## Line length
Try hard to keep line length below 80 characters, when this is not possible
exceed it with reason.
## Braces
Braces go on the same line as their enveloping statement:
int some_func (..) {
while (1) {
if (1) {
do something;
..
} else {
do something else;
..
}
}
/* Single line scopes should not have braces */
if (1)
hi();
else if (2)
/* Say hello */
hello();
else
bye();
## Spaces
All expression parentheses should be prefixed and suffixed with a single space:
int some_func (int a) {
if (1)
....;
for (i = 0 ; i < 19 ; i++) {
}
}
Use space around operators:
int a = 2;
if (b >= 3)
c += 2;
Except for these:
d++;
--e;
## New block on new line
New blocks should be on a new line:
if (1)
new();
else
old();
## Parentheses
Don't assume the reader knows C operator precedence by heart for complex
statements, add parentheses to ease readability.
## ifdef hell
Avoid ifdef's as much as possible.
Platform support checking should be performed in configure.librdkafka.
# librdkafka C++ style guide
Follow [Google's C++ style guide](https://google.github.io/styleguide/cppguide.html)
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论