From b663dee30cf2c22b2dce277f891bb3bf84ffd01e Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Wed, 21 Feb 2018 16:54:25 +0100 Subject: [PATCH] Add rd_kafka_last_error.patch This is needed to make the write_kafka plugin build on sid, and can be dropped when uploading collectd 5.8.1. --- debian/changelog | 2 ++ debian/patches/rd_kafka_last_error.patch | 34 ++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 37 insertions(+) create mode 100644 debian/patches/rd_kafka_last_error.patch diff --git a/debian/changelog b/debian/changelog index e7fc4c5..6e5d341 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,8 @@ collectd (5.8.0-1) UNRELEASED; urgency=medium * Enable the intel_rdt plugin, libpqos is now available. * Re-enable the varnish plugin, support for varnish 5.2 now implemented. * debian/patches: + - Added rd_kafka_last_error.patch; needed to build against + librdkafka-0.11.0. - Removed dpdk-pkg-config.patch; included upstream. - Removed libcollectdclient_error_buffer.patch; inclued upstream. - Removed local-msr-index-h.patch; included upstream. diff --git a/debian/patches/rd_kafka_last_error.patch b/debian/patches/rd_kafka_last_error.patch new file mode 100644 index 0000000..27fceac --- /dev/null +++ b/debian/patches/rd_kafka_last_error.patch @@ -0,0 +1,34 @@ +Description: 'rd_kafka_errno2err' is deprecated, fix failed builds + Since librdkafka-0.11.0 applications should use + rd_kafka_last_error() to retrieve the error code from the legacy APIs. +Author: Pavel Rochnyack +Forwarded: https://github.com/collectd/collectd/pull/2683 + +diff --git a/src/write_kafka.c b/src/write_kafka.c +index 306d92ccb..17a83e0e9 100644 +--- a/src/write_kafka.c ++++ b/src/write_kafka.c +@@ -77,6 +77,14 @@ static void kafka_log(const rd_kafka_t *rkt, int level, const char *fac, + } + #endif + ++static rd_kafka_resp_err_t kafka_error() { ++#if RD_KAFKA_VERSION >= 0x000b00ff ++ return rd_kafka_last_error(); ++#else ++ return rd_kafka_errno2err(errno); ++#endif ++} ++ + static uint32_t kafka_hash(const char *keydata, size_t keylen) { + uint32_t hash = 5381; + for (; keylen > 0; keylen--) +@@ -147,7 +155,7 @@ static int kafka_handle(struct kafka_topic_context *ctx) /* {{{ */ + if ((ctx->topic = rd_kafka_topic_new(ctx->kafka, ctx->topic_name, + topic_conf)) == NULL) { + ERROR("write_kafka plugin: cannot create topic : %s\n", +- rd_kafka_err2str(rd_kafka_errno2err(errno))); ++ rd_kafka_err2str(kafka_error())); + return errno; + } + diff --git a/debian/patches/series b/debian/patches/series index 8c3f46b..c795534 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,3 +2,4 @@ rrd_filter_path.patch collection_conf_path.patch myplugin_includes.patch nagios-debian-paths.patch +rd_kafka_last_error.patch -- 2.30.2