automatic: Backport patches

- upstream commit 130d6b91694a93a142be8c3767bfc711245dea1c to resolve
  error in dnf.exceptions.Error class instantiating
- upstream commit 193e3f4e212e1fafcd24faad7f026ea05d2f97b9 to match
  dnf-automatic need_reboot behavior to that of `dnf needs-restarting`

Resolves: RHEL-45505
Resolves: RHEL-62830
This commit is contained in:
Marek Blaha 2024-12-12 11:01:38 +01:00
parent d051179d8c
commit 8f8fd5155f
3 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,29 @@
From ed14b8c8425c6fb6dbade3028ac0118086052b1b Mon Sep 17 00:00:00 2001
From: Klaas Demter <Klaas-@users.noreply.github.com>
Date: Tue, 15 Oct 2024 11:58:15 +0200
Subject: [PATCH] Update need_reboot for dnf-automatic
The need_reboot from dnf-automatic did not match NEED_REBOOT from
needs-restarting.
---
dnf/base.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dnf/base.py b/dnf/base.py
index 13222407..168207b5 100644
--- a/dnf/base.py
+++ b/dnf/base.py
@@ -2832,8 +2832,8 @@ class Base(object):
# List taken from DNF needs-restarting
need_reboot = frozenset(('kernel', 'kernel-rt', 'glibc',
- 'linux-firmware', 'systemd', 'dbus',
- 'dbus-broker', 'dbus-daemon'))
+ 'linux-firmware', 'systemd', 'dbus',
+ 'dbus-broker', 'dbus-daemon', 'microcode_ctl'))
changed_pkgs = self.transaction.install_set | self.transaction.remove_set
return any(pkg.name in need_reboot for pkg in changed_pkgs)
--
2.47.1

View File

@ -0,0 +1,27 @@
From c57c26e0cf8a3bba061f5ddf619c40f36a94aab9 Mon Sep 17 00:00:00 2001
From: Marek Blaha <mblaha@redhat.com>
Date: Thu, 12 Dec 2024 08:09:48 +0100
Subject: [PATCH] automatic: Fix incorrect Error class instantiation
dnf.exceptions.Error class constructor accepts only one argument - error
message.
---
dnf/automatic/main.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dnf/automatic/main.py b/dnf/automatic/main.py
index 5ca4ad39..51057dfb 100644
--- a/dnf/automatic/main.py
+++ b/dnf/automatic/main.py
@@ -378,7 +378,7 @@ def main(args):
(conf.commands.reboot == 'when-needed' and base.reboot_needed())):
exit_code = os.waitstatus_to_exitcode(os.system(conf.commands.reboot_command))
if exit_code != 0:
- raise dnf.exceptions.Error('reboot command returned nonzero exit code: %d', exit_code)
+ raise dnf.exceptions.Error('reboot command returned nonzero exit code: %d' % exit_code)
except Exception as exc:
logger.error(_('Error: %s'), ucd(exc))
if conf is not None and conf.emitters.send_error_messages and emitters is not None:
--
2.47.1

View File

@ -69,7 +69,7 @@ It supports RPMs, modules and comps groups & environments.
Name: dnf
Version: 4.14.0
Release: 22%{?dist}
Release: 23%{?dist}
Summary: %{pkg_summary}
# For a breakdown of the licensing, see PACKAGE-LICENSING
License: GPLv2+
@ -110,6 +110,8 @@ Patch32: 0032-Allow-downloadonly-on-read-only-bootc-system.patch
Patch33: 0033-automatic-Check-availability-of-config-file.patch
Patch34: 0034-automatic-emitters-send-error-messages.patch
Patch35: 0035-automatic-Enhance-errors-reporting.patch
Patch36: 0036-Update-need_reboot-for-dnf-automatic.patch
Patch37: 0037-automatic-Fix-incorrect-Error-class-instantiation.patch
BuildArch: noarch
BuildRequires: cmake
@ -398,6 +400,9 @@ popd
%{python3_sitelib}/%{name}/automatic/
%changelog
* Thu Dec 12 2024 Marek Blaha <mblaha@redhat.com> - 4.14.0-23
- automatic: Update need_reboot to match needs-restarting (RHEL-62830)
* Wed Dec 11 2024 Marek Blaha <mblaha@redhat.com> - 4.14.0-22
- automatic: Added feature to allow emitters to invoke on dnf error
(RHEL-45505, RHEL-61882)