Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/networkmanager/
Date: Thu, 28 Oct 2021 03:22:29
Message-Id: 1635391295.bba90739cd6a491fb938ed38e1462975d720f583.sam@gentoo
1 commit: bba90739cd6a491fb938ed38e1462975d720f583
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 28 03:21:35 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 28 03:21:35 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bba90739
7
8 net-misc/networkmanager: fix resolvconf logic in Meson port (unkeyworded)
9
10 Thakns-to: July Tikhonov <july.tikh <AT> gmail.com>
11 Bug: https://bugs.gentoo.org/816210
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 .../networkmanager-1.32.12-r1.ebuild | 401 +++++++++++++++++++++
15 1 file changed, 401 insertions(+)
16
17 diff --git a/net-misc/networkmanager/networkmanager-1.32.12-r1.ebuild b/net-misc/networkmanager/networkmanager-1.32.12-r1.ebuild
18 new file mode 100644
19 index 00000000000..7cd23f0708c
20 --- /dev/null
21 +++ b/net-misc/networkmanager/networkmanager-1.32.12-r1.ebuild
22 @@ -0,0 +1,401 @@
23 +# Copyright 1999-2021 Gentoo Authors
24 +# Distributed under the terms of the GNU General Public License v2
25 +
26 +EAPI=7
27 +GNOME_ORG_MODULE="NetworkManager"
28 +VALA_USE_DEPEND="vapigen"
29 +PYTHON_COMPAT=( python3_{7..10} )
30 +
31 +inherit gnome.org linux-info meson-multilib python-any-r1 readme.gentoo-r1 systemd toolchain-funcs udev vala virtualx
32 +
33 +DESCRIPTION="A set of co-operative tools that make networking simple and straightforward"
34 +HOMEPAGE="https://wiki.gnome.org/Projects/NetworkManager"
35 +
36 +LICENSE="GPL-2+ LGPL-2.1+"
37 +SLOT="0"
38 +
39 +IUSE="audit bluetooth +concheck connection-sharing debug dhclient dhcpcd elogind gnutls +gtk-doc +introspection iptables iwd kernel_linux psl lto +nss nftables +modemmanager ofono ovs policykit +ppp resolvconf selinux syslog systemd teamd test +tools vala +wext +wifi"
40 +RESTRICT="!test? ( test )"
41 +
42 +REQUIRED_USE="
43 + bluetooth? ( modemmanager )
44 + connection-sharing? ( || ( iptables nftables ) )
45 + gtk-doc? ( introspection )
46 + iwd? ( wifi )
47 + vala? ( introspection )
48 + wext? ( wifi )
49 + ^^ ( gnutls nss )
50 + ?? ( elogind systemd )
51 + ?? ( dhclient dhcpcd )
52 + ?? ( syslog systemd )
53 +"
54 +
55 +# Unkeyworded given somewhat experimental changes for bug #816210
56 +#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~riscv ~sparc ~x86"
57 +
58 +COMMON_DEPEND="
59 + sys-apps/util-linux[${MULTILIB_USEDEP}]
60 + elogind? ( >=sys-auth/elogind-219 )
61 + >=virtual/libudev-175:=[${MULTILIB_USEDEP}]
62 + sys-apps/dbus
63 + net-libs/libndp
64 + systemd? ( >=sys-apps/systemd-209:0= )
65 + >=dev-libs/glib-2.40:2[${MULTILIB_USEDEP}]
66 + introspection? ( >=dev-libs/gobject-introspection-0.10.3:= )
67 + selinux? ( sys-libs/libselinux )
68 + audit? ( sys-process/audit )
69 + teamd? (
70 + >=dev-libs/jansson-2.7:=
71 + >=net-misc/libteam-1.9
72 + )
73 + policykit? ( >=sys-auth/polkit-0.106 )
74 + nss? ( >=dev-libs/nss-3.11:=[${MULTILIB_USEDEP}] )
75 + gnutls? (
76 + >=net-libs/gnutls-2.12:=[${MULTILIB_USEDEP}]
77 + )
78 + ppp? ( >=net-dialup/ppp-2.4.5:=[ipv6] )
79 + modemmanager? (
80 + net-misc/mobile-broadband-provider-info
81 + >=net-misc/modemmanager-0.7.991:0=
82 + )
83 + bluetooth? ( >=net-wireless/bluez-5 )
84 + ofono? ( net-misc/ofono )
85 + dhclient? ( >=net-misc/dhcp-4[client] )
86 + dhcpcd? ( >=net-misc/dhcpcd-9.3.3 )
87 + ovs? ( >=dev-libs/jansson-2.7:= )
88 + resolvconf? ( net-dns/openresolv )
89 + connection-sharing? (
90 + net-dns/dnsmasq[dbus,dhcp]
91 + iptables? ( net-firewall/iptables )
92 + nftables? ( net-firewall/nftables )
93 + )
94 + psl? ( net-libs/libpsl )
95 + concheck? ( net-misc/curl )
96 + tools? (
97 + sys-libs/readline:0=
98 + >=dev-libs/newt-0.52.15
99 + )
100 +"
101 +RDEPEND="${COMMON_DEPEND}
102 + acct-group/plugdev
103 + || (
104 + net-misc/iputils[arping(+)]
105 + net-analyzer/arping
106 + )
107 + wifi? (
108 + !iwd? ( >=net-wireless/wpa_supplicant-0.7.3-r3[dbus] )
109 + iwd? ( net-wireless/iwd )
110 + )
111 +"
112 +DEPEND="${COMMON_DEPEND}
113 + >=sys-kernel/linux-headers-3.18
114 + net-libs/libndp[${MULTILIB_USEDEP}]
115 +"
116 +BDEPEND="
117 + dev-util/gdbus-codegen
118 + dev-util/glib-utils
119 + gtk-doc? (
120 + dev-util/gtk-doc
121 + app-text/docbook-xml-dtd:4.1.2
122 + )
123 + >=dev-util/intltool-0.40
124 + >=sys-devel/gettext-0.17
125 + virtual/pkgconfig
126 + introspection? (
127 + $(python_gen_any_dep 'dev-python/pygobject:3[${PYTHON_USEDEP}]')
128 + dev-lang/perl
129 + dev-libs/libxslt
130 + )
131 + vala? ( $(vala_depend) )
132 + test? (
133 + >=dev-libs/jansson-2.7
134 + $(python_gen_any_dep '
135 + dev-python/dbus-python[${PYTHON_USEDEP}]
136 + dev-python/pygobject:3[${PYTHON_USEDEP}]')
137 + )
138 +"
139 +
140 +python_check_deps() {
141 + if use introspection; then
142 + has_version "dev-python/pygobject:3[${PYTHON_USEDEP}]" || return
143 + fi
144 + if use test; then
145 + has_version "dev-python/dbus-python[${PYTHON_USEDEP}]" &&
146 + has_version "dev-python/pygobject:3[${PYTHON_USEDEP}]"
147 + fi
148 +}
149 +
150 +sysfs_deprecated_check() {
151 + ebegin "Checking for SYSFS_DEPRECATED support"
152 +
153 + if { linux_chkconfig_present SYSFS_DEPRECATED_V2; }; then
154 + eerror "Please disable SYSFS_DEPRECATED_V2 support in your kernel config and recompile your kernel"
155 + eerror "or NetworkManager will not work correctly."
156 + eerror "See https://bugs.gentoo.org/333639 for more info."
157 + die "CONFIG_SYSFS_DEPRECATED_V2 support detected!"
158 + fi
159 + eend $?
160 +}
161 +
162 +pkg_pretend() {
163 + if use kernel_linux; then
164 + get_version
165 + if linux_config_exists; then
166 + sysfs_deprecated_check
167 + else
168 + ewarn "Was unable to determine your kernel .config"
169 + ewarn "Please note that if CONFIG_SYSFS_DEPRECATED_V2 is set in your kernel .config, NetworkManager will not work correctly."
170 + ewarn "See https://bugs.gentoo.org/333639 for more info."
171 + fi
172 + fi
173 +}
174 +
175 +pkg_setup() {
176 + if use connection-sharing; then
177 + if kernel_is lt 5 1; then
178 + CONFIG_CHECK="~NF_NAT_IPV4 ~NF_NAT_MASQUERADE_IPV4"
179 + else
180 + CONFIG_CHECK="~NF_NAT ~NF_NAT_MASQUERADE"
181 + fi
182 + linux-info_pkg_setup
183 + fi
184 +
185 + if use introspection || use test; then
186 + python-any-r1_pkg_setup
187 + fi
188 +
189 + # bug 809695
190 + if tc-is-clang && use lto; then
191 + eerror "Clang does not support -flto-partition"
192 + die "Please use gcc or turn off USE=lto flag when building with clang"
193 + fi
194 +}
195 +
196 +src_prepare() {
197 + DOC_CONTENTS="To modify system network connections without needing to enter the
198 + root password, add your user account to the 'plugdev' group."
199 +
200 + default
201 + use vala && vala_src_prepare
202 +
203 + sed -i \
204 + -e 's#/usr/bin/sed#/bin/sed#' \
205 + data/84-nm-drivers.rules \
206 + || die
207 +}
208 +
209 +meson_nm_program() {
210 + usex "$1" "-D${2:-$1}=$3" "-D${2:-$1}=no"
211 +}
212 +
213 +meson_nm_native_program() {
214 + multilib_native_usex "$1" "-D${2:-$1}=$3" "-D${2:-$1}=no"
215 +}
216 +
217 +multilib_src_configure() {
218 + local emesonargs=(
219 + --localstatedir="${EPREFIX}/var"
220 +
221 + -Dsystemdsystemunitdir=$(systemd_get_systemunitdir)
222 + -Dsystem_ca_path=/etc/ssl/certs
223 + -Dudev_dir=$(get_udevdir)
224 + -Ddbus_conf_dir=/usr/share/dbus-1/system.d
225 + -Dkernel_firmware_dir=/lib/firmware
226 + -Diptables=/sbin/iptables
227 + -Dnft=/sbin/nft
228 + -Ddnsmasq=/usr/sbin/dnsmasq
229 + #-Ddnssec_trigger=
230 +
231 + -Ddist_version=${PVR}
232 + $(meson_native_use_bool policykit polkit)
233 + $(meson_native_use_bool policykit config_auth_polkit_default)
234 + -Dmodify_system=true
235 + -Dpolkit_agent_helper_1=/usr/lib/polkit-1/polkit-agent-helper-1
236 + $(meson_native_use_bool selinux)
237 + $(meson_native_use_bool systemd systemd_journal)
238 + -Dhostname_persist=gentoo
239 + -Dlibaudit=$(multilib_native_usex audit)
240 +
241 + $(meson_native_use_bool wext)
242 + $(meson_native_use_bool wifi)
243 + $(meson_native_use_bool iwd)
244 + $(meson_native_use_bool ppp)
245 + -Dpppd=/usr/sbin/pppd
246 + $(meson_native_use_bool modemmanager modem_manager)
247 + $(meson_native_use_bool ofono)
248 + $(meson_native_use_bool concheck)
249 + $(meson_native_use_bool teamd teamdctl)
250 + $(meson_native_use_bool ovs)
251 + $(meson_native_use_bool tools nmcli)
252 + $(meson_native_use_bool tools nmtui)
253 + $(meson_native_use_bool tools nm_cloud_setup)
254 + $(meson_native_use_bool bluetooth bluez5_dun)
255 + -Debpf=true
256 +
257 + -Dconfig_plugins_default=keyfile
258 + -Difcfg_rh=false
259 + -Difupdown=false
260 +
261 + $(meson_nm_native_program resolvconf "" /sbin/resolvconf)
262 + -Dnetconfig=no
263 + -Dconfig_dns_rc_manager_default=auto
264 +
265 + $(meson_nm_program dhclient "" /sbin/dhclient)
266 + -Ddhcpcanon=no
267 + $(meson_nm_program dhcpcd "" /sbin/dhcpcd)
268 +
269 + $(meson_native_use_bool introspection)
270 + $(meson_native_use_bool vala vapi)
271 + $(meson_native_use_bool gtk-doc docs)
272 + -Dtests=$(multilib_native_usex test)
273 + $(meson_native_true firewalld_zone)
274 + -Dmore_asserts=0
275 + $(meson_use debug more_logging)
276 + -Dvalgrind=no
277 + -Dvalgrind_suppressions=
278 + -Dld_gc=false
279 + $(meson_native_use_bool psl libpsl)
280 + -Dqt=false
281 +
282 + $(meson_use lto b_lto)
283 + )
284 +
285 + if multilib_is_native_abi && use systemd; then
286 + emesonargs+=( -Dsession_tracking_consolekit=false )
287 + emesonargs+=( -Dsession_tracking=systemd )
288 + emesonargs+=( -Dsuspend_resume=systemd )
289 + elif multilib_is_native_abi && use elogind; then
290 + emesonargs+=( -Dsession_tracking_consolekit=false )
291 + emesonargs+=( -Dsession_tracking=elogind )
292 + emesonargs+=( -Dsuspend_resume=elogind )
293 + else
294 + emesonargs+=( -Dsession_tracking_consolekit=false )
295 + emesonargs+=( -Dsession_tracking=no )
296 + emesonargs+=( -Dsuspend_resume=auto )
297 + fi
298 +
299 + if multilib_is_native_abi && use syslog; then
300 + emesonargs+=( -Dconfig_logging_backend_default=syslog )
301 + elif multilib_is_native_abi && use systemd; then
302 + emesonargs+=( -Dconfig_logging_backend_default=journal )
303 + else
304 + emesonargs+=( -Dconfig_logging_backend_default=default )
305 + fi
306 +
307 + if multilib_is_native_abi && use dhclient; then
308 + emesonargs+=( -Dconfig_dhcp_default=dhclient )
309 + elif multilib_is_native_abi && use dhcpcd; then
310 + emesonargs+=( -Dconfig_dhcp_default=dhcpcd )
311 + else
312 + emesonargs+=( -Dconfig_dhcp_default=internal )
313 + fi
314 +
315 + if use nss; then
316 + emesonargs+=( -Dcrypto=nss )
317 + else
318 + emesonargs+=( -Dcrypto=gnutls )
319 + fi
320 +
321 + # Same hack as net-dialup/pptpd to get proper plugin dir for ppp, bug #519986
322 + if use ppp; then
323 + local PPPD_VER=`best_version net-dialup/ppp`
324 + PPPD_VER=${PPPD_VER#*/*-} #reduce it to ${PV}-${PR}
325 + PPPD_VER=${PPPD_VER%%[_-]*} # main version without beta/pre/patch/revision
326 + emesonargs+=( -Dpppd_plugin_dir=/usr/$(get_libdir)/pppd/${PPPD_VER} )
327 + fi
328 +
329 + meson_src_configure
330 +}
331 +
332 +multilib_src_test() {
333 + if use test && multilib_is_native_abi; then
334 + python_setup
335 + virtx meson_src_test
336 + fi
337 +}
338 +
339 +multilib_src_install() {
340 + meson_src_install
341 + if ! multilib_is_native_abi; then
342 + rm -r "${ED}"/{etc,usr/{bin,lib/NetworkManager,share},var} || die
343 + fi
344 +}
345 +
346 +multilib_src_install_all() {
347 + ! use systemd && readme.gentoo_create_doc
348 +
349 + newinitd "${FILESDIR}/init.d.NetworkManager-r2" NetworkManager
350 + newconfd "${FILESDIR}/conf.d.NetworkManager" NetworkManager
351 +
352 + # Need to keep the /etc/NetworkManager/dispatched.d for dispatcher scripts
353 + keepdir /etc/NetworkManager/dispatcher.d
354 +
355 + # Provide openrc net dependency only when nm is connected
356 + exeinto /etc/NetworkManager/dispatcher.d
357 + newexe "${FILESDIR}/10-openrc-status-r4" 10-openrc-status
358 + sed -e "s:@EPREFIX@:${EPREFIX}:g" \
359 + -i "${ED}/etc/NetworkManager/dispatcher.d/10-openrc-status" || die
360 +
361 + keepdir /etc/NetworkManager/system-connections
362 + chmod 0600 "${ED}"/etc/NetworkManager/system-connections/.keep* # bug #383765, upstream bug #754594
363 +
364 + # Allow users in plugdev group to modify system connections
365 + insinto /usr/share/polkit-1/rules.d/
366 + doins "${FILESDIR}"/01-org.freedesktop.NetworkManager.settings.modify.system.rules
367 +
368 + insinto /usr/lib/NetworkManager/conf.d #702476
369 + doins "${S}"/examples/nm-conf.d/31-mac-addr-change.conf
370 +
371 + if use iwd; then
372 + # This goes to $nmlibdir/conf.d/ and $nmlibdir is '${prefix}'/lib/$PACKAGE, thus always lib, not get_libdir
373 + cat <<-EOF > "${ED}"/usr/lib/NetworkManager/conf.d/iwd.conf || die
374 + [device]
375 + wifi.backend=iwd
376 + EOF
377 + fi
378 +
379 + mv "${ED}"/usr/share/doc/{NetworkManager/examples/,${PF}} || die
380 + rmdir "${ED}"/usr/share/doc/NetworkManager || die
381 +
382 + # Empty
383 + rmdir "${ED}"/var{/lib{/NetworkManager,},} || die
384 +}
385 +
386 +pkg_postinst() {
387 + systemd_reenable NetworkManager.service
388 + ! use systemd && readme.gentoo_print_elog
389 +
390 + if [[ -e "${EROOT}/etc/NetworkManager/nm-system-settings.conf" ]]; then
391 + ewarn "The ${PN} system configuration file has moved to a new location."
392 + ewarn "You must migrate your settings from ${EROOT}/etc/NetworkManager/nm-system-settings.conf"
393 + ewarn "to ${EROOT}/etc/NetworkManager/NetworkManager.conf"
394 + ewarn
395 + ewarn "After doing so, you can remove ${EROOT}/etc/NetworkManager/nm-system-settings.conf"
396 + fi
397 +
398 + # NM fallbacks to plugin specified at compile time (upstream bug #738611)
399 + # but still show a warning to remember people to have cleaner config file
400 + if [[ -e "${EROOT}/etc/NetworkManager/NetworkManager.conf" ]]; then
401 + if grep plugins "${EROOT}/etc/NetworkManager/NetworkManager.conf" | grep -q ifnet; then
402 + ewarn
403 + ewarn "You seem to use 'ifnet' plugin in ${EROOT}/etc/NetworkManager/NetworkManager.conf"
404 + ewarn "Since it won't be used, you will need to stop setting ifnet plugin there."
405 + ewarn
406 + fi
407 + fi
408 +
409 + # NM shows lots of errors making nmcli almost unusable, bug #528748 upstream bug #690457
410 + if grep -r "psk-flags=1" "${EROOT}"/etc/NetworkManager/; then
411 + ewarn "You have psk-flags=1 setting in above files, you will need to"
412 + ewarn "either reconfigure affected networks or, at least, set the flag"
413 + ewarn "value to '0'."
414 + fi
415 +
416 + if use dhclient || use dhcpcd; then
417 + ewarn "You have enabled USE=dhclient and/or USE=dhcpcd, but NetworkManager since"
418 + ewarn "version 1.20 defaults to the internal DHCP client. If the internal client"
419 + ewarn "works for you, and you're happy with, the alternative USE flags can be"
420 + ewarn "disabled. If you want to use dhclient or dhcpcd, then you need to tweak"
421 + ewarn "the main.dhcp configuration option to use one of them instead of internal."
422 + fi
423 +}