blob: 6ef4cbb64fd073be913c76fd706290a753f7416e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
LUA_COMPAT=( luajit )
DISTUTILS_EXT=1
DISTUTILS_OPTIONAL=1
DISTUTILS_SINGLE_IMPL=1
DISTUTILS_USE_PEP517=poetry
# waiting app-admin/supervisor for py3_13
PYTHON_COMPAT=( python3_{10..12} )
inherit distutils-r1 lua-single meson tmpfiles verify-sig
DESCRIPTION="A scaleable caching DNS resolver"
HOMEPAGE="https://www.knot-resolver.cz https://gitlab.nic.cz/knot/knot-resolver"
SRC_URI="
https://knot-resolver.nic.cz/release/${P}.tar.xz
verify-sig? ( https://knot-resolver.nic.cz/release/${P}.tar.xz.asc )
"
LICENSE="Apache-2.0 BSD CC0-1.0 GPL-3+ LGPL-2.1+ MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="caps dnstap jemalloc +manager nghttp2 prometheus systemd test xdp"
RESTRICT="!test? ( test )"
REQUIRED_USE="
${LUA_REQUIRED_USE}
manager? ( ${PYTHON_REQUIRED_USE} )
"
RDEPEND="
${LUA_DEPS}
acct-group/knot-resolver
acct-user/knot-resolver
dev-db/lmdb:=
dev-libs/libuv:=
>=net-dns/knot-3.3:=[xdp?]
net-libs/gnutls:=
caps? ( sys-libs/libcap-ng )
dnstap? (
dev-libs/fstrm
dev-libs/protobuf-c:=
)
jemalloc? ( dev-libs/jemalloc:= )
manager? (
${PYTHON_DEPS}
$(python_gen_cond_dep '
app-admin/supervisor[${PYTHON_USEDEP}]
dev-python/aiohttp[${PYTHON_USEDEP}]
dev-python/jinja2[${PYTHON_USEDEP}]
dev-python/pyyaml[${PYTHON_USEDEP}]
dev-python/typing-extensions[${PYTHON_USEDEP}]
prometheus? ( dev-python/prometheus-client[${PYTHON_USEDEP}] )
')
)
nghttp2? ( net-libs/nghttp2:= )
systemd? ( sys-apps/systemd:= )
"
DEPEND="
${RDEPEND}
test? (
dev-util/cmocka
manager? (
$(python_gen_cond_dep '
dev-python/pyparsing[${PYTHON_USEDEP}]
dev-python/pytest-asyncio[${PYTHON_USEDEP}]
dev-python/tomli[${PYTHON_USEDEP}]
')
)
)
"
BDEPEND="
virtual/pkgconfig
manager? (
${DISTUTILS_DEPS}
${PYTHON_DEPS}
)
verify-sig? ( >=sec-keys/openpgp-keys-knot-resolver-20240304 )
"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/${PN}.gpg
PATCHES=(
"${FILESDIR}"/${PN}-5.5.3-docdir.patch
"${FILESDIR}"/${PN}-5.5.3-nghttp-openssl.patch
"${FILESDIR}"/${PN}-6.0.9-libsystemd.patch
"${FILESDIR}"/${PN}-6.0.9-config-example.patch
"${FILESDIR}"/${PN}-6.0.9-sd_notify_alt.patch
"${FILESDIR}"/${PN}-6.0.9-pytest_tomli.patch
)
pkg_setup() {
lua-single_pkg_setup
use manager && python-single-r1_pkg_setup
}
src_prepare() {
default
use manager && distutils-r1_src_prepare
}
src_configure() {
local emesonargs=(
--localstatedir "${EPREFIX}"/var # double lib
# https://bugs.gentoo.org/870019
-Dauto_features=disabled
# requires non-gentoo lua modules (basexx, cqueues)
-Dconfig_tests=disabled
-Ddoc=disabled
-Ddocdir="${EPREFIX}"/usr/share/doc/${PF}
-Dinstall_kresd_conf=enabled
-Dopenssl=disabled
-Dmalloc=$(usex jemalloc jemalloc disabled)
-Dsystemd_files=enabled
$(meson_feature caps capng)
$(meson_feature dnstap)
$(meson_feature nghttp2)
$(meson_feature systemd)
$(meson_feature systemd systemd_legacy_units)
$(meson_feature test unit_tests)
)
meson_src_configure
}
src_compile() {
meson_src_compile
use manager && distutils-r1_src_compile
}
src_test() {
meson_src_test
use manager && distutils-r1_src_test
}
python_test() {
epytest tests/manager
}
src_install() {
meson_src_install
if use manager; then
distutils-r1_src_install
newinitd "${FILESDIR}"/knot-resolver.initd knot-resolver
newconfd "${FILESDIR}"/knot-resolver.confd knot-resolver
else
rm "${ED}"/usr/lib/systemd/system/knot-resolver.service || die
fi
fowners -R ${PN}: /etc/${PN}
newinitd "${FILESDIR}"/kresd.initd-r2 kresd
newconfd "${FILESDIR}"/kresd.confd-r1 kresd
newinitd "${FILESDIR}"/kres-cache-gc.initd kres-cache-gc
}
pkg_postinst() {
tmpfiles_process knot-resolver.conf
if use manager; then
elog "You choose the new way, called the manager, to start Knot Resolver :"
use systemd && elog " systemctl start knot-resolver.service"
use !systemd && elog " /etc/init.d/knot-resolver start"
elog "Configuration file : /etc/knot-resolver/config.yaml"
elog ""
elog "The older way, without the manager, is still available :"
else
elog "You choose the older way, without the manager, to start Knot Resolver :"
fi
use systemd && elog " systemctl start kresd@N.service"
use !systemd && elog " /etc/init.d/kresd start"
elog "Configuration file : /etc/knot-resolver/kresd.conf"
elog ""
elog "Optional garbage collector : /etc/init.d/kres-cache-gc"
elog ""
use !manager && elog "The new way is available with the useflag manager."
}
|