From 5f7bff612aaf400ab1b264edd02c0d0ac23a8933 Mon Sep 17 00:00:00 2001 From: Funda Wang Date: Sat, 19 Jul 2025 19:36:04 +0800 Subject: [PATCH] fix build with pygobject 3.52 & glib 2.80 --- NetworkManager.spec | 32 +++---- ...ix-test-failure-in-config-set-values.patch | 39 ++++++++ ...-docs-generation-with-PyGObject-3.52.patch | 93 +++++++++++++++++++ 3 files changed, 145 insertions(+), 19 deletions(-) create mode 100644 backport-config-tests-fix-test-failure-in-config-set-values.patch create mode 100644 backport-meson-Fix-docs-generation-with-PyGObject-3.52.patch diff --git a/NetworkManager.spec b/NetworkManager.spec index e309901..0908d44 100644 --- a/NetworkManager.spec +++ b/NetworkManager.spec @@ -53,7 +53,7 @@ Name: NetworkManager Version: 1.44.2 Epoch: 1 -Release: 3 +Release: 4 Summary: Network connection manager and user applications License: GPL-2.0-or-later URL: https://networkmanager.dev/ @@ -69,6 +69,8 @@ Patch6: 0001-add-NM-to-support-wifi6.patch Patch6000: backport-lldp-fix-crash-dereferencing-NULL-pointer-during-deb.patch Patch6001: backport-lldp-fix-multiple-access-to-argument-in-logging-macr.patch +Patch6002: backport-meson-Fix-docs-generation-with-PyGObject-3.52.patch +Patch6003: backport-config-tests-fix-test-failure-in-config-set-values.patch BuildRequires: gcc libtool pkgconfig automake autoconf intltool gettext-devel ppp-devel gnutls-devel BuildRequires: dbus-devel glib2-devel gobject-introspection-devel jansson-devel @@ -85,11 +87,9 @@ BuildRequires: firewalld-filesystem %if %{with bluetooth} BuildRequires: bluez-libs-devel %endif -Requires(post): systemd +%{?systemd_requires} Requires(post): /usr/sbin/update-alternatives -Requires(preun): systemd Requires(preun): /usr/sbin/update-alternatives -Requires(postun): systemd Requires: dbus glib2 Requires: %{name}-libnm = %{epoch}:%{version}-%{release} Obsoletes: NetworkManager < %{obsoletes_device_plugins} NetworkManager < %{obsoletes_ppp_plugin} @@ -125,6 +125,7 @@ whenever it sees fit. Summary: Automatically configure NetworkManager in cloud Requires: %{name} = %{epoch}:%{version}-%{release} Requires: %{name}-libnm%{?_isa} = %{epoch}:%{version}-%{release} +%{?systemd_requires} %description cloud-setup Installs a nm-cloud-setup tool that can automatically configure @@ -195,9 +196,7 @@ This package contains the libraries that add NetworkManager support to applicati %package libnm-devel Summary: Header files and Development files for adding NetworkManager support to applications (new API). -Requires: %{name}-libnm = %{epoch}:%{version}-%{release} pkgconfig glib2-devel -Requires: glib2-devel -Requires: pkgconfig +Requires: %{name}-libnm = %{epoch}:%{version}-%{release} %description libnm-devel This package contains the header and development files for @@ -340,7 +339,7 @@ autoreconf --install --force %make_build %install -make install DESTDIR=%{buildroot} +%make_install cp %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}/ cp %{SOURCE2} %{buildroot}%{_prefix}/lib/%{name}/conf.d/ cp examples/dispatcher/10-ifcfg-rh-routes.sh %{buildroot}%{_sysconfdir}/%{name}/dispatcher.d/ @@ -427,7 +426,6 @@ fi %endif %files -%defattr(-,root,root) %doc AUTHORS %license COPYING %license COPYING.LGPL @@ -493,42 +491,36 @@ fi %if %{with team} %files team -%defattr(-,root,root) %{_libdir}/%{name}/%{version}-%{release}/libnm-device-plugin-team.so %endif %if %{with wwan} %files wwan -%defattr(-,root,root) %{_libdir}/%{name}/%{version}-%{release}/libnm-device-plugin-wwan.so %{_libdir}/%{name}/%{version}-%{release}/libnm-wwan.so %endif %if %{with bluetooth} %files bluetooth -%defattr(-,root,root) %{_libdir}/%{name}/%{version}-%{release}/libnm-device-plugin-bluetooth.so %endif %if %{with wifi} %files wifi -%defattr(-,root,root) %{_libdir}/%{name}/%{version}-%{release}/libnm-device-plugin-wifi.so %endif %if %{with ppp} %files ppp -%defattr(-,root,root) %{_libdir}/%{name}/%{version}-%{release}/libnm-ppp-plugin.so %endif + %files libnm -f %{name}.lang -%defattr(-,root,root) %{_libdir}/libnm.so.0* %{_libdir}/girepository-1.0/*.typelib %files libnm-devel -%defattr(-,root,root) %{_includedir}/libnm/*.h %{_libdir}/pkgconfig/*.pc %{_libdir}/libnm.so @@ -540,7 +532,6 @@ fi %{_prefix}/lib/%{name}/conf.d/00-server.conf %files help -%defattr(-,root,root) %doc CONTRIBUTING.md NEWS TODO %{_mandir}/man1/nmcli.1* %{_mandir}/man1/nm-online.1* @@ -549,10 +540,13 @@ fi %{_mandir}/man8/*.8* %{_mandir}/man7/nm-openvswitch.7* %{_mandir}/man1/nmtui*.1* -%{_datadir}/gtk-doc/html/libnm -%{_datadir}/gtk-doc/html/NetworkManager +%doc %{_datadir}/gtk-doc/html/libnm +%doc %{_datadir}/gtk-doc/html/NetworkManager %changelog +* Sat Jul 19 2025 Funda Wang - 1:1.44.2-4 +- fix build with pygobject 3.52 & glib 2.80 + * Fri Jan 24 2025 Funda Wang - 1:1.44.2-3 - Type:CVE - CVE:CVE-2024-6501 diff --git a/backport-config-tests-fix-test-failure-in-config-set-values.patch b/backport-config-tests-fix-test-failure-in-config-set-values.patch new file mode 100644 index 0000000..57fefa7 --- /dev/null +++ b/backport-config-tests-fix-test-failure-in-config-set-values.patch @@ -0,0 +1,39 @@ +From 7f2a32fa11d580ee65a0458f438018de12b6ae84 Mon Sep 17 00:00:00 2001 +From: Thomas Haller +Date: Wed, 7 Feb 2024 15:54:08 +0100 +Subject: [PATCH] config/tests: fix test failure in "/config/set-values" + +GKeyfile changed something about how to handle invalid escape sequences. +As we don't want to test GKeyfile (per-se), just adjust to test to not +hit the problem. + +This would fail with glib2-2.79.1-1.fc40: + + # ./tools/run-nm-test.sh -m src/core/tests/config/test-config -p /config/set-values + TAP version 13 + # random seed: R02Sb8afff1ec38ca5a1b7713e8c40eb4f56 + # Start of config tests + # GLib-GIO-DEBUG: _g_io_module_get_default: Found default implementation local (GLocalVfs) for ?gio-vfs? + # (src/core/tests/config/test-config.c:1107) invalid value in config-data .intern.with-whitespace.key2 = (null) (instead of " b c\, d ") + ./tools/run-nm-test.sh: line 307: 245847 Trace/breakpoint trap (core dumped) "${NMTST_DBUS_RUN_SESSION[@]}" "$TEST" "${TEST_ARGV[@]}" + exec "src/core/tests/config/test-config" failed with exit code 133 +--- + src/core/tests/config/test-config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/tests/config/test-config.c b/src/core/tests/config/test-config.c +index 054b9003f49..2b27d535492 100644 +--- a/src/core/tests/config/test-config.c ++++ b/src/core/tests/config/test-config.c +@@ -1076,7 +1076,7 @@ _set_values_intern_atomic_section_2_set(NMConfig *config, + g_key_file_set_value(keyfile, + NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN "with-whitespace", + "key2", +- " b c\\, d "); ++ " b c\\\\, d "); + *out_expected_changes = NM_CONFIG_CHANGE_CAUSE_SET_VALUES | NM_CONFIG_CHANGE_VALUES + | NM_CONFIG_CHANGE_VALUES_INTERN; + } +-- +GitLab + diff --git a/backport-meson-Fix-docs-generation-with-PyGObject-3.52.patch b/backport-meson-Fix-docs-generation-with-PyGObject-3.52.patch new file mode 100644 index 0000000..1cbeca1 --- /dev/null +++ b/backport-meson-Fix-docs-generation-with-PyGObject-3.52.patch @@ -0,0 +1,93 @@ +From 12eff9a7fdfeabab12ce56e5f7d515a13a3d704c Mon Sep 17 00:00:00 2001 +From: Jan Tojnar +Date: Sun, 23 Mar 2025 16:35:44 +0100 +Subject: [PATCH] meson: Fix docs generation with PyGObject 3.52 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +PyGObject 3.52 switched from gobject-introspection’s libgirepository 1.0 +to glib’s libgirepository 2.0. As a result, the Python script would +no longer be able to find the `GIRepository` 2.0 typelib: + + (process:1944): GLib-GIRepository-DEBUG: 15:25:14.521: Ignoring GIRepository-2.0.typelib because this libgirepository corresponds to GIRepository-3.0.typelib + +We could update the script to support both versions of the typelib +but it is not really necessary. It was only used to add extra directories +from `$LD_LIBRARY_PATH` and the CLI argument to repository’s library path +but libgirepository already supports using `LD_LIBRARY_PATH` directly: +https://docs.gtk.org/girepository/method.Repository.prepend_library_path.html +--- + src/libnm-client-impl/meson.build | 1 - + tools/generate-docs-nm-settings-docs-gir.py | 28 --------------------- + 2 files changed, 29 deletions(-) + +diff --git a/src/libnm-client-impl/meson.build b/src/libnm-client-impl/meson.build +index fb879dc..a388c40 100644 +--- a/src/libnm-client-impl/meson.build ++++ b/src/libnm-client-impl/meson.build +@@ -232,7 +232,6 @@ if enable_introspection + 'LD_LIBRARY_PATH=' + ld_library_path, + python.path(), + join_paths(meson.source_root(), 'tools', 'generate-docs-nm-settings-docs-gir.py'), +- '--lib-path', meson.current_build_dir(), + '--gir', '@INPUT@', + '--output', '@OUTPUT@' + ], +diff --git a/tools/generate-docs-nm-settings-docs-gir.py b/tools/generate-docs-nm-settings-docs-gir.py +index b8f29d3..ecd622c 100644 +--- a/tools/generate-docs-nm-settings-docs-gir.py ++++ b/tools/generate-docs-nm-settings-docs-gir.py +@@ -6,26 +6,9 @@ + from __future__ import print_function, unicode_literals + import xml.etree.ElementTree as ET + import argparse +-import os + import gi + import re + +-gi.require_version("GIRepository", "2.0") +-from gi.repository import GIRepository +- +-try: +- libs = os.environ["LD_LIBRARY_PATH"].split(":") +- libs.reverse() +- for lib in libs: +- GIRepository.Repository.prepend_library_path(lib) +-except AttributeError: +- # An old GI version, that has no prepend_library_path +- # It's alright, it probably interprets LD_LIBRARY_PATH +- # correctly. +- pass +-except KeyError: +- pass +- + gi.require_version("NM", "1.0") + from gi.repository import NM, GObject + +@@ -341,13 +324,6 @@ def main(gir_path_str, output_path_str): + + if __name__ == "__main__": + parser = argparse.ArgumentParser() +- parser.add_argument( +- "-l", +- "--lib-path", +- metavar="PATH", +- action="append", +- help="path to scan for shared libraries", +- ) + parser.add_argument( + "-g", + "--gir", +@@ -365,8 +341,4 @@ if __name__ == "__main__": + + args = parser.parse_args() + +- if args.lib_path: +- for lib in args.lib_path: +- GIRepository.Repository.prepend_library_path(lib) +- + main(args.gir, args.output) +-- +GitLab + -- Gitee