* [gentoo-commits] repo/gentoo:master commit in: dev-libs/librdkafka/files/, dev-libs/librdkafka/
@ 2017-01-27 13:34 Thomas Deutschmann
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Deutschmann @ 2017-01-27 13:34 UTC (permalink / raw
To: gentoo-commits
commit: aa140eb9148c3e9edf799b5006a7d08c71ad84f4
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 27 13:33:06 2017 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Jan 27 13:34:41 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa140eb9
dev-libs/librdkafka: Bump to v0.9.3
Package-Manager: Portage-2.3.3, Repoman-2.3.1
dev-libs/librdkafka/Manifest | 1 +
.../librdkafka-0.9.3-remove-lz4-automagic.patch | 46 +++++++++++++
dev-libs/librdkafka/librdkafka-0.9.3.ebuild | 77 ++++++++++++++++++++++
3 files changed, 124 insertions(+)
diff --git a/dev-libs/librdkafka/Manifest b/dev-libs/librdkafka/Manifest
index 9a87fa0..b12358b 100644
--- a/dev-libs/librdkafka/Manifest
+++ b/dev-libs/librdkafka/Manifest
@@ -1,2 +1,3 @@
DIST librdkafka-0.9.1.tar.gz 478341 SHA256 5ad57e0c9a4ec8121e19f13f05bacc41556489dfe8f46ff509af567fdee98d82 SHA512 d2023cc6f976ad7440b25cffd1b59587f6497febd7ac1a6d76eb7799d294210f20170063fe25f2eb1eb3cc373df791526d1bc8d0ffbb0bef4519dae89b177147 WHIRLPOOL a54a6ee8f0db0ee13de80f86ef1f53d1667fb48e8e27016f2c497b448aa6a33b8073c022255e8e9f48b3497266872862d2ba717f7fed0a39a01f72936115b7b5
DIST librdkafka-0.9.2.tar.gz 620799 SHA256 c243b66956ebb196510ee0efda67825467e31b93639d5f24eb082b5d83f56824 SHA512 12a7da8de59de684da527ab969cd84dc8602741e9208941e1c7ad6dc69774bcbc3fbde0620d48c300372fa20b15aa826d309b71730119d82ec578e274c241152 WHIRLPOOL 7786443d9f365303ce0aad8278d83684999b23529e57fa08757fa38cce63f3944a3942475154bd613a0fb3e419c822a5651a00005eb77ed8f32f11689c11b924
+DIST librdkafka-0.9.3.tar.gz 637066 SHA256 745ead036f0d5b732e1cd035a1f31fc23665f2982bf9d799742034e0a1bd0be9 SHA512 5ec4c597eb7871c13feaaa96a76dc97c836f1fb5ae6c11d10675aee5577ad09d33e104af8fd497a8fbc7ee2c59434800d4cd857843f5c37460d4107ba0dc4e78 WHIRLPOOL fd6e57f34079fc0d808e35fee2d1ab736719b82f5c3f9b292e50bb522d8fea7e8b74adaf7ecfa1940e6eae2ca6f0c154593a99976261f4e11969f1596af450b1
diff --git a/dev-libs/librdkafka/files/librdkafka-0.9.3-remove-lz4-automagic.patch b/dev-libs/librdkafka/files/librdkafka-0.9.3-remove-lz4-automagic.patch
new file mode 100644
index 00000000..2efe27f
--- /dev/null
+++ b/dev-libs/librdkafka/files/librdkafka-0.9.3-remove-lz4-automagic.patch
@@ -0,0 +1,46 @@
+From 7c64454f83f74dbe0dd33e3726906b20740e19a1 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@whissi.de>
+Date: Fri, 27 Jan 2017 13:56:23 +0100
+Subject: [PATCH] configure: Add option to disable automagic dependency on
+ liblz4
+
+Previously, mklove activated lz4 support when lz4 was found. This added
+a so called "automagic" dependency on liblz4 which is a problem from
+distributions.
+
+This commit will add an option which will allow you to explicit disable
+lz4 usage.
+---
+ configure.librdkafka | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/configure.librdkafka b/configure.librdkafka
+index cf47fea..71c29c7 100644
+--- a/configure.librdkafka
++++ b/configure.librdkafka
+@@ -30,6 +30,8 @@ mkl_toggle_option "Development" ENABLE_REFCNT_DEBUG "--enable-refcnt-debug" "Ena
+
+ mkl_toggle_option "Development" ENABLE_SHAREDPTR_DEBUG "--enable-sharedptr-debug" "Enable sharedptr debugging" "n"
+
++mkl_toggle_option "Feature" ENABLE_LZ4 "--enable-lz4" "Enable LZ4 support" "y"
++
+ mkl_toggle_option "Feature" ENABLE_SSL "--enable-ssl" "Enable SSL support" "y"
+ mkl_toggle_option "Feature" ENABLE_SASL "--enable-sasl" "Enable SASL support" "y"
+
+@@ -44,8 +46,11 @@ function checks {
+ mkl_lib_check "zlib" "WITH_ZLIB" disable CC "-lz" \
+ "#include <zlib.h>"
+ mkl_lib_check "libcrypto" "" disable CC "-lcrypto"
+- mkl_lib_check "liblz4" "WITH_LZ4" disable CC "-llz4" \
+- "#include <lz4frame.h>"
++
++ if [[ "$ENABLE_LZ4" == "y" ]]; then
++ mkl_lib_check "liblz4" "WITH_LZ4" disable CC "-llz4" \
++ "#include <lz4frame.h>"
++ fi
+
+ # Snappy support is built-in
+ mkl_allvar_set WITH_SNAPPY WITH_SNAPPY y
+--
+2.11.0
+
diff --git a/dev-libs/librdkafka/librdkafka-0.9.3.ebuild b/dev-libs/librdkafka/librdkafka-0.9.3.ebuild
new file mode 100644
index 00000000..79c16fc
--- /dev/null
+++ b/dev-libs/librdkafka/librdkafka-0.9.3.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="6"
+
+inherit toolchain-funcs
+
+DESCRIPTION="Apache Kafka C/C++ client library"
+HOMEPAGE="https://github.com/edenhill/librdkafka"
+
+if [[ ${PV} == "9999" ]]; then
+ EGIT_REPO_URI="
+ git://github.com/edenhill/${PN}.git
+ https://github.com/edenhill/${PN}.git
+ "
+
+ inherit git-r3
+else
+ SRC_URI="https://github.com/edenhill/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~hppa ~x86"
+fi
+
+LICENSE="BSD-2"
+
+# subslot = soname version
+SLOT="0/1"
+
+IUSE="lz4 sasl ssl static-libs"
+
+RDEPEND="
+ lz4? ( app-arch/lz4:= )
+ sasl? ( dev-libs/cyrus-sasl:= )
+ ssl? ( dev-libs/openssl:0= )
+ sys-libs/zlib
+"
+
+DEPEND="
+ ${RDEPEND}
+ virtual/pkgconfig
+"
+
+PATCHES=( "${FILESDIR}"/${PN}-0.9.3-remove-lz4-automagic.patch )
+
+src_configure() {
+ tc-export CC CXX LD NM OBJDUMP PKG_CONFIG STRIP
+
+ local myeconf=(
+ --no-cache
+ --no-download
+ --disable-debug-symbols
+ $(use_enable lz4)
+ $(use_enable sasl)
+ $(usex static-libs '--enable-static' '')
+ $(use_enable ssl)
+ )
+
+ econf ${myeconf[@]}
+}
+
+src_test() {
+ emake -C tests run_local
+}
+
+src_install() {
+ local DOCS=(
+ README.md
+ CONFIGURATION.md
+ INTRODUCTION.md
+ )
+
+ default
+
+ if ! use static-libs; then
+ find "${ED}"usr/lib* -name '*.la' -o -name '*.a' -delete || die
+ fi
+}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/librdkafka/files/, dev-libs/librdkafka/
@ 2018-02-20 20:39 Thomas Deutschmann
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Deutschmann @ 2018-02-20 20:39 UTC (permalink / raw
To: gentoo-commits
commit: 8f1bc6d821167d87e21034d108e899e0b5cd14f2
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 20 18:40:49 2018 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Tue Feb 20 20:38:55 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f1bc6d8
dev-libs/librdkafka: Rev bump to address memory leak
Package-Manager: Portage-2.3.24, Repoman-2.3.6
RepoMan-Options: --force
.../librdkafka-0.11.3-fix-memory-leak-issue1534.patch | 19 +++++++++++++++++++
...afka-0.11.3.ebuild => librdkafka-0.11.3-r1.ebuild} | 2 ++
2 files changed, 21 insertions(+)
diff --git a/dev-libs/librdkafka/files/librdkafka-0.11.3-fix-memory-leak-issue1534.patch b/dev-libs/librdkafka/files/librdkafka-0.11.3-fix-memory-leak-issue1534.patch
new file mode 100644
index 00000000000..ae4c3e5bc81
--- /dev/null
+++ b/dev-libs/librdkafka/files/librdkafka-0.11.3-fix-memory-leak-issue1534.patch
@@ -0,0 +1,19 @@
+https://github.com/edenhill/librdkafka/commit/8fed971043e642c195860cd77006622d23616c22
+
+--- a/src/rdkafka_msgset_writer.c
++++ b/src/rdkafka_msgset_writer.c
+@@ -436,10 +436,12 @@ rd_kafka_msgset_writer_write_msg_payload (rd_kafka_msgset_writer_t *msetw,
+ * room in the buffer we'll copy the payload to the buffer,
+ * otherwise we push a reference to the memory. */
+ if (rkm->rkm_len <= (size_t)rk->rk_conf.msg_copy_max_size &&
+- rd_buf_write_remains(&rkbuf->rkbuf_buf) > rkm->rkm_len)
++ rd_buf_write_remains(&rkbuf->rkbuf_buf) > rkm->rkm_len) {
+ rd_kafka_buf_write(rkbuf,
+ rkm->rkm_payload, rkm->rkm_len);
+- else
++ if (free_cb)
++ free_cb(rkm->rkm_payload);
++ } else
+ rd_kafka_buf_push(rkbuf, rkm->rkm_payload, rkm->rkm_len,
+ free_cb);
+ }
diff --git a/dev-libs/librdkafka/librdkafka-0.11.3.ebuild b/dev-libs/librdkafka/librdkafka-0.11.3-r1.ebuild
similarity index 95%
rename from dev-libs/librdkafka/librdkafka-0.11.3.ebuild
rename to dev-libs/librdkafka/librdkafka-0.11.3-r1.ebuild
index 00872b0eadc..f7ec851be53 100644
--- a/dev-libs/librdkafka/librdkafka-0.11.3.ebuild
+++ b/dev-libs/librdkafka/librdkafka-0.11.3-r1.ebuild
@@ -15,6 +15,8 @@ if [[ ${PV} == "9999" ]]; then
else
SRC_URI="https://github.com/edenhill/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="amd64 ~arm ~arm64 ~hppa ~ppc x86"
+
+ PATCHES=( "${FILESDIR}"/${P}-fix-memory-leak-issue1534.patch )
fi
LICENSE="BSD-2"
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/librdkafka/files/, dev-libs/librdkafka/
@ 2018-07-28 12:47 Thomas Deutschmann
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Deutschmann @ 2018-07-28 12:47 UTC (permalink / raw
To: gentoo-commits
commit: 76e4883019fe92c545739f7d52cb1af3dc8ea7a5
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 28 12:34:25 2018 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sat Jul 28 12:47:25 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=76e48830
dev-libs/librdkafka: drop old
Package-Manager: Portage-2.3.43, Repoman-2.3.10
dev-libs/librdkafka/Manifest | 1 -
...brdkafka-0.11.3-fix-memory-leak-issue1534.patch | 19 ------
dev-libs/librdkafka/librdkafka-0.11.3-r1.ebuild | 73 ----------------------
3 files changed, 93 deletions(-)
diff --git a/dev-libs/librdkafka/Manifest b/dev-libs/librdkafka/Manifest
index a12de3cdbeb..003a93a0a18 100644
--- a/dev-libs/librdkafka/Manifest
+++ b/dev-libs/librdkafka/Manifest
@@ -1,2 +1 @@
-DIST librdkafka-0.11.3.tar.gz 1849838 BLAKE2B 570713642b5ec9c2487a37b9146edda5f844427dbf55d6cb654ca9a8690cd6f77bcc9325800ac2a34da21f1cca33187f390c00132f9e5c28503f816ee256c4f9 SHA512 e9bb97ea1597019a841dd4ba3666ad72dcbc0539054155ce0caee92f1324f1a490515b0310405f822b829c05ed2688b48e2ca205a91cf88bf9ad6411f7c12b26
DIST librdkafka-0.11.4.tar.gz 1900117 BLAKE2B 3e755c91d6a2e12829ba841749977f8c05c9f243d79db64247547e4a49790e67d07f7d82633f45689dcc5f88caaef200027e6af3866de283c1de6120d7f98467 SHA512 6b34e7c476d328a2f8e8321f6ddcaeaf43730284bb3aaddac81c3cd9a1fa5d7f7ef7481f1093b36d89edde7b766da6cd27a9eb9a635b12b640e8a46a269bafc8
diff --git a/dev-libs/librdkafka/files/librdkafka-0.11.3-fix-memory-leak-issue1534.patch b/dev-libs/librdkafka/files/librdkafka-0.11.3-fix-memory-leak-issue1534.patch
deleted file mode 100644
index ae4c3e5bc81..00000000000
--- a/dev-libs/librdkafka/files/librdkafka-0.11.3-fix-memory-leak-issue1534.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-https://github.com/edenhill/librdkafka/commit/8fed971043e642c195860cd77006622d23616c22
-
---- a/src/rdkafka_msgset_writer.c
-+++ b/src/rdkafka_msgset_writer.c
-@@ -436,10 +436,12 @@ rd_kafka_msgset_writer_write_msg_payload (rd_kafka_msgset_writer_t *msetw,
- * room in the buffer we'll copy the payload to the buffer,
- * otherwise we push a reference to the memory. */
- if (rkm->rkm_len <= (size_t)rk->rk_conf.msg_copy_max_size &&
-- rd_buf_write_remains(&rkbuf->rkbuf_buf) > rkm->rkm_len)
-+ rd_buf_write_remains(&rkbuf->rkbuf_buf) > rkm->rkm_len) {
- rd_kafka_buf_write(rkbuf,
- rkm->rkm_payload, rkm->rkm_len);
-- else
-+ if (free_cb)
-+ free_cb(rkm->rkm_payload);
-+ } else
- rd_kafka_buf_push(rkbuf, rkm->rkm_payload, rkm->rkm_len,
- free_cb);
- }
diff --git a/dev-libs/librdkafka/librdkafka-0.11.3-r1.ebuild b/dev-libs/librdkafka/librdkafka-0.11.3-r1.ebuild
deleted file mode 100644
index ef4921fdc0a..00000000000
--- a/dev-libs/librdkafka/librdkafka-0.11.3-r1.ebuild
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="6"
-
-inherit toolchain-funcs
-
-DESCRIPTION="Apache Kafka C/C++ client library"
-HOMEPAGE="https://github.com/edenhill/librdkafka"
-
-if [[ ${PV} == "9999" ]]; then
- EGIT_REPO_URI="https://github.com/edenhill/${PN}.git"
-
- inherit git-r3
-else
- SRC_URI="https://github.com/edenhill/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
- KEYWORDS="amd64 arm ~arm64 hppa ~ppc x86"
-
- PATCHES=( "${FILESDIR}"/${P}-fix-memory-leak-issue1534.patch )
-fi
-
-LICENSE="BSD-2"
-
-# subslot = soname version
-SLOT="0/1"
-
-IUSE="lz4 sasl ssl static-libs"
-
-RDEPEND="
- lz4? ( app-arch/lz4:= )
- sasl? ( dev-libs/cyrus-sasl:= )
- ssl? ( dev-libs/openssl:0= )
- sys-libs/zlib
-"
-
-DEPEND="
- ${RDEPEND}
- virtual/pkgconfig
-"
-
-src_configure() {
- tc-export CC CXX LD NM OBJDUMP PKG_CONFIG STRIP
-
- local myeconf=(
- --no-cache
- --no-download
- --disable-debug-symbols
- $(use_enable lz4)
- $(use_enable sasl)
- $(usex static-libs '--enable-static' '')
- $(use_enable ssl)
- )
-
- econf ${myeconf[@]}
-}
-
-src_test() {
- emake -C tests run_local
-}
-
-src_install() {
- local DOCS=(
- README.md
- CONFIGURATION.md
- INTRODUCTION.md
- )
-
- default
-
- if ! use static-libs; then
- find "${ED}"usr/lib* -name '*.la' -o -name '*.a' -delete || die
- fi
-}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/librdkafka/files/, dev-libs/librdkafka/
@ 2024-01-17 5:47 Sam James
0 siblings, 0 replies; 4+ messages in thread
From: Sam James @ 2024-01-17 5:47 UTC (permalink / raw
To: gentoo-commits
commit: 5c76deddafc83853e132b482dcf164cf1c1dd65f
Author: Matoro Mahri <matoro_gentoo <AT> matoro <DOT> tk>
AuthorDate: Mon Jan 15 21:48:34 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan 17 05:43:39 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5c76dedd
dev-libs/librdkafka: fix tests on 32-bit
See: https://github.com/confluentinc/librdkafka/pull/4449
Bug: https://bugs.gentoo.org/915433
Signed-off-by: Matoro Mahri <matoro_gentoo <AT> matoro.tk>
Closes: https://github.com/gentoo/gentoo/pull/34826
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../files/librdkafka-2.2.0-backport-pr4449.patch | 285 +++++++++++++++++++++
dev-libs/librdkafka/librdkafka-2.2.0-r1.ebuild | 110 ++++++++
2 files changed, 395 insertions(+)
diff --git a/dev-libs/librdkafka/files/librdkafka-2.2.0-backport-pr4449.patch b/dev-libs/librdkafka/files/librdkafka-2.2.0-backport-pr4449.patch
new file mode 100644
index 000000000000..cc6b57ea72d2
--- /dev/null
+++ b/dev-libs/librdkafka/files/librdkafka-2.2.0-backport-pr4449.patch
@@ -0,0 +1,285 @@
+https://bugs.gentoo.org/915433
+https://github.com/confluentinc/librdkafka/pull/4449
+
+From 8b311b8a850805f4ec9bb068c0edb31492ad03fe Mon Sep 17 00:00:00 2001
+From: Emanuele Sabellico <esabellico@confluent.io>
+Date: Wed, 27 Sep 2023 11:08:33 +0200
+Subject: [PATCH 1/3] tmpabuf refactor and fix for insufficient buffer
+ allocation
+
+---
+ CHANGELOG.md | 10 ++++++
+ src/rdkafka_buf.h | 25 ++++++++++++---
+ src/rdkafka_metadata.c | 59 +++++++++++++++++++-----------------
+ src/rdkafka_metadata_cache.c | 38 +++++++++++------------
+ src/rdkafka_topic.c | 36 +++++++++++++---------
+ 5 files changed, 100 insertions(+), 68 deletions(-)
+
+diff --git a/src/rdkafka_buf.h b/src/rdkafka_buf.h
+index ccd563cc6..623ec49ae 100644
+--- a/src/rdkafka_buf.h
++++ b/src/rdkafka_buf.h
+@@ -49,21 +49,36 @@ typedef struct rd_tmpabuf_s {
+ size_t of;
+ char *buf;
+ int failed;
+- int assert_on_fail;
++ rd_bool_t assert_on_fail;
+ } rd_tmpabuf_t;
+
+ /**
+- * @brief Allocate new tmpabuf with \p size bytes pre-allocated.
++ * @brief Initialize new tmpabuf of non-final \p size bytes.
+ */
+ static RD_UNUSED void
+-rd_tmpabuf_new(rd_tmpabuf_t *tab, size_t size, int assert_on_fail) {
+- tab->buf = rd_malloc(size);
+- tab->size = size;
++rd_tmpabuf_new(rd_tmpabuf_t *tab, size_t size, rd_bool_t assert_on_fail) {
++ tab->buf = NULL;
++ tab->size = RD_ROUNDUP(size, 8);
+ tab->of = 0;
+ tab->failed = 0;
+ tab->assert_on_fail = assert_on_fail;
+ }
+
++/**
++ * @brief Add a new allocation of \p _size bytes,
++ * rounded up to maximum word size,
++ * for \p _times times.
++ */
++#define rd_tmpabuf_add_alloc_times(_tab, _size, _times) \
++ (_tab)->size += RD_ROUNDUP(_size, 8) * _times
++
++#define rd_tmpabuf_add_alloc(_tab, _size) \
++ rd_tmpabuf_add_alloc_times(_tab, _size, 1)
++/**
++ * @brief Finalize tmpabuf pre-allocating tab->size bytes.
++ */
++#define rd_tmpabuf_finalize(_tab) (_tab)->buf = rd_malloc((_tab)->size)
++
+ /**
+ * @brief Free memory allocated by tmpabuf
+ */
+diff --git a/src/rdkafka_metadata.c b/src/rdkafka_metadata.c
+index f96edf658..6c2f60ae3 100644
+--- a/src/rdkafka_metadata.c
++++ b/src/rdkafka_metadata.c
+@@ -164,7 +164,8 @@ static rd_kafka_metadata_internal_t *rd_kafka_metadata_copy_internal(
+ * Because of this we copy all the structs verbatim but
+ * any pointer fields needs to be copied explicitly to update
+ * the pointer address. */
+- rd_tmpabuf_new(&tbuf, size, 1 /*assert on fail*/);
++ rd_tmpabuf_new(&tbuf, size, rd_true /*assert on fail*/);
++ rd_tmpabuf_finalize(&tbuf);
+ mdi = rd_tmpabuf_write(&tbuf, src, sizeof(*mdi));
+ md = &mdi->metadata;
+
+@@ -506,11 +507,13 @@ rd_kafka_parse_Metadata(rd_kafka_broker_t *rkb,
+ * no more than 4 times larger than the wire representation.
+ * This is increased to 5 times in case if we want to compute partition
+ * to rack mapping. */
+- rd_tmpabuf_new(&tbuf,
+- sizeof(*mdi) + rkb_namelen +
+- (rkbuf->rkbuf_totlen * 4 +
+- (compute_racks ? rkbuf->rkbuf_totlen : 0)),
+- 0 /*dont assert on fail*/);
++ rd_tmpabuf_new(&tbuf, 0, rd_false /*dont assert on fail*/);
++ rd_tmpabuf_add_alloc(&tbuf, sizeof(*mdi));
++ rd_tmpabuf_add_alloc(&tbuf, rkb_namelen);
++ rd_tmpabuf_add_alloc(&tbuf, rkbuf->rkbuf_totlen *
++ (4 + (compute_racks ? 1 : 0)));
++
++ rd_tmpabuf_finalize(&tbuf);
+
+ if (!(mdi = rd_tmpabuf_alloc(&tbuf, sizeof(*mdi)))) {
+ rd_kafka_broker_unlock(rkb);
+@@ -1603,35 +1606,37 @@ rd_kafka_metadata_new_topic_mock(const rd_kafka_metadata_topic_t *topics,
+ rd_kafka_metadata_internal_t *mdi;
+ rd_kafka_metadata_t *md;
+ rd_tmpabuf_t tbuf;
+- size_t topic_names_size = 0;
+- int total_partition_cnt = 0;
+ size_t i;
+ int curr_broker = 0;
+
+- /* Calculate total partition count and topic names size before
+- * allocating memory. */
+- for (i = 0; i < topic_cnt; i++) {
+- topic_names_size += 1 + strlen(topics[i].topic);
+- total_partition_cnt += topics[i].partition_cnt;
+- }
+-
+ /* If the replication factor is given, num_brokers must also be given */
+ rd_assert(replication_factor <= 0 || num_brokers > 0);
+
+ /* Allocate contiguous buffer which will back all the memory
+ * needed by the final metadata_t object */
+- rd_tmpabuf_new(
+- &tbuf,
+- sizeof(*mdi) + (sizeof(*md->topics) * topic_cnt) +
+- topic_names_size + (64 /*topic name size..*/ * topic_cnt) +
+- (sizeof(*md->topics[0].partitions) * total_partition_cnt) +
+- (sizeof(*mdi->topics) * topic_cnt) +
+- (sizeof(*mdi->topics[0].partitions) * total_partition_cnt) +
+- (sizeof(*mdi->brokers) * RD_ROUNDUP(num_brokers, 8)) +
+- (replication_factor > 0 ? RD_ROUNDUP(replication_factor, 8) *
+- total_partition_cnt * sizeof(int)
+- : 0),
+- 1 /*assert on fail*/);
++ rd_tmpabuf_new(&tbuf, sizeof(*mdi), rd_true /*assert on fail*/);
++
++ rd_tmpabuf_add_alloc(&tbuf, topic_cnt * sizeof(*md->topics));
++ rd_tmpabuf_add_alloc(&tbuf, topic_cnt * sizeof(*mdi->topics));
++ rd_tmpabuf_add_alloc(&tbuf, num_brokers * sizeof(*md->brokers));
++
++ /* Calculate total partition count and topic names size before
++ * allocating memory. */
++ for (i = 0; i < topic_cnt; i++) {
++ rd_tmpabuf_add_alloc(&tbuf, 1 + strlen(topics[i].topic));
++ rd_tmpabuf_add_alloc(&tbuf,
++ topics[i].partition_cnt *
++ sizeof(*md->topics[i].partitions));
++ rd_tmpabuf_add_alloc(&tbuf,
++ topics[i].partition_cnt *
++ sizeof(*mdi->topics[i].partitions));
++ if (replication_factor > 0)
++ rd_tmpabuf_add_alloc_times(
++ &tbuf, replication_factor * sizeof(int),
++ topics[i].partition_cnt);
++ }
++
++ rd_tmpabuf_finalize(&tbuf);
+
+ mdi = rd_tmpabuf_alloc(&tbuf, sizeof(*mdi));
+ memset(mdi, 0, sizeof(*mdi));
+diff --git a/src/rdkafka_metadata_cache.c b/src/rdkafka_metadata_cache.c
+index 18f19a4d0..1530e699e 100644
+--- a/src/rdkafka_metadata_cache.c
++++ b/src/rdkafka_metadata_cache.c
+@@ -249,8 +249,6 @@ static struct rd_kafka_metadata_cache_entry *rd_kafka_metadata_cache_insert(
+ rd_kafka_metadata_broker_internal_t *brokers_internal,
+ size_t broker_cnt) {
+ struct rd_kafka_metadata_cache_entry *rkmce, *old;
+- size_t topic_len;
+- size_t racks_size = 0;
+ rd_tmpabuf_t tbuf;
+ int i;
+
+@@ -261,34 +259,32 @@ static struct rd_kafka_metadata_cache_entry *rd_kafka_metadata_cache_insert(
+ * any pointer fields needs to be copied explicitly to update
+ * the pointer address.
+ * See also rd_kafka_metadata_cache_delete which frees this. */
+- topic_len = strlen(mtopic->topic) + 1;
++ rd_tmpabuf_new(&tbuf, 0, rd_true /*assert on fail*/);
++
++ rd_tmpabuf_add_alloc(&tbuf, sizeof(*rkmce));
++ rd_tmpabuf_add_alloc(&tbuf, strlen(mtopic->topic) + 1);
++ rd_tmpabuf_add_alloc(&tbuf, mtopic->partition_cnt *
++ sizeof(*mtopic->partitions));
++ rd_tmpabuf_add_alloc(&tbuf,
++ mtopic->partition_cnt *
++ sizeof(*metadata_internal_topic->partitions));
+
+ for (i = 0; include_racks && i < mtopic->partition_cnt; i++) {
+ size_t j;
+- racks_size += RD_ROUNDUP(
+- metadata_internal_topic->partitions[i].racks_cnt *
+- sizeof(char *),
+- 8);
++ rd_tmpabuf_add_alloc(
++ &tbuf, metadata_internal_topic->partitions[i].racks_cnt *
++ sizeof(char *));
+ for (j = 0;
+ j < metadata_internal_topic->partitions[i].racks_cnt;
+ j++) {
+- racks_size += RD_ROUNDUP(
+- strlen(metadata_internal_topic->partitions[i]
+- .racks[j]) +
+- 1,
+- 8);
++ rd_tmpabuf_add_alloc(
++ &tbuf, strlen(metadata_internal_topic->partitions[i]
++ .racks[j]) +
++ 1);
+ }
+ }
+
+- rd_tmpabuf_new(
+- &tbuf,
+- RD_ROUNDUP(sizeof(*rkmce), 8) + RD_ROUNDUP(topic_len, 8) +
+- (mtopic->partition_cnt *
+- RD_ROUNDUP(sizeof(*mtopic->partitions), 8)) +
+- (mtopic->partition_cnt *
+- RD_ROUNDUP(sizeof(*metadata_internal_topic->partitions), 8)) +
+- racks_size,
+- 1 /*assert on fail*/);
++ rd_tmpabuf_finalize(&tbuf);
+
+ rkmce = rd_tmpabuf_alloc(&tbuf, sizeof(*rkmce));
+
+diff --git a/src/rdkafka_topic.c b/src/rdkafka_topic.c
+index 3b3986d43..b63a0bbea 100644
+--- a/src/rdkafka_topic.c
++++ b/src/rdkafka_topic.c
+@@ -1831,38 +1831,44 @@ rd_kafka_topic_info_t *rd_kafka_topic_info_new_with_rack(
+ const rd_kafka_metadata_partition_internal_t *mdpi) {
+ rd_kafka_topic_info_t *ti;
+ rd_tmpabuf_t tbuf;
+- size_t tlen = RD_ROUNDUP(strlen(topic) + 1, 8);
+- size_t total_racks_size = 0;
+ int i;
++ rd_bool_t has_racks = rd_false;
+
++ rd_tmpabuf_new(&tbuf, 0, rd_true /* assert on fail */);
++
++ rd_tmpabuf_add_alloc(&tbuf, sizeof(*ti));
++ rd_tmpabuf_add_alloc(&tbuf, strlen(topic) + 1);
+ for (i = 0; i < partition_cnt; i++) {
+ size_t j;
+ if (!mdpi[i].racks)
+ continue;
+
++ if (unlikely(!has_racks))
++ has_racks = rd_true;
++
+ for (j = 0; j < mdpi[i].racks_cnt; j++) {
+- total_racks_size +=
+- RD_ROUNDUP(strlen(mdpi[i].racks[j]) + 1, 8);
++ rd_tmpabuf_add_alloc(&tbuf,
++ strlen(mdpi[i].racks[j]) + 1);
+ }
+- total_racks_size +=
+- RD_ROUNDUP(sizeof(char *) * mdpi[i].racks_cnt, 8);
++ rd_tmpabuf_add_alloc(&tbuf, sizeof(char *) * mdpi[i].racks_cnt);
++ }
++
++ /* Only bother allocating this if at least one
++ * rack is there. */
++ if (has_racks) {
++ rd_tmpabuf_add_alloc(
++ &tbuf, sizeof(rd_kafka_metadata_partition_internal_t) *
++ partition_cnt);
+ }
+
+- if (total_racks_size) /* Only bother allocating this if at least one
+- rack is there. */
+- total_racks_size +=
+- RD_ROUNDUP(sizeof(rd_kafka_metadata_partition_internal_t) *
+- partition_cnt,
+- 8);
++ rd_tmpabuf_finalize(&tbuf);
+
+- rd_tmpabuf_new(&tbuf, sizeof(*ti) + tlen + total_racks_size,
+- 1 /* assert on fail */);
+ ti = rd_tmpabuf_alloc(&tbuf, sizeof(*ti));
+ ti->topic = rd_tmpabuf_write_str(&tbuf, topic);
+ ti->partition_cnt = partition_cnt;
+ ti->partitions_internal = NULL;
+
+- if (total_racks_size) {
++ if (has_racks) {
+ ti->partitions_internal = rd_tmpabuf_alloc(
+ &tbuf, sizeof(*ti->partitions_internal) * partition_cnt);
+
+
diff --git a/dev-libs/librdkafka/librdkafka-2.2.0-r1.ebuild b/dev-libs/librdkafka/librdkafka-2.2.0-r1.ebuild
new file mode 100644
index 000000000000..c3f8341d2d7d
--- /dev/null
+++ b/dev-libs/librdkafka/librdkafka-2.2.0-r1.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="8"
+
+PYTHON_COMPAT=( python3_{9..12} )
+
+inherit python-any-r1 toolchain-funcs
+
+DESCRIPTION="Apache Kafka C/C++ client library"
+HOMEPAGE="https://github.com/confluentinc/librdkafka"
+
+if [[ ${PV} == "9999" ]]; then
+ EGIT_REPO_URI="https://github.com/confluentinc/${PN}.git"
+
+ inherit git-r3
+else
+ SRC_URI="https://github.com/confluentinc/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
+fi
+
+LICENSE="BSD-2"
+
+# subslot = soname version
+SLOT="0/1"
+
+IUSE="lz4 sasl ssl static-libs zstd"
+
+LIB_DEPEND="
+ lz4? ( app-arch/lz4:=[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl:=[static-libs(+)] )
+ ssl? ( dev-libs/openssl:0=[static-libs(+)] )
+ zstd? ( app-arch/zstd:=[static-libs(+)] )
+ sys-libs/zlib:=[static-libs(+)]
+"
+# which: https://github.com/confluentinc/librdkafka/pull/4353
+BDEPEND="
+ sys-apps/which
+ virtual/pkgconfig
+ ${PYTHON_DEPS}
+"
+
+RDEPEND="net-misc/curl
+ !static-libs? ( ${LIB_DEPEND//\[static-libs(+)]} )"
+
+DEPEND="
+ ${RDEPEND}
+ static-libs? ( ${LIB_DEPEND} )
+"
+
+PATCHES=( "${FILESDIR}/${PN}-2.2.0-backport-pr4449.patch" )
+
+pkg_setup() {
+ python-any-r1_pkg_setup
+}
+
+src_prepare() {
+ default
+
+ if [[ ${PV} != "9999" ]]; then
+ sed -i \
+ -e "s/^\(export RDKAFKA_GITVER=\).*/\1\"${PV}@release\"/" \
+ tests/run-test.sh || die
+ fi
+}
+
+src_configure() {
+ tc-export AR CC CXX LD NM OBJDUMP PKG_CONFIG STRIP
+
+ local myeconf=(
+ --prefix="${EPREFIX}/usr"
+ --build="${CBUILD}"
+ --host="${CHOST}"
+ --mandir="${EPREFIX}/usr/share/man"
+ --infodir="${EPREFIX}/usr/share/info"
+ --datadir="${EPREFIX}/usr/share"
+ --sysconfdir="${EPREFIX}/etc"
+ --localstatedir="${EPREFIX}/var"
+ --libdir="${EPREFIX}/usr/$(get_libdir)"
+ --no-cache
+ --no-download
+ --disable-debug-symbols
+ $(use_enable lz4)
+ $(use_enable sasl)
+ $(usex static-libs '--enable-static' '')
+ $(use_enable ssl)
+ $(use_enable zstd)
+ )
+
+ ./configure ${myeconf[@]} || die
+}
+
+src_test() {
+ # Simulate CI so we do not fail when tests are running longer than expected,
+ # https://github.com/confluentinc/librdkafka/blob/v1.6.1/tests/0062-stats_event.c#L101-L116
+ local -x CI=true
+
+ emake -C tests run_local
+}
+
+src_install() {
+ emake -j1 \
+ DESTDIR="${D}" \
+ docdir="/usr/share/doc/${PF}" \
+ install
+
+ if ! use static-libs; then
+ find "${ED}" -type f \( -name "*.a" -o -name "*.la" \) -delete || die
+ fi
+}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-17 5:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-28 12:47 [gentoo-commits] repo/gentoo:master commit in: dev-libs/librdkafka/files/, dev-libs/librdkafka/ Thomas Deutschmann
-- strict thread matches above, loose matches on Subject: below --
2024-01-17 5:47 Sam James
2018-02-20 20:39 Thomas Deutschmann
2017-01-27 13:34 Thomas Deutschmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox