Сравнение kea-2.6.3 с kea-3.0.2

/usr/portage/net-misc/kea/kea-3.0.2.ebuild 2025-12-11 18:18:04.701773793 +0300
4 4
EAPI=8
5 5

  
6 6
PYTHON_COMPAT=( python3_{11..14} )
7
inherit autotools eapi9-ver flag-o-matic python-r1 systemd tmpfiles
7
inherit eapi9-ver flag-o-matic meson python-r1 systemd tmpfiles toolchain-funcs
8 8

  
9 9
DESCRIPTION="High-performance production grade DHCPv4 & DHCPv6 server"
10 10
HOMEPAGE="https://www.isc.org/kea/"
11 11

  
12
if [[ ${PV} == *9999* ]]; then
12
if [[ ${PV} == 9999 ]]; then
13 13
	inherit git-r3
14 14
	EGIT_REPO_URI="https://gitlab.isc.org/isc-projects/kea.git"
15 15
else
16
	SRC_URI="https://downloads.isc.org/isc/kea/${PV}/${P}.tar.gz"
17
	KEYWORDS="amd64 ~arm64 ~x86"
16
	SRC_URI="
17
		https://downloads.isc.org/isc/kea/${PV}/${P}.tar.xz
18
		!doc? ( https://codeberg.org/peter1010/kea-manpages/archive/kea-manpages-${PV}.tar.gz )
19
	"
20
	KEYWORDS="amd64 arm arm64 ~x86"
18 21
fi
19 22

  
20 23
LICENSE="MPL-2.0"
21 24
SLOT="0"
22
IUSE="debug doc mysql +openssl postgres shell test"
25
IUSE="debug doc kerberos mysql +openssl postgres shell test"
23 26

  
24 27
REQUIRED_USE="shell? ( ${PYTHON_REQUIRED_USE} )"
25 28
RESTRICT="!test? ( test )"
......
27 30
COMMON_DEPEND="
28 31
	>=dev-libs/boost-1.66:=
29 32
	dev-libs/log4cplus:=
33
	kerberos? ( virtual/krb5 )
30 34
	mysql? (
31 35
		app-arch/zstd:=
32 36
		dev-db/mysql-connector-c:=
33 37
		dev-libs/openssl:=
34 38
		virtual/zlib:=
35 39
	)
36
	!openssl? ( dev-libs/botan:2=[boost] )
40
	!openssl? ( dev-libs/botan:3=[boost] )
37 41
	openssl? ( dev-libs/openssl:0= )
38 42
	postgres? ( dev-db/postgresql:* )
39 43
	shell? ( ${PYTHON_DEPS} )
......
46 50
	acct-user/dhcp
47 51
"
48 52
BDEPEND="
53
	>=dev-build/meson-1.8
49 54
	doc? (
50 55
		$(python_gen_any_dep '
51 56
			dev-python/sphinx[${PYTHON_USEDEP}]
......
53 58
		')
54 59
	)
55 60
	virtual/pkgconfig
61
	${PYTHON_DEPS}
56 62
"
57 63

  
58 64
PATCHES=(
59
	"${FILESDIR}"/${PN}-2.2.0-openssl-version.patch
65
	"${FILESDIR}"/kea-3.0.1-boost-1.89.patch
60 66
)
61 67

  
62 68
python_check_deps() {
......
66 72
}
67 73

  
68 74
pkg_setup() {
69
	if use doc || use shell; then
70
		python_setup
71
	fi
75
	python_setup
72 76
}
73 77

  
74 78
src_prepare() {
75 79
	default
76 80

  
77
	# set shebang before autotools
78
	if use shell; then
79
		sed -e 's:^#!@PYTHON@:#!/usr/bin/env python3:' \
80
			-i src/bin/shell/kea-shell.in || die
81
	fi
82

  
83
	# fix gtest detection
84
	sed -e "s:dir/lib/:dir/$(get_libdir)/:" \
85
		-i m4macros/ax_gtest.m4 || die
86

  
87
	# skip shell tests that fail to launch daemon in sandbox
88
	# may fail to find a suitable interface for generating a DUID-LLT
89
	sed -e '/TESTS += $(SHTESTS)$/d' \
90
		-i src/bin/dhcp4/tests/Makefile.am \
91
		-i src/bin/dhcp6/tests/Makefile.am || die
92
	sed -e '/TESTS = $(SHTESTS)$/d' \
93
		-i src/bin/keactrl/tests/Makefile.am || die
94

  
95
	# skip shell tests that require a running instance of MySQL
96
	if use mysql; then
97
		sed -e "/SHTESTS += mysql_tests.sh$/d" \
98
			-i src/bin/admin/tests/Makefile.am || die
99
	fi
100

  
101
	# skip shell tests that require a running instance of PgSQL
102
	if use postgres; then
103
		sed -e "/SHTESTS += pgsql_tests.sh$/d" \
104
			-i src/bin/admin/tests/Makefile.am || die
105
	fi
81
	# Fix up all doc paths, whether or not we are installing full set of docs
82
	sed -e "s:'doc/kea':'doc/${PF}':" \
83
		-i meson.build || die
84
	sed -e "s:'share/doc/kea':'share/doc/${PF}':" \
85
		-i doc/meson.build || die
86
	sed -e "s:'doc/kea':'doc/${PF}':" \
87
		-i doc/sphinx/meson.build || die
88
	sed -e "s:share/doc/kea/:share/doc/${PF}/:" \
89
		-i doc/sphinx/arm/install.rst || die
90
	sed -e "s:share/doc/kea/examples:share/doc/${PF}/examples:" \
91
		-i doc/sphinx/arm/config.rst || die
92

  
93
	# set shebang before meson whether or not we are installing the shell
94
	sed -e 's:^#!@PYTHON@:#!/usr/bin/env python3:' \
95
		-i src/bin/shell/kea-shell.in || die
96

  
97
	# Don't allow meson to install shell, we shall do that if required
98
	sed -e 's:install\: true:install\: false:' \
99
		-i src/bin/shell/meson.build || die
106 100

  
107 101
	# do not create /run
108
	sed -e '/$(DESTDIR)${runstatedir}/d' \
109
		-i Makefile.am || die
110

  
111
	eautoreconf
102
	sed -e '/^install_emptydir(RUNSTATEDIR)$/d' \
103
		-i meson.build || die
112 104
}
113 105

  
114 106
src_configure() {
115
	# -Werror=odr
116 107
	# https://bugs.gentoo.org/861617
108
	# https://gitlab.isc.org/isc-projects/kea/-/issues/3946
117 109
	#
118
	# I would truly love to submit an upstream bug but their self-hosted gitlab
119
	# won't let me sign up. -- Eli
110
	# Kea Devs say no to LTO
120 111
	filter-lto
121 112

  
122
	local myeconfargs=(
123
		--disable-install-configurations
124
		--disable-rpath
125
		# manually installed
126
		--disable-shell
127
		--disable-static
128
		--enable-generate-messages
129
		--enable-logger-checks
130
		--enable-perfdhcp
113
	if use !openssl; then
114
		append-cxxflags -std=c++20
115
	fi
116

  
117
	local emesonargs=(
131 118
		--localstatedir="${EPREFIX}/var"
132
		--runstatedir="${EPREFIX}/run"
133
		--without-werror
134
		--with-log4cplus
135
		$(use_enable debug)
136
		$(use_enable doc generate-docs)
137
		$(use_with mysql)
138
		$(use_with openssl)
139
		$(use_with postgres pgsql)
140
		$(usev test --with-gtest="${EPREFIX}/usr")
119
		-Drunstatedir="${EPREFIX}/run"
120
		$(meson_feature kerberos krb5)
121
		-Dnetconf=disabled
122
		-Dcrypto=$(usex openssl openssl botan)
123
		$(meson_feature mysql)
124
		$(meson_feature postgres postgresql)
125
		$(meson_feature test tests)
141 126
	)
142
	econf "${myeconfargs[@]}"
127
	if use debug; then
128
		emesonargs+=(
129
			--debug
130
		)
131
	fi
132
	meson_src_configure
143 133
}
144 134

  
145
src_test() {
146
	local GTEST_SKIP_TESTS=(
147
		# may fail when checking addresses on detected interfaces
148
		IfaceMgrTest*
149

  
150
		# may fail to find a suitable interface for generating a DUID-LLT
151
		JSONFileBackendTest*
152
		CtrlChannelDhcpv6SrvTest*
135
src_compile() {
136
	meson_src_compile
153 137

  
154
		# require srv_config_marker_file.txt similarly generated by a disabled test
155
		LoadUnloadDhcpv6SrvTest*
156
	)
138
	use doc && meson_src_compile doc
139
}
157 140

  
158
	# tests that require a running instance of MySQL
159
	use mysql && GTEST_SKIP_TESTS+=(
160
		*MySql*
161
		*MySQL*
162
		# conditional tests for MySQL
163
		Dhcpv*SrvTest.checkConfigFiles
141
src_test() {
142
	# Get list of all test suites into an associative array
143
	# the meson test --list returns either "kea / test_suite", "kea:shell-tests / test_suite" or
144
	# "kea:python-tests / test_suite"
145
	# Discard the shell tests as we can't run shell tests in sandbox
146

  
147
	pushd "${BUILD_DIR}" || die
148
	local -A TEST_SUITES
149
	while IFS=" / " read -r subsystem test_suite ; do
150
		if [[ ${subsystem} != "kea:shell-tests" ]]; then
151
			TEST_SUITES["$test_suite"]=1
152
		fi
153
	done < <(meson test --list || die)
154
	popd
155

  
156
	# Some other tests will fail for interface access restrictions, we have to remove the test suites those tests
157
	# belong to
158
	local SKIP_TESTS=(
159
		dhcp-radius-tests
160
		kea-log-buffer_logger_test.sh
161
		kea-log-console_test.sh
162
		dhcp-lease-query-tests
163
		kea-dhcp6-tests
164
		kea-dhcp4-tests
165
		kea-dhcp-tests
164 166
	)
165 167

  
166
	# tests that require a running instance of PgSQL
167
	use postgres && GTEST_SKIP_TESTS+=(
168
		*PgSql*
169
		*PgSQL*
170
		# conditional tests for PgSQL
171
		Dhcpv*SrvTest.checkConfigFiles
172
	)
168
	# skip shell tests that require a running instance of MySQL
169
	if use mysql; then
170
		SKIP_TESTS+=(
171
			kea-mysql-tests
172
			dhcp-mysql-lib-tests
173
			dhcp-forensic-log-libloadtests
174
		)
175
	fi
173 176

  
174
	local -x GTEST_FILTER
175
	[[ -n ${GTEST_SKIP_TESTS[*]} ]] && GTEST_FILTER+="-$( IFS=':'; echo "${GTEST_SKIP_TESTS[*]}")"
177
	# skip shell tests that require a running instance of PgSQL
178
	if use postgres; then
179
		SKIP_TESTS+=(
180
			kea-pgsql-tests
181
			dhcp-pgsql-lib-tests
182
			dhcp-forensic-log-libloadtests
183
		)
184
	fi
176 185

  
177
	default
186
	if use kerberos; then
187
		SKIP_TESTS+=(
188
			ddns-gss-tsig-tests
189
		)
190
	fi
191

  
192
	if [[ $(tc-get-ptr-size) -eq 4 ]]; then
193
		# see https://bugs.gentoo.org/958171 for reason for skipping these tests
194
		SKIP_TESTS+=(
195
			kea-util-tests
196
			kea-dhcpsrv-tests
197
			dhcp-ha-lib-tests
198
			kea-d2-tests
199
		)
200
	fi
201

  
202
	for SKIP in ${SKIP_TESTS[@]}; do
203
		unset TEST_SUITES["${SKIP}"]
204
	done
205

  
206
	meson_src_test ${!TEST_SUITES[@]}
178 207
}
179 208

  
180 209
install_shell() {
181
	python_domodule src/bin/shell/*.py
182
	python_doscript src/bin/shell/kea-shell
210
	python_domodule ${ORIG_BUILD_DIR}/src/bin/shell/*.py
211
	python_doscript ${ORIG_BUILD_DIR}/src/bin/shell/kea-shell
183 212

  
184 213
	# fix path to import kea modules
185 214
	sed -e "/^sys.path.append/s|(.*)|('$(python_get_sitedir)/${PN}')|"	\
......
187 216
}
188 217

  
189 218
src_install() {
190
	emake -j1 install DESTDIR="${D}"
219
	meson_install
220

  
221
	# Tidy up
222
	rm -r "${ED}"/usr/share/kea/meson-info || die
223
	if use !mysql; then
224
		rm -r "${ED}"/usr/share/kea/scripts/mysql || die
225
	fi
226
	if use !postgres; then
227
		rm -r "${ED}"/usr/share/kea/scripts/pgsql || die
228
	fi
229

  
230
	# No easy way to control how meson_install sets permissions in meson < 1.9
231
	# So make sure permissions are same as in previous versions of kea
232
	# To avoid any differences between an update vers first time install
233
	fperms -R 0755 /usr/sbin
234
	fperms -R 0755 /usr/bin
235
	fperms -R 0755 /usr/$(get_libdir)
191 236

  
192 237
	if use shell; then
193 238
		python_moduleinto ${PN}
194
		python_foreach_impl install_shell
239
		ORIG_BUILD_DIR=${BUILD_DIR} python_foreach_impl install_shell
195 240
	fi
196 241

  
197
	dodoc -r doc/examples
198

  
199
	rm -f "${ED}"/usr/share/doc/${P}/COPYING
242
	# We don't use keactrl.conf so move to reduce confusion
243
	mv "${ED}"/etc/${PN}/keactrl.conf "${ED}"/usr/share/doc/${PF}/examples/keactrl.conf || die
200 244

  
201
	diropts -m 0750 -o root -g dhcp
202
	dodir /etc/kea
203
	insopts -m 0640 -o root -g dhcp
204
	insinto /etc/kea
205
	newins doc/examples/agent/comments.json kea-ctrl-agent.conf.sample
206
	newins doc/examples/kea6/simple.json kea-dhcp6.conf.sample
207
	newins doc/examples/kea4/single-subnet.json kea-dhcp4.conf.sample
208
	newins doc/examples/ddns/comments.json kea-dhcp-ddns.conf.sample
245
	fowners -R root:dhcp /etc/${PN}
209 246

  
210
	# set log to syslog by default
211
	sed -e 's/"output": "stdout"/"output": "syslog"/' \
212
		-i "${ED}"/etc/kea/*.conf.sample || die
247
	# Install a conf per service and a linked init script per service
248
	newinitd "${FILESDIR}"/${PN}-initd-r3 ${PN}
249
	local svc
250
	for svc in dhcp4 dhcp6 dhcp-ddns ctrl-agent; do
251
		newconfd "${FILESDIR}"/${PN}-confd-r3 kea-${svc}
252
		sed -e "s:@KEA_SVC@:${svc}:g" \
253
			-i "${ED}"/etc/conf.d/kea-${svc} || die
254
		dosym kea "${EPREFIX}"/etc/init.d/kea-${svc}
255
	done
213 256

  
214
	newconfd "${FILESDIR}"/${PN}-confd-r2 ${PN}
215
	newinitd "${FILESDIR}"/${PN}-initd-r2 ${PN}
257
	if use !doc; then
258
		doman "${WORKDIR}"/kea-manpages/man/*
259
	fi
216 260

  
217
	systemd_dounit "${FILESDIR}"/${PN}-ctrl-agent.service-r2
218
	systemd_dounit "${FILESDIR}"/${PN}-dhcp-ddns.service-r2
219
	systemd_dounit "${FILESDIR}"/${PN}-dhcp4.service-r2
220
	systemd_dounit "${FILESDIR}"/${PN}-dhcp6.service-r2
261
	systemd_newunit "${FILESDIR}"/${PN}-ctrl-agent.service-r2 ${PN}-ctrl-agent.service
262
	systemd_newunit "${FILESDIR}"/${PN}-dhcp-ddns.service-r2 ${PN}-dhcp-ddns.service
263
	systemd_newunit "${FILESDIR}"/${PN}-dhcp4.service-r2 ${PN}-dhcp4.service
264
	systemd_newunit "${FILESDIR}"/${PN}-dhcp6.service-r2 ${PN}-dhcp6.service
221 265

  
222 266
	newtmpfiles "${FILESDIR}"/${PN}.tmpfiles.conf ${PN}.conf
223 267

  
224 268
	keepdir /var/lib/${PN} /var/log/${PN}
225 269
	fowners -R dhcp:dhcp /var/lib/${PN} /var/log/${PN}
226 270
	fperms 750 /var/lib/${PN} /var/log/${PN}
227

  
228
	find "${ED}" -type f -name "*.la" -delete || die
229 271
}
230 272

  
231 273
pkg_postinst() {
......
245 287
		ewarn "Please check your configuration!"
246 288
	fi
247 289

  
290
	if ver_replacing -lt 3.0; then
291
		ewarn "Make sure that ${EPREFIX}/var/lib/kea and all the files in it are owned by dhcp:"
292
		ewarn "chown -R dhcp:dhcp ${EPREFIX}/var/lib/kea"
293
		ewarn
294
		ewarn "If using openrc;"
295
		ewarn "  There are now separate conf.d scripts and associated init.d per daemon!"
296
		ewarn "    Each Daemon needs to be launched separately, i.e. the daemons are"
297
		ewarn "      kea-dhcp4"
298
		ewarn "      kea-dhcp6"
299
		ewarn "      kea-dhcp-ddns"
300
		ewarn "      kea-ctrl"
301
		ewarn "Please adjust your service startups appropriately"
302
	fi
303

  
248 304
	if ! has_version net-misc/kea; then
249
		elog "See config files in:"
250
		elog "  ${EROOT}/etc/kea/*.sample"
305
		elog "See examples of config files in:"
251 306
		elog "  ${EROOT}/usr/share/doc/${PF}/examples"
252 307
	fi
253 308
}
Спасибо!