diff --git a/0039-autoremove-warn-and-skip-dangling-protected-dependen.patch b/0039-autoremove-warn-and-skip-dangling-protected-dependen.patch new file mode 100644 index 0000000..93cb1ee --- /dev/null +++ b/0039-autoremove-warn-and-skip-dangling-protected-dependen.patch @@ -0,0 +1,43 @@ +From 93a1bdc09ad6ef345cf8cecc059b649ee2ccbf40 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= +Date: Mon, 26 Jan 2026 12:29:11 +0100 +Subject: [PATCH 1/2] autoremove: warn and skip dangling protected dependencies + +Requires new libdnf 0.76.0 API. +--- + dnf/base.py | 18 ++++++++++++++++-- + 1 file changed, 16 insertions(+), 2 deletions(-) + +diff --git a/dnf/base.py b/dnf/base.py +index 7117dbe3..1d6ae6e2 100644 +--- a/dnf/base.py ++++ b/dnf/base.py +@@ -2311,9 +2311,23 @@ class Base(object): + logger.warning(_('No packages marked for removal.')) + + else: +- pkgs = self.sack.query()._unneeded(self.history.swdb, ++ unneeded_pkgs = self.sack.query()._unneeded(self.history.swdb, + debug_solver=self.conf.debug_solver) +- for pkg in pkgs: ++ ++ protected = self.sack.query().installed().filterm(name=self.conf.protected_packages) ++ protected_found = False ++ for pkg in protected: ++ if pkg in unneeded_pkgs: ++ msg = _('Unneeded protected package: %s (and its dependencies) cannot be removed, ' ++ 'either mark it as user-installed or change protected_packages configuration option.') ++ logger.warning(msg, pkg) ++ protected_found = True ++ ++ if protected_found: ++ unneeded_pkgs = self.sack.query()._unneeded_extra_userinstalled(self.history.swdb, protected, ++ debug_solver=self.conf.debug_solver) ++ ++ for pkg in unneeded_pkgs: + self.package_remove(pkg) + + def remove(self, pkg_spec, reponame=None, forms=None): +-- +2.53.0 + diff --git a/dnf.spec b/dnf.spec index bc40e40..94bf358 100644 --- a/dnf.spec +++ b/dnf.spec @@ -24,7 +24,7 @@ %endif %if 0%{?rhel} == 10 - %global hawkey_version 0.73.1-11 + %global hawkey_version 0.73.1-14 %endif # override dependencies for fedora 26 @@ -72,7 +72,7 @@ It supports RPMs, modules and comps groups & environments. Name: dnf Version: 4.20.0 -Release: 20%{?dist}.alma.1 +Release: 21%{?dist}.alma.1 Summary: %{pkg_summary} # For a breakdown of the licensing, see PACKAGE-LICENSING License: GPL-2.0-or-later AND GPL-1.0-only @@ -116,6 +116,7 @@ Patch35: 0035-Add-modularity-deprecation-warning-to-doc-pages.patch Patch36: 0036-automatic-Fix-detecting-releasever_minor.patch Patch37: 0037-automatic-Expand-email_to-in-command_email-emitter-t.patch Patch38: 0038-rpmkeys-Ignore-untrusted-signatures-if-there-is-trus.patch +Patch39: 0039-autoremove-warn-and-skip-dangling-protected-dependen.patch # AlmaLinux Patch Patch1001: 0001-Add-link-to-AlmaLinux-bugtracker.patch @@ -481,10 +482,14 @@ popd # bootc subpackage does not include any files %changelog -* Sat Feb 14 2026 Eduard Abdullin - 4.20.0-20.alma.1 +* Tue Feb 17 2026 Eduard Abdullin - 4.20.0-21.alma.1 - Add x86_64_v2 to _BASEARCH_MAP - Add link to AlmaLinux bugtracker +* Mon Feb 16 2026 Ales Matej - 4.20.0-21 +- autoremove: when a dangling protected dependency is found produce a warning + and skip it (RHEL-128445) + * Fri Jan 23 2026 Petr Pisar - 4.20.0-20 - Ignore untrusted signatures if there is trusted one (RHEL-112730)