Add patches to shut down on idle, including new dnf plugin
Thanks to Gordon Messmer, this should now be possible to do safely. Hopefully.
This commit is contained in:
parent
2db437a01a
commit
0159fe85bf
@ -19,6 +19,11 @@ Patch0: PackageKit-0.3.8-RHEL-Vendor.conf.patch
|
||||
# https://github.com/PackageKit/PackageKit/pull/404
|
||||
Patch1: package-remove-password-prompt.patch
|
||||
|
||||
# https://github.com/PackageKit/PackageKit/pull/578
|
||||
# https://github.com/PackageKit/PackageKit/pull/599
|
||||
# https://github.com/PackageKit/PackageKit/pull/600
|
||||
Patch2: shutdown-on-idle.patch
|
||||
|
||||
BuildRequires: glib2-devel >= %{glib2_version}
|
||||
BuildRequires: xmlto
|
||||
BuildRequires: gtk-doc
|
||||
@ -39,6 +44,7 @@ BuildRequires: systemd
|
||||
BuildRequires: systemd-devel
|
||||
BuildRequires: gobject-introspection-devel
|
||||
BuildRequires: bash-completion
|
||||
BuildRequires: python3-devel
|
||||
|
||||
Requires: %{name}-glib%{?_isa} = %{version}-%{release}
|
||||
Requires: glib2%{?_isa} >= %{glib2_version}
|
||||
@ -46,6 +52,8 @@ Requires: libdnf%{?_isa} >= %{libdnf_version}
|
||||
Requires: shared-mime-info
|
||||
Requires: systemd
|
||||
|
||||
Recommends: %{name}-dnf-plugin = %{version}-%{release}
|
||||
|
||||
# functionality moved to udev itself
|
||||
Obsoletes: PackageKit-udev-helper < %{version}-%{release}
|
||||
Obsoletes: udev-packagekit < %{version}-%{release}
|
||||
@ -132,6 +140,13 @@ Requires: %{name}-glib%{?_isa} = %{version}-%{release}
|
||||
A simple helper that offers to install new packages on the command line
|
||||
using PackageKit.
|
||||
|
||||
%package dnf-plugin
|
||||
Summary: Install PackageKit dnf plugin
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
|
||||
%description dnf-plugin
|
||||
A dnf plugin to notify PackageKit to refresh its state.
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
|
||||
@ -240,5 +255,8 @@ systemctl disable packagekit-offline-update.service > /dev/null 2>&1 || :
|
||||
%{_datadir}/vala/vapi/packagekit-glib2.vapi
|
||||
%{_datadir}/vala/vapi/packagekit-glib2.deps
|
||||
|
||||
%files dnf-plugin
|
||||
%pycached %{python3_sitelib}/dnf-plugins/notify_packagekit.py
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
|
||||
203
shutdown-on-idle.patch
Normal file
203
shutdown-on-idle.patch
Normal file
@ -0,0 +1,203 @@
|
||||
From f42096ff2427a758eda9de2e3046714167a38c95 Mon Sep 17 00:00:00 2001
|
||||
From: Russell Haley <yumpusamongus@gmail.com>
|
||||
Date: Mon, 12 Sep 2022 12:36:10 -0500
|
||||
Subject: [PATCH] Revert "Revert "Shutdown the daemon on idle by default""
|
||||
|
||||
This reverts commit dca1f5b2508a4632d0b9fefab771a5a9caf83a5c.
|
||||
|
||||
Which reverted commit 0c84d71509e851db20445c747529bd7d3724f081,
|
||||
which reverted commit c6eb3555ec5b41e988c111d276764d55fb83bda3.
|
||||
|
||||
Fixes #460.
|
||||
|
||||
The memory usage of packagekitd has been observed growing well beyond
|
||||
half a GiB. See:
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1354074
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1854875
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1896964
|
||||
|
||||
As I understand it, this timeout causes some slightly surprising
|
||||
behavior when users mix command line dnf upgades with GUI PackageKit
|
||||
upgrades, and do not manually run an update check before rebooting for
|
||||
update. But that is an edge case, and the price of not having it is too
|
||||
high.
|
||||
---
|
||||
src/pk-main.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/pk-main.c b/src/pk-main.c
|
||||
index d372a7456..1de9a1390 100644
|
||||
--- a/src/pk-main.c
|
||||
+++ b/src/pk-main.c
|
||||
@@ -183,6 +183,11 @@ main (int argc, char *argv[])
|
||||
|
||||
/* after how long do we timeout? */
|
||||
exit_idle_time = g_key_file_get_integer (conf, "Daemon", "ShutdownTimeout", NULL);
|
||||
+ /* THIS COMMENT IS A TSUNAMI STONE
|
||||
+ * Before removing the default timeout, please study the git history and
|
||||
+ * be sure that you are not regressing Redhat bugzilla #1354074 (again). */
|
||||
+ if (exit_idle_time == 0)
|
||||
+ exit_idle_time = 300;
|
||||
g_debug ("daemon shutdown set to %i seconds", exit_idle_time);
|
||||
|
||||
/* override the backend name */
|
||||
|
||||
From ba378b8510133bbad081aebd15cfe2ae74fe1e8a Mon Sep 17 00:00:00 2001
|
||||
From: Gordon Messmer <gordon.messmer@gmail.com>
|
||||
Date: Sun, 15 Jan 2023 15:17:45 -0800
|
||||
Subject: [PATCH] valgrind warns that a conditional depends on an uninitialized
|
||||
value.
|
||||
|
||||
---
|
||||
src/pk-main.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/pk-main.c b/src/pk-main.c
|
||||
index d372a7456..43727d206 100644
|
||||
--- a/src/pk-main.c
|
||||
+++ b/src/pk-main.c
|
||||
@@ -241,6 +241,8 @@ main (int argc, char *argv[])
|
||||
helper.loop = loop;
|
||||
helper.timer_id = g_timeout_add_seconds (5, (GSourceFunc) pk_main_timeout_check_cb, &helper);
|
||||
g_source_set_name_by_id (helper.timer_id, "[PkMain] main poll");
|
||||
+ } else {
|
||||
+ helper.timer_id = 0;
|
||||
}
|
||||
|
||||
/* immediatly exit */
|
||||
|
||||
From a2a2599ede2bad7a15ac280c3302d5872ab5d788 Mon Sep 17 00:00:00 2001
|
||||
From: Gordon Messmer <gordon.messmer@gmail.com>
|
||||
Date: Tue, 17 Jan 2023 08:45:16 -0800
|
||||
Subject: [PATCH 1/3] Notify PackageKit when dnf installs packages.
|
||||
|
||||
---
|
||||
backends/dnf/meson.build | 13 +++++++++
|
||||
backends/dnf/refresh_packagekit.py | 45 ++++++++++++++++++++++++++++++
|
||||
2 files changed, 58 insertions(+)
|
||||
create mode 100644 backends/dnf/refresh_packagekit.py
|
||||
|
||||
diff --git a/backends/dnf/meson.build b/backends/dnf/meson.build
|
||||
index ac75a1b6c..c5089cc87 100644
|
||||
--- a/backends/dnf/meson.build
|
||||
+++ b/backends/dnf/meson.build
|
||||
@@ -7,6 +7,19 @@ if meson.get_compiler('c').has_function('hy_query_get_advisory_pkgs', prefix: '#
|
||||
c_args += ['-DHAVE_HY_QUERY_GET_ADVISORY_PKGS']
|
||||
endif
|
||||
|
||||
+python = import('python')
|
||||
+python_exec = python.find_installation()
|
||||
+python_package_dir = get_option('pythonpackagedir')
|
||||
+if python_package_dir == ''
|
||||
+ python_package_dir = python_exec.get_install_dir()
|
||||
+endif
|
||||
+python_package_dir = join_paths(python_package_dir, 'dnf-plugins')
|
||||
+
|
||||
+install_data(
|
||||
+ 'refresh_packagekit.py',
|
||||
+ install_dir: join_paths(python_package_dir),
|
||||
+)
|
||||
+
|
||||
shared_module(
|
||||
'pk_backend_dnf',
|
||||
'dnf-backend-vendor-@0@.c'.format(get_option('dnf_vendor')),
|
||||
diff --git a/backends/dnf/refresh_packagekit.py b/backends/dnf/refresh_packagekit.py
|
||||
new file mode 100644
|
||||
index 000000000..2e80e9eeb
|
||||
--- /dev/null
|
||||
+++ b/backends/dnf/refresh_packagekit.py
|
||||
@@ -0,0 +1,45 @@
|
||||
+# -*- coding: utf-8 -*-
|
||||
+#
|
||||
+# Copyright (C) 2022 Gordon Messmer
|
||||
+#
|
||||
+# Licensed under the GNU Lesser General Public License Version 2.1
|
||||
+#
|
||||
+# This library is free software; you can redistribute it and/or
|
||||
+# modify it under the terms of the GNU Lesser General Public
|
||||
+# License as published by the Free Software Foundation; either
|
||||
+# version 2.1 of the License, or (at your option) any later version.
|
||||
+#
|
||||
+# This library is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+# Lesser General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU Lesser General Public
|
||||
+# License along with this library; if not, write to the Free Software
|
||||
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+
|
||||
+"""
|
||||
+Notify packagekitd when packages are updated.
|
||||
+"""
|
||||
+
|
||||
+import dbus
|
||||
+import dnf
|
||||
+from dnfpluginscore import _
|
||||
+
|
||||
+
|
||||
+class RefreshPackagekit(dnf.Plugin):
|
||||
+ name = "refresh-packagekit"
|
||||
+
|
||||
+ def __init__(self, base, cli):
|
||||
+ super(RefreshPackagekit, self).__init__(base, cli)
|
||||
+ self.base = base
|
||||
+ self.cli = cli
|
||||
+
|
||||
+ def transaction(self):
|
||||
+ try:
|
||||
+ bus = dbus.SystemBus()
|
||||
+ proxy = bus.get_object('org.freedesktop.PackageKit', '/org/freedesktop/PackageKit')
|
||||
+ iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.PackageKit')
|
||||
+ iface.StateHasChanged('dnf-updated')
|
||||
+ except:
|
||||
+ pass
|
||||
|
||||
From e9d8be7de92969542cb7979810196410c549a992 Mon Sep 17 00:00:00 2001
|
||||
From: Gordon Messmer <gordon.messmer@gmail.com>
|
||||
Date: Tue, 17 Jan 2023 19:02:25 -0800
|
||||
Subject: [PATCH 3/3] Fixes from code review.
|
||||
|
||||
---
|
||||
backends/dnf/meson.build | 2 +-
|
||||
.../dnf/{refresh_packagekit.py => notify_packagekit.py} | 6 +++---
|
||||
contrib/PackageKit.spec.in | 3 +--
|
||||
3 files changed, 5 insertions(+), 6 deletions(-)
|
||||
rename backends/dnf/{refresh_packagekit.py => notify_packagekit.py} (91%)
|
||||
|
||||
diff --git a/backends/dnf/meson.build b/backends/dnf/meson.build
|
||||
index c5089cc87..09718baf1 100644
|
||||
--- a/backends/dnf/meson.build
|
||||
+++ b/backends/dnf/meson.build
|
||||
@@ -16,7 +16,7 @@ endif
|
||||
python_package_dir = join_paths(python_package_dir, 'dnf-plugins')
|
||||
|
||||
install_data(
|
||||
- 'refresh_packagekit.py',
|
||||
+ 'notify_packagekit.py',
|
||||
install_dir: join_paths(python_package_dir),
|
||||
)
|
||||
|
||||
diff --git a/backends/dnf/refresh_packagekit.py b/backends/dnf/notify_packagekit.py
|
||||
similarity index 91%
|
||||
rename from backends/dnf/refresh_packagekit.py
|
||||
rename to backends/dnf/notify_packagekit.py
|
||||
index 2e80e9eeb..bee4ebaa9 100644
|
||||
--- a/backends/dnf/refresh_packagekit.py
|
||||
+++ b/backends/dnf/notify_packagekit.py
|
||||
@@ -27,11 +27,11 @@
|
||||
from dnfpluginscore import _
|
||||
|
||||
|
||||
-class RefreshPackagekit(dnf.Plugin):
|
||||
- name = "refresh-packagekit"
|
||||
+class NotifyPackagekit(dnf.Plugin):
|
||||
+ name = "notify-packagekit"
|
||||
|
||||
def __init__(self, base, cli):
|
||||
- super(RefreshPackagekit, self).__init__(base, cli)
|
||||
+ super(NotifyPackagekit, self).__init__(base, cli)
|
||||
self.base = base
|
||||
self.cli = cli
|
||||
|
||||
Loading…
Reference in New Issue
Block a user