commit: cf7a1e674e4ba5547d5ba5d4ce2d128407183e2c Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Sun Oct 5 02:10:27 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sun Oct 5 02:10:27 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf7a1e67
sys-auth/polkit: fix build w/ newer python-dbusmock Not sure why I only saw this on one machine (skipped elsewhere). Signed-off-by: Sam James <sam <AT> gentoo.org> sys-auth/polkit/files/polkit-126-dbusmock.patch | 77 +++++++++++++++++++++++++ sys-auth/polkit/polkit-126-r2.ebuild | 1 + 2 files changed, 78 insertions(+) diff --git a/sys-auth/polkit/files/polkit-126-dbusmock.patch b/sys-auth/polkit/files/polkit-126-dbusmock.patch new file mode 100644 index 000000000000..ce344df44e24 --- /dev/null +++ b/sys-auth/polkit/files/polkit-126-dbusmock.patch @@ -0,0 +1,77 @@ +https://github.com/polkit-org/polkit/commit/690e6972ffe30473dacbfaa81158f5507cef99f6 + +From 690e6972ffe30473dacbfaa81158f5507cef99f6 Mon Sep 17 00:00:00 2001 +From: Jan Rybar <[email protected]> +Date: Wed, 1 Oct 2025 13:23:45 +0200 +Subject: [PATCH] DBusMock: CI broken after stop_dbus() removal + +Because stop_dbus() was removed from DBusMock implementation, nothing +actually stops the system bus in testing environment in the wrapper.py +child process, hence the test times out into failure. +Adding simple kill(<dbus_PID>) in atexit() is sufficient, but the +original implementation in DBusMock seemed more graceful, so it was +pulled back in. +--- + test/wrapper.py | 34 +++++++++++++++++++++++++++++++++- + 1 file changed, 33 insertions(+), 1 deletion(-) + +diff --git a/test/wrapper.py b/test/wrapper.py +index 14f4abdb..dc62f702 100755 +--- a/test/wrapper.py ++++ b/test/wrapper.py +@@ -5,6 +5,8 @@ + import os + import subprocess + import sys ++import signal ++import time + + import dbus + import dbus.mainloop.glib +@@ -36,6 +38,36 @@ def setup_test_namespace(data_dir): + print("Python 3.12 is required for os.unshare(), skipping") + sys.exit(77) + ++ ++def stop_dbus(pid: int) -> None: ++ """Stop a D-Bus daemon ++ ++ If DBus daemon is not explicitly killed in the testing environment ++ the test times out and reports as failed. ++ This is a backport of a function dropped from DBusMock source (99c4800e9eed). ++ """ ++ signal.signal(signal.SIGTERM, signal.SIG_IGN) ++ for _ in range(50): ++ try: ++ os.kill(pid, signal.SIGTERM) ++ os.waitpid(pid, os.WNOHANG) ++ except ChildProcessError: ++ break ++ except OSError as e: ++ if e.errno == errno.ESRCH: ++ break ++ raise ++ time.sleep(0.1) ++ else: ++ sys.stderr.write("ERROR: timed out waiting for bus process to terminate\n") ++ os.kill(pid, signal.SIGKILL) ++ try: ++ os.waitpid(pid, 0) ++ except ChildProcessError: ++ pass ++ signal.signal(signal.SIGTERM, signal.SIG_DFL) ++ ++ + if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("test_executable", +@@ -51,7 +83,7 @@ def setup_test_namespace(data_dir): + if args.mock_dbus: + dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) + dbusmock.DBusTestCase.start_system_bus() +- atexit.register(dbusmock.DBusTestCase.stop_dbus, dbusmock.DBusTestCase.system_bus_pid) ++ atexit.register(stop_dbus, dbusmock.DBusTestCase.system_bus_pid) + + print(f"Executing '{args.test_executable}'") + sys.stdout.flush() + diff --git a/sys-auth/polkit/polkit-126-r2.ebuild b/sys-auth/polkit/polkit-126-r2.ebuild index ff2c61d7702e..0746d9cecf6c 100644 --- a/sys-auth/polkit/polkit-126-r2.ebuild +++ b/sys-auth/polkit/polkit-126-r2.ebuild @@ -83,6 +83,7 @@ QA_MULTILIB_PATHS=" PATCHES=( "${FILESDIR}"/${P}-elogind.patch + "${FILESDIR}"/${P}-dbusmock.patch ) python_check_deps() {
