From 7fc12434ea11fcb134ac50c8d003c7c3dc982340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Tue, 21 May 2024 15:24:30 +0200 Subject: [PATCH] Fix reporting nothing-to-do for "dnf remove --oldinstallonly" Resolves: RHEL-6424 --- ...lonly-when-no-old-installonly-packag.patch | 38 +++++++++++++++++++ dnf.spec | 2 + 2 files changed, 40 insertions(+) create mode 100644 0022-remove-oldinstallonly-when-no-old-installonly-packag.patch diff --git a/0022-remove-oldinstallonly-when-no-old-installonly-packag.patch b/0022-remove-oldinstallonly-when-no-old-installonly-packag.patch new file mode 100644 index 0000000..38e2c68 --- /dev/null +++ b/0022-remove-oldinstallonly-when-no-old-installonly-packag.patch @@ -0,0 +1,38 @@ +From 1e78096d569eecbd3201c821cb3484328caf8789 Mon Sep 17 00:00:00 2001 +From: Pavla Kratochvilova +Date: Fri, 5 Apr 2024 14:43:04 +0200 +Subject: [PATCH 2/2] remove --oldinstallonly: when no old installonly + packages, exit with 0 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream commit: 87eb5a7a3561381b5ef5e70548f49288251300fc + +If no old installonly packages are present, then the command succesfully +removed all of them and should exit with 0 and write the message to +stdout instead of stderr. + +Resolves: https://issues.redhat.com/browse/RHEL-6424 +Signed-off-by: Petr Písař +--- + dnf/cli/commands/remove.py | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/dnf/cli/commands/remove.py b/dnf/cli/commands/remove.py +index af9622fd..32e78d6d 100644 +--- a/dnf/cli/commands/remove.py ++++ b/dnf/cli/commands/remove.py +@@ -124,8 +124,7 @@ class RemoveCommand(commands.Command): + for pkg in instonly: + self.base.package_remove(pkg) + else: +- raise dnf.exceptions.Error( +- _('No old installonly packages found for removal.')) ++ logger.info(_('No old installonly packages found for removal.')) + return + + # Remove groups. +-- +2.45.0 + diff --git a/dnf.spec b/dnf.spec index 65e9c34..9bb9db6 100644 --- a/dnf.spec +++ b/dnf.spec @@ -96,6 +96,7 @@ Patch18: 0018-Remove-leaf-word-from-documentation.patch Patch19: 0019-Update-documentation-of-history-userinstalled-comman.patch Patch20: 0020-automatic-Use-add_security_filters-not-_update_secur.patch Patch21: 0021-remove-duplicates-when-no-duplicates-exit-with-0-RHE.patch +Patch22: 0022-remove-oldinstallonly-when-no-old-installonly-packag.patch BuildArch: noarch BuildRequires: cmake @@ -386,6 +387,7 @@ popd %changelog * Tue May 21 2024 Petr Pisar - 4.14.0-12 - Fix reporting nothing-to-do for "dnf remove --duplicates" (RHEL-6424) +- Fix reporting nothing-to-do for "dnf remove --oldinstallonly" (RHEL-6424) * Mon May 06 2024 Petr Pisar - 4.14.0-11 - Fix handling an installation reason of install-only packages on autoremove