commit: 184877b01fd79cd7b2fd5093b09edd3c46f7e2b1 Author: Peter Leese <inbox <AT> peterleese <DOT> org> AuthorDate: Sun Aug 3 22:27:08 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Thu Aug 21 01:01:28 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=184877b0
net-misc/kea: add 3.0.0 Bug: https://bugs.gentoo.org/960312 Signed-off-by: Peter Leese <inbox <AT> peterleese.org> Part-of: https://github.com/gentoo/gentoo/pull/43307 Signed-off-by: Sam James <sam <AT> gentoo.org> net-misc/kea/Manifest | 1 + net-misc/kea/files/kea-3.0.0-strip-doc.patch | 58 ++++++ net-misc/kea/kea-3.0.0.ebuild | 271 +++++++++++++++++++++++++++ 3 files changed, 330 insertions(+) diff --git a/net-misc/kea/Manifest b/net-misc/kea/Manifest index 7df985e17e38..eee6ab6179f9 100644 --- a/net-misc/kea/Manifest +++ b/net-misc/kea/Manifest @@ -1,2 +1,3 @@ DIST kea-2.6.3.tar.gz 10498882 BLAKE2B 7a8549ceb86dccaa2ca8d541cbfd27618ccf8aeedfb8ff26f9d0e10cfd8a103efd70320a55dc318a84094a7764c560c100cf6e10421ae6d40e6c62891570c604 SHA512 d7781c0b95529bfe89c19615c1dd5952fd4c4b60274e187a641992dad81ef5af921dfb15050ec43169a0c2ad267639642b2e294c5d43405f85a5fb11bb1a939a DIST kea-2.6.4.tar.gz 10498705 BLAKE2B 491a73dd0d4f7ffc068642d14a597158b70a5e6042967fd1f367f3269dd84bc4f1526b4158c7da8a474e385528b74985ac542c1591c458c6a0df42fc627b612d SHA512 f4dce03a30ba5c0a1a0d97730d7cccc0876188fb7d165e8f67cf4df906cdf157049d651d0a38b3a01f33e5b0ac7b9e8b5b479543e06c89da197d6ef9d0937a18 +DIST kea-3.0.0.tar.xz 6631612 BLAKE2B 1d08d226b2e8523355c734968032ffa30035b6daebe4b9ce2db45fee887100d54b422f7cb8771d1e7b0b04e0f13329b8ddd03c4e7b81e73bd60f2435623ccd89 SHA512 1a01a449907fe5f68c918504aa952d3991fe02d7944a1fc70f13316eb075ca1348e85386d387730347d599c229454b926089300407eae8bce0215b64fef077f2 diff --git a/net-misc/kea/files/kea-3.0.0-strip-doc.patch b/net-misc/kea/files/kea-3.0.0-strip-doc.patch new file mode 100644 index 000000000000..93764e1a01f7 --- /dev/null +++ b/net-misc/kea/files/kea-3.0.0-strip-doc.patch @@ -0,0 +1,58 @@ +To build man pages we need to invoke meson, but this also builds the html which +we don't want if doc flag is not set, so patch make & install and remove +html & pdf generation + +--- a/doc/sphinx/install-docs.sh.in ++++ b/doc/sphinx/install-docs.sh.in +@@ -22,11 +22,5 @@ + docdir="${target_path}/@docdir@" + mandir8="${target_path}/@mandir8@" + +-mkdir -p "${docdir}/html" +-cp -r '@abs_sphinxbuilddir@/html'/* "${docdir}/html" +-if test '@HAVE_PDFLATEX@' != 'no'; then +- @INSTALL@ -c -m 644 @abs_sphinxbuilddir@/latex/kea-arm.pdf "${docdir}" +- @INSTALL@ -c -m 644 @abs_sphinxbuilddir@/latex/kea-messages.pdf "${docdir}" +-fi + mkdir -p "${mandir8}" + @INSTALL@ -c -m 644 @abs_sphinxbuilddir@/man/*.8 "${mandir8}" +--- a/doc/sphinx/make-doc.sh.in ++++ b/doc/sphinx/make-doc.sh.in +@@ -15,26 +15,7 @@ + rm -f '@srcdir@/arm/platforms.rst' + cp '@TOP_SOURCE_DIR@/platforms.rst' '@srcdir@/arm/platforms.rst' + +-# html +-@SPHINXBUILD@ -M html @srcdir@ @sphinxbuilddir@ @sphinxopts@ +- +-# singlehtml +-@SPHINXBUILD@ -M singlehtml @srcdir@ @sphinxbuilddir@ @sphinxopts@ +- +-# text +-@SPHINXBUILD@ -M text @srcdir@ @sphinxbuilddir@ @sphinxopts@ + + # mans + @SPHINXBUILD@ -M man @srcdir@ @sphinxbuilddir@ @sphinxopts@ + +-# pdf +-if test '@HAVE_PDFLATEX@' != 'no'; then +- @SPHINXBUILD@ -M latex @srcdir@ @sphinxbuilddir@ @sphinxopts@ +- cd '@abs_sphinxbuilddir@/latex' +- @PDFLATEX_AND_OPTS@ kea-arm.tex +- makeindex -s python.ist kea-arm.idx +- @PDFLATEX_AND_OPTS@ kea-arm.tex +- @PDFLATEX_AND_OPTS@ kea-messages.tex +- makeindex -s python.ist kea-messages.idx +- @PDFLATEX_AND_OPTS@ kea-messages.tex +-fi +--- a/doc/sphinx/meson.build ++++ b/doc/sphinx/meson.build +@@ -145,8 +145,6 @@ + ) + + run_target('doc', command: [make_doc]) +-run_target('mes-doc', command: [make_mes_doc]) +-run_target('uml', command: [make_uml]) + run_target( + 'update-python-dependencies', + command: [make_update_python_dependencies], diff --git a/net-misc/kea/kea-3.0.0.ebuild b/net-misc/kea/kea-3.0.0.ebuild new file mode 100644 index 000000000000..182dbd12d0d8 --- /dev/null +++ b/net-misc/kea/kea-3.0.0.ebuild @@ -0,0 +1,271 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..14} ) +inherit eapi9-ver flag-o-matic meson python-r1 systemd tmpfiles toolchain-funcs + +DESCRIPTION="High-performance production grade DHCPv4 & DHCPv6 server" +HOMEPAGE="https://www.isc.org/kea/" + +if [[ ${PV} == *9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="https://gitlab.isc.org/isc-projects/kea.git" +else + SRC_URI="https://downloads.isc.org/isc/kea/${PV}/${P}.tar.xz" + KEYWORDS="~amd64 ~arm ~arm64 ~x86" +fi + +LICENSE="MPL-2.0" +SLOT="0" +IUSE="debug doc mysql +openssl postgres shell test" + +REQUIRED_USE="shell? ( ${PYTHON_REQUIRED_USE} )" +RESTRICT="!test? ( test )" + +COMMON_DEPEND=" + >=dev-libs/boost-1.66:= + dev-libs/log4cplus:= + mysql? ( + app-arch/zstd:= + dev-db/mysql-connector-c:= + dev-libs/openssl:= + sys-libs/zlib:= + ) + !openssl? ( dev-libs/botan:2=[boost] ) + openssl? ( dev-libs/openssl:0= ) + postgres? ( dev-db/postgresql:* ) + shell? ( ${PYTHON_DEPS} ) +" +DEPEND="${COMMON_DEPEND} + test? ( dev-cpp/gtest ) +" +RDEPEND="${COMMON_DEPEND} + acct-group/dhcp + acct-user/dhcp +" +# For 3.0.0 sphinx is needs to build man pages which are always needed +# Note: In 2.6.x the man files came prebuilt in the tarball release file +BDEPEND=" + >=dev-build/meson-1.8 + $(python_gen_any_dep ' + dev-python/sphinx[${PYTHON_USEDEP}] + dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}] + ') + virtual/pkgconfig + ${PYTHON_DEPS} +" + +python_check_deps() { + python_has_version "dev-python/sphinx[${PYTHON_USEDEP}]" \ + "dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]" +} + +pkg_setup() { + python_setup +} + +src_prepare() { + # Remove building and install html documentation + if use !doc; then + PATCHES+=( "${FILESDIR}"/${P}-strip-doc.patch ) + fi + default + + # Fix up all doc paths, whether or not we are installing full set of docs + sed -e "s:'doc/kea':'doc/${PF}':" \ + -i meson.build || die + sed -e "s:'share/doc/kea':'share/doc/${PF}':" \ + -i doc/meson.build || die + sed -e "s:'doc/kea':'doc/${PF}':" \ + -i doc/sphinx/meson.build || die + sed -e "s:share/doc/kea/:share/doc/${PF}/:" \ + -i doc/sphinx/arm/install.rst || die + sed -e "s:share/doc/kea/examples:share/doc/${PF}/examples:" \ + -i doc/sphinx/arm/config.rst || die + + # set shebang before meson whether or not we are installing the shell + sed -e 's:^#!@PYTHON@:#!/usr/bin/env python3:' \ + -i src/bin/shell/kea-shell.in || die + + # Don't allow meson to install shell, we shall do that if required + sed -e 's:install\: true:install\: false:' \ + -i src/bin/shell/meson.build || die + + # do not create /run + sed -e '/^install_emptydir(RUNSTATEDIR)$/d' \ + -i meson.build || die +} + +src_configure() { + # https://bugs.gentoo.org/861617 + # https://gitlab.isc.org/isc-projects/kea/-/issues/3946 + # + # Kea Devs say no to LTO + filter-lto + + local emesonargs=( + --localstatedir="${EPREFIX}/var" + -Drunstatedir="${EPREFIX}/run" + -Dkrb5=disabled + -Dnetconf=disabled + -Dcrypto=$(usex openssl openssl botan) + $(meson_feature mysql) + $(meson_feature postgres postgresql) + $(meson_feature test tests) + ) + if use debug; then + emesonargs+=( + --debug + ) + fi + meson_src_configure +} + +src_compile() { + meson_src_compile + + # We have do doc target for man pages + meson_src_compile doc +} + +src_test() { + # Get list of all test suites into an associative array + # the meson test --list returns either "kea / test_suite", "kea:shell-tests / test_suite" or + # "kea:python-tests / test_suite" + # Discard the shell tests as we can't run shell tests in sandbox + + pushd "${BUILD_DIR}" || die + local -A TEST_SUITES + while IFS=" / " read -r subsystem test_suite ; do + if [[ ${subsystem} != "kea:shell-tests" ]]; then + TEST_SUITES["$test_suite"]=1 + fi + done < <(meson test --list || die) + popd + + # Some other tests will fail for interface access restrictions, we have to remove the test suites those tests + # belong to + local SKIP_TESTS=( + dhcp-radius-tests + kea-log-buffer_logger_test.sh + kea-log-console_test.sh + dhcp-lease-query-tests + kea-dhcp6-tests + kea-dhcp-tests + ) + + # skip shell tests that require a running instance of MySQL + if use mysql; then + SKIP_TESTS+=( + kea-mysql-tests + dhcp-mysql-lib-tests + dhcp-forensic-log-libloadtests + kea-dhcp4-tests + ) + fi + + # skip shell tests that require a running instance of PgSQL + if use postgres; then + SKIP_TESTS+=( + kea-pgsql-tests + dhcp-pgsql-lib-tests + dhcp-forensic-log-libloadtests + kea-dhcp4-tests + ) + fi + + if [[ $(tc-get-ptr-size) -eq 4 ]]; then + # see https://bugs.gentoo.org/958171 for reason for skipping these tests + SKIP_TESTS+=( + kea-util-tests + kea-dhcp4-tests + kea-dhcpsrv-tests + dhcp-ha-lib-tests + kea-d2-tests + ) + fi + + for SKIP in ${SKIP_TESTS[@]}; do + unset TEST_SUITES["${SKIP}"] + done + + meson_src_test ${!TEST_SUITES[@]} +} + +install_shell() { + python_domodule ${ORIG_BUILD_DIR}/src/bin/shell/*.py + python_doscript ${ORIG_BUILD_DIR}/src/bin/shell/kea-shell + + # fix path to import kea modules + sed -e "/^sys.path.append/s|(.*)|('$(python_get_sitedir)/${PN}')|" \ + -i "${ED}"/usr/lib/python-exec/${EPYTHON}/kea-shell || die +} + +src_install() { + meson_install + + # Tidy up + rm -r "${ED}"/usr/share/kea/meson-info || die + if use !mysql; then + rm -r "${ED}"/usr/share/kea/scripts/mysql || die + fi + if use !postgres; then + rm -r "${ED}"/usr/share/kea/scripts/pgsql || die + fi + + # No easy way to control how meson_install sets permissions in meson < 1.9 + # So make sure permissions are same as in previous versions of kea + # To avoid any differences between an update vers first time install + fperms -R 0755 /usr/sbin + fperms -R 0755 /usr/bin + fperms -R 0755 /usr/$(get_libdir) + + if use shell; then + python_moduleinto ${PN} + ORIG_BUILD_DIR=${BUILD_DIR} python_foreach_impl install_shell + fi + + # We don't use keactrl.conf so move to reduce confusion + mv "${ED}"/etc/${PN}/keactrl.conf "${ED}"/usr/share/doc/${PF}/examples/keactrl.conf || die + + fowners -R root:dhcp /etc/${PN} + + newconfd "${FILESDIR}"/${PN}-confd-r2 ${PN} + newinitd "${FILESDIR}"/${PN}-initd-r2 ${PN} + + systemd_newunit "${FILESDIR}"/${PN}-ctrl-agent.service-r2 ${PN}-ctrl-agent.service + systemd_newunit "${FILESDIR}"/${PN}-dhcp-ddns.service-r2 ${PN}-dhcp-ddns.service + systemd_newunit "${FILESDIR}"/${PN}-dhcp4.service-r2 ${PN}-dhcp4.service + systemd_newunit "${FILESDIR}"/${PN}-dhcp6.service-r2 ${PN}-dhcp6.service + + newtmpfiles "${FILESDIR}"/${PN}.tmpfiles.conf ${PN}.conf + + keepdir /var/lib/${PN} /var/log/${PN} + fowners -R dhcp:dhcp /var/lib/${PN} /var/log/${PN} + fperms 750 /var/lib/${PN} /var/log/${PN} +} + +pkg_postinst() { + tmpfiles_process ${PN}.conf + + if ver_replacing -lt 2.6; then + ewarn "Several changes have been made for daemons:" + ewarn " To comply with common practices for this package," + ewarn " config paths by default has been changed as below:" + ewarn " /etc/kea/kea-dhcp4.conf" + ewarn " /etc/kea/kea-dhcp6.conf" + ewarn " /etc/kea/kea-dhcp-ddns.conf" + ewarn " /etc/kea/kea-ctrl-agent.conf" + ewarn + ewarn " Daemons are launched by default with the unprivileged user 'dhcp'" + ewarn + ewarn "Please check your configuration!" + fi + + if ! has_version net-misc/kea; then + elog "See examples of config files in:" + elog " ${EROOT}/usr/share/doc/${PF}/examples" + fi +}
