From ceae05cc4b1eea38916c4fc23e8ce809de7d0ebd Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 24 Sep 2019 19:42:24 +0200 Subject: [PATCH 1/9] tests: avoid deprecated GLib.IOChannel.add_watch() in "test-networkmanager-service.py" test_001 (__main__.TestNmcli) ... /tmp/NetworkManager/tools/test-networkmanager-service.py:2346: PyGIDeprecationWarning: add_watch is deprecated; use GLib.io_add_watch() instead id1 = GLib.IOChannel(0).add_watch(GLib.IOCondition.HUP, --- tools/test-networkmanager-service.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py index c921aedefa..fbf95b0355 100755 --- a/tools/test-networkmanager-service.py +++ b/tools/test-networkmanager-service.py @@ -2343,8 +2343,10 @@ def main(): raise AssertionError("Failure to request D-Bus name org.freedesktop.NetworkManager") # Watch stdin; if it closes, assume our parent has crashed, and exit - id1 = GLib.IOChannel(0).add_watch(GLib.IOCondition.HUP, - lambda io, condition: gl.mainloop.quit() or True) + id1 = GLib.io_add_watch(GLib.IOChannel.unix_new(0), + GLib.PRIORITY_DEFAULT, + GLib.IO_HUP, + lambda io, condition: gl.mainloop.quit() or True) gl.mainloop.run() From 989b26a843acb259bc7ba8738b5994c8ca9a1e25 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 24 Sep 2019 19:56:26 +0200 Subject: [PATCH 2/9] tests: don't compare string literal with "is" in "clients/tests/test-client.py" Recent Python versions warn about this: ./clients/tests/test-client.py:569: SyntaxWarning: "is" with a literal. Did you mean "=="? elif lang is de: ./clients/tests/test-client.py:572: SyntaxWarning: "is" with a literal. Did you mean "=="? elif lang is pl: And rightly so: https://bugs.python.org/issue34850 --- clients/tests/test-client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/tests/test-client.py b/clients/tests/test-client.py index 307a1182f3..41398cc7ac 100755 --- a/clients/tests/test-client.py +++ b/clients/tests/test-client.py @@ -566,10 +566,10 @@ class TestNmcli(NmTestBase): if lang is None or lang == 'C': lang = 'C' language = '' - elif lang is 'de': + elif lang == 'de': lang = 'de_DE.utf8' language = 'de' - elif lang is 'pl': + elif lang == 'pl': lang = 'pl_PL.UTF-8' language = 'pl' else: From 97646d81ce7af642eb4b1e1095357e0ac4c347f0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 24 Sep 2019 20:03:47 +0200 Subject: [PATCH 3/9] tests: fix "clients/tests/test-client.py" concatenating binary for Python 3 Python 3 doesn't like this: ====================================================================== ERROR: test_001 (__main__.TestNmcli) ---------------------------------------------------------------------- Traceback (most recent call last): File "./clients/tests/test-client.py", line 785, in f self._nm_test_post() File "./clients/tests/test-client.py", line 767, in _nm_test_post content_new = ''.join([r['content'] for r in results]) TypeError: sequence item 0: expected str instance, bytes found --- clients/tests/test-client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/tests/test-client.py b/clients/tests/test-client.py index 41398cc7ac..93c652d666 100755 --- a/clients/tests/test-client.py +++ b/clients/tests/test-client.py @@ -764,7 +764,7 @@ class TestNmcli(NmTestBase): self.fail("Unexpected output of command, expected %s. Rerun test with NM_TEST_REGENERATE=1 to regenerate files" % (filename)) if regenerate: - content_new = ''.join([r['content'] for r in results]) + content_new = b''.join([r['content'] for r in results]) if content_new != content_expect: try: with open(filename, 'wb') as content_file: From 185567559cd2d85ed44b99ccc433f83c3c8d3703 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 25 Sep 2019 07:15:57 +0200 Subject: [PATCH 4/9] tests: fix failure installing non-existing packages in REQUIRED_PACKAGES Previously, dnf/yum used to ignore packages that didn't exist. In Fedora 32, dnf starts to fail the entire command: No match for argument: python-gobject-base Error: Unable to find a match: python-gobject-base Since this script is supposed to work with different RHEL/Fedora versions, it's expected that not all packages are available everywhere. Fix that, by installing packages that we know that they might be missing one by one (and ignore the error). --- contrib/fedora/REQUIRED_PACKAGES | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/contrib/fedora/REQUIRED_PACKAGES b/contrib/fedora/REQUIRED_PACKAGES index 7579e9a983..b295d59315 100755 --- a/contrib/fedora/REQUIRED_PACKAGES +++ b/contrib/fedora/REQUIRED_PACKAGES @@ -10,16 +10,25 @@ # Not all of these packages are strictly speaking necessary. # This is a generous list of related packages. +set -xe + +DNF="$(which dnf &>/dev/null && echo dnf || echo yum)" + install() { if [ "$NM_INSTALL" != "" ]; then $NM_INSTALL "$@" else - sudo "$(which dnf &>/dev/null && echo dnf || echo yum)" install -y "$@" + sudo "$DNF" install -y "$@" fi } +install_ignore_missing() { + for p; do + install "$p" || : + done +} + install \ - \ ModemManager-devel \ ModemManager-glib-devel \ mobile-broadband-provider-info-devel \ @@ -56,7 +65,6 @@ install \ ppp \ ppp-devel \ pygobject3-base \ - python-gobject-base \ python3-dbus \ python3-gobject \ qt-devel \ @@ -68,5 +76,9 @@ install \ vala-tools \ valgrind \ wireless-tools-devel \ - \ + #end + +# some packages don't exist in certain distributions. Install them one-by-one, and ignore errors. +install_ignore_missing \ + python-gobject-base \ #end From 1a2a5b37b40c3af703f901fee1dcd9241ab69beb Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 25 Sep 2019 07:32:33 +0200 Subject: [PATCH 5/9] tests: don't install unnecessary package in gitlab-ci tests REQUIRED_PACKAGES has two uses: - to setup a system for developing NetworkManager. This installs convenience packages like "cscope". - to install the packages required for unit testing in gitlab-ci. For gitlab-ci we should only install the packages that we actually need. --- .gitlab-ci.yml | 2 +- contrib/fedora/REQUIRED_PACKAGES | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9d54b12ed3..ef156c2c30 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ stages: - date '+%Y%m%d-%H%M%S'; ! grep -q '^NAME=.*\(CentOS\)' /etc/os-release || (yum install -y glibc-common && localedef -c -i pl_PL -f UTF-8 pl_PL.UTF-8 && locale -a) - - date '+%Y%m%d-%H%M%S'; NM_INSTALL="yum install -y" ./contrib/fedora/REQUIRED_PACKAGES + - date '+%Y%m%d-%H%M%S'; NM_NO_EXTRA=1 NM_INSTALL="yum install -y" ./contrib/fedora/REQUIRED_PACKAGES - date '+%Y%m%d-%H%M%S'; yum install -y glibc-langpack-pl ccache clang which # containers have "tsflags=nodocs" in /etc/dnf/dnf.conf. We need /usr/shared/gtk-doc/html diff --git a/contrib/fedora/REQUIRED_PACKAGES b/contrib/fedora/REQUIRED_PACKAGES index b295d59315..b656db8de4 100755 --- a/contrib/fedora/REQUIRED_PACKAGES +++ b/contrib/fedora/REQUIRED_PACKAGES @@ -28,15 +28,23 @@ install_ignore_missing() { done } +if test "$NM_NO_EXTRA" != 1; then + # these packages are convenient for developing, but not necessary + # for CI testing. + EXTRA_PACKAGES=( + bash-completion \ + cscope \ + ) +else + EXTRA_PACKAGES=() +fi + install \ ModemManager-devel \ ModemManager-glib-devel \ - mobile-broadband-provider-info-devel \ audit-libs-devel \ - bash-completion \ bluez-libs-devel \ bzip2 \ - cscope \ dbus-devel \ dbus-python \ dbus-x11 \ @@ -59,6 +67,7 @@ install \ libuuid-devel \ make \ meson \ + mobile-broadband-provider-info-devel \ newt-devel \ nss-devel \ polkit-devel \ @@ -76,7 +85,7 @@ install \ vala-tools \ valgrind \ wireless-tools-devel \ - #end + "${EXTRA_PACKAGES[@]}" # some packages don't exist in certain distributions. Install them one-by-one, and ignore errors. install_ignore_missing \ From 3a1b2b988576a7bc43e50824976a892a2255b83f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 25 Sep 2019 07:40:36 +0200 Subject: [PATCH 6/9] tests: don't install bzip2 as REQUIRED_PACKAGES on Fedora/RHEL --- contrib/fedora/REQUIRED_PACKAGES | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/fedora/REQUIRED_PACKAGES b/contrib/fedora/REQUIRED_PACKAGES index b656db8de4..2ed13c5d69 100755 --- a/contrib/fedora/REQUIRED_PACKAGES +++ b/contrib/fedora/REQUIRED_PACKAGES @@ -44,7 +44,6 @@ install \ ModemManager-glib-devel \ audit-libs-devel \ bluez-libs-devel \ - bzip2 \ dbus-devel \ dbus-python \ dbus-x11 \ From 9fc449051390a99729b8611a1aa0fd0b7fb99e20 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 25 Sep 2019 09:00:32 +0200 Subject: [PATCH 7/9] contrib/rpm: drop BuildRequires to deprecated "wireless-tools-devel" "wireless-tools-devel" is long depreacted and not used by NetworkManager, not even for WEXT. Drop it from the build dependencies. --- contrib/fedora/REQUIRED_PACKAGES | 1 - contrib/fedora/rpm/NetworkManager.spec | 5 ----- 2 files changed, 6 deletions(-) diff --git a/contrib/fedora/REQUIRED_PACKAGES b/contrib/fedora/REQUIRED_PACKAGES index 2ed13c5d69..fb6e173a56 100755 --- a/contrib/fedora/REQUIRED_PACKAGES +++ b/contrib/fedora/REQUIRED_PACKAGES @@ -83,7 +83,6 @@ install \ vala-devel \ vala-tools \ valgrind \ - wireless-tools-devel \ "${EXTRA_PACKAGES[@]}" # some packages don't exist in certain distributions. Install them one-by-one, and ignore errors. diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 4c9f61309d..317fe9a82a 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -7,8 +7,6 @@ # Note that it contains __PLACEHOLDERS__ that will be replaced by the accompanying 'build.sh' script. -%global wireless_tools_version 1:28-0pre9 - %global wpa_supplicant_version 1:1.1 %global ppp_version %(sed -n 's/^#define\\s*VERSION\\s*"\\([^\\s]*\\)"$/\\1/p' %{_includedir}/pppd/patchlevel.h 2>/dev/null | grep . || echo bad) @@ -183,9 +181,6 @@ BuildRequires: intltool BuildRequires: gettext-devel BuildRequires: dbus-devel >= %{dbus_version} -%if 0%{?fedora} -BuildRequires: wireless-tools-devel >= %{wireless_tools_version} -%endif BuildRequires: glib2-devel >= 2.40.0 BuildRequires: gobject-introspection-devel >= 0.10.3 %if %{with ppp} From 7c7ad97831b91a5c5de3c4b1c551d320b0ef2ba6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 25 Sep 2019 09:44:14 +0200 Subject: [PATCH 8/9] build/meson: use python3 interpreter for "generate-setting-docs.py" Fedora 32 drops "python" from the path. Hence "/usr/bin/env python" won't work anymore. Of course, who needs a way to invoke the interpreter that works accross different distributions! WTF. In this case, easy to work around. We run it from meson, so we have access to the Python 3 binary. Just call python explicitly, like we do with autotools. --- libnm/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libnm/meson.build b/libnm/meson.build index 2e65d3bebf..0d7fb3acf2 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -280,7 +280,7 @@ if enable_introspection name, input: libnm_gir[0], output: name, - command: [generate_setting_docs_env, generate_setting_docs, '--lib-path', meson.current_build_dir(), '--gir', '@INPUT@', '--output', '@OUTPUT@'], + command: [generate_setting_docs_env, python.path(), generate_setting_docs, '--lib-path', meson.current_build_dir(), '--gir', '@INPUT@', '--output', '@OUTPUT@'], depends: libnm_gir, ) @@ -289,7 +289,7 @@ if enable_introspection name, input: libnm_gir[0], output: name, - command: [generate_setting_docs_env, generate_setting_docs, '--lib-path', meson.current_build_dir(), '--gir', '@INPUT@', '--overrides', nm_settings_docs_overrides, '--output', '@OUTPUT@'], + command: [generate_setting_docs_env, python.path(), generate_setting_docs, '--lib-path', meson.current_build_dir(), '--gir', '@INPUT@', '--overrides', nm_settings_docs_overrides, '--output', '@OUTPUT@'], depends: libnm_gir, ) endif From b40a3aa727a7cbc45d12cbb7aa67d14a98f16dc7 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 25 Sep 2019 11:28:19 +0200 Subject: [PATCH 9/9] gitlab-ci: add building on Fedora 31 And don't build Fedora 28 by default. It's aleady end of life. But for now keep it, so it can be triggered manually. --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef156c2c30..194f8e18be 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -84,6 +84,7 @@ t_fedora:28: <<: *fedora_install image: fedora:28 <<: *do_build + when: manual t_fedora:29: <<: *fedora_install @@ -103,6 +104,11 @@ t_fedora:30: image: fedora:30 <<: *do_build +t_fedora:31: + <<: *fedora_install + image: fedora:31 + <<: *do_build + t_fedora:rawhide: <<: *fedora_install image: fedora:rawhide