commit: a7dcb4d2107d22f9a12d597c294c82d8fcfe8559 Author: Nicolas PARLANT <nicolas.parlant <AT> parhuet <DOT> fr> AuthorDate: Fri Dec 13 22:40:25 2024 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Dec 30 14:03:02 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a7dcb4d2
net-dns/knot: add python/prometheus support Add support for: * Libknot API in Python : a Python interface for managing the Knot DNS daemon. * knot-exporter : A Prometheus exporter for Knot DNS's server and query statistics. Signed-off-by: Nicolas PARLANT <nicolas.parlant <AT> parhuet.fr> Closes: https://github.com/gentoo/gentoo/pull/39906 Signed-off-by: Sam James <sam <AT> gentoo.org> .../{knot-3.4.3-r1.ebuild => knot-3.4.3-r2.ebuild} | 36 ++++++++++++++++++++-- net-dns/knot/metadata.xml | 3 ++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/net-dns/knot/knot-3.4.3-r1.ebuild b/net-dns/knot/knot-3.4.3-r2.ebuild similarity index 78% rename from net-dns/knot/knot-3.4.3-r1.ebuild rename to net-dns/knot/knot-3.4.3-r2.ebuild index 348eb7571ad6..7802470727a0 100644 --- a/net-dns/knot/knot-3.4.3-r1.ebuild +++ b/net-dns/knot/knot-3.4.3-r2.ebuild @@ -3,7 +3,9 @@ EAPI=8 -inherit flag-o-matic systemd tmpfiles +PYTHON_COMPAT=( python3_{10..13} ) + +inherit python-single-r1 flag-o-matic systemd tmpfiles # subslot: libknot major.libdnssec major.libzscanner major KNOT_SUBSLOT="15.9.4" @@ -33,8 +35,12 @@ KNOT_MODULES=( "+whoami" ) -IUSE="caps +daemon dbus +doc doh +fastparser +idn pkcs11 quic systemd test +utils xdp ${KNOT_MODULES[@]}" +IUSE="caps +daemon dbus +doc doh +fastparser +idn pkcs11 prometheus python quic systemd test +utils xdp ${KNOT_MODULES[@]}" RESTRICT="!test? ( test )" +REQUIRED_USE=" + prometheus? ( python ) + python? ( ${PYTHON_REQUIRED_USE} ) +" COMMON_DEPEND=" dev-libs/libedit @@ -62,6 +68,13 @@ RDEPEND=" doh? ( net-libs/nghttp2:= ) idn? ( net-dns/libidn2:= ) ) + python? ( ${PYTHON_DEPS} ) + prometheus? ( + $(python_gen_cond_dep ' + dev-python/prometheus-client[${PYTHON_USEDEP}] + dev-python/psutil[${PYTHON_USEDEP}] + ') + ) xdp? ( >=dev-libs/libbpf-1.0:= net-libs/xdp-tools @@ -72,6 +85,9 @@ DEPEND="${RDEPEND}" BDEPEND=" virtual/pkgconfig doc? ( dev-python/sphinx ) + python? ( + ${PYTHON_DEPS} + ) test? ( pkcs11? ( dev-libs/softhsm ) ) @@ -81,6 +97,10 @@ BDEPEND=" # False positive because linux have sched.h too but with cpu_set_t QA_CONFIG_IMPL_DECL_SKIP=( cpuset_create cpuset_destroy ) +pkg_setup() { + use python && python-single-r1_pkg_setup +} + src_prepare() { # https://gitlab.nic.cz/knot/knot-dns/-/issues/946 cat > tests/contrib/test_atomic.c <<-_EOF_ || die @@ -149,6 +169,18 @@ src_compile() { src_install() { use doc && local HTML_DOCS=( doc/_build/html/{*.html,*.js,_sources,_static} ) + if use python; then + python_domodule python/libknot/libknot + newdoc python/libknot/README.md README.python.md + fi + + if use prometheus; then + python_domodule python/knot_exporter/knot_exporter + python_scriptinto /usr/sbin + python_newscript python/knot_exporter/knot_exporter/knot_exporter.py knot-exporter + newdoc python/knot_exporter/README.md README.knot_exporter.md + fi + default if use daemon; then diff --git a/net-dns/knot/metadata.xml b/net-dns/knot/metadata.xml index eb4839a1be64..6544e399dce4 100644 --- a/net-dns/knot/metadata.xml +++ b/net-dns/knot/metadata.xml @@ -51,6 +51,9 @@ <flag name="pkcs11"> Add support for PKCS#11 </flag> + <flag name="prometheus"> + A Prometheus exporter for server and query statistics. + </flag> <flag name="queryacl"> Enable the module for query access control </flag>
