From 0ea8afcf1dda180f55800467e02f29fcdf4c319c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Tue, 23 Apr 2024 13:41:29 +0200 Subject: [PATCH] Fix handling an installation reason of install-only packages on autoremove Resolves: RHEL-15902 --- ...andling-installonly-packages-reasons.patch | 41 +++++++++++++++++++ ...onfusing-sentence-from-documentation.patch | 36 ++++++++++++++++ ...-Remove-leaf-word-from-documentation.patch | 36 ++++++++++++++++ ...tion-of-history-userinstalled-comman.patch | 37 +++++++++++++++++ dnf.spec | 10 ++++- 5 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 0016-Fix-handling-installonly-packages-reasons.patch create mode 100644 0017-Remove-confusing-sentence-from-documentation.patch create mode 100644 0018-Remove-leaf-word-from-documentation.patch create mode 100644 0019-Update-documentation-of-history-userinstalled-comman.patch diff --git a/0016-Fix-handling-installonly-packages-reasons.patch b/0016-Fix-handling-installonly-packages-reasons.patch new file mode 100644 index 0000000..e4ec45b --- /dev/null +++ b/0016-Fix-handling-installonly-packages-reasons.patch @@ -0,0 +1,41 @@ +From 657197afd95f387d0c60a288b7cdcbfa914f9cd2 Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Mon, 11 Mar 2024 12:36:48 +0100 +Subject: [PATCH 1/4] Fix handling installonly packages reasons +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream commit: a4d815e4df87f5afbae9d37c7faf6a9871d50b53 + +The original code took the first item from all remaining packages. +It means a random reason and use it to keep installonly package reason. + +Related: https://issues.redhat.com/browse/RHEL-15902 +Closes: https://github.com/rpm-software-management/dnf/issues/2061 +Signed-off-by: Petr Písař +--- + dnf/base.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/dnf/base.py b/dnf/base.py +index adb5ad6f..b8237183 100644 +--- a/dnf/base.py ++++ b/dnf/base.py +@@ -815,9 +815,11 @@ class Base(object): + if erasures: + remaining_installed_query = self.sack.query(flags=hawkey.IGNORE_EXCLUDES).installed() + remaining_installed_query.filterm(pkg__neq=erasures) ++ remaining_installed_query.apply() + for pkg in erasures: +- if remaining_installed_query.filter(name=pkg.name): +- remaining = remaining_installed_query[0] ++ tmp_remaining_installed_query = remaining_installed_query.filter(name=pkg.name, arch=pkg.arch) ++ if tmp_remaining_installed_query: ++ remaining = tmp_remaining_installed_query[0] + ts.get_reason(remaining) + self.history.set_reason(remaining, ts.get_reason(remaining)) + self._ds_callback.pkg_added(pkg, 'e') +-- +2.45.0 + diff --git a/0017-Remove-confusing-sentence-from-documentation.patch b/0017-Remove-confusing-sentence-from-documentation.patch new file mode 100644 index 0000000..bc76137 --- /dev/null +++ b/0017-Remove-confusing-sentence-from-documentation.patch @@ -0,0 +1,36 @@ +From 64ca173adf414354c158e429ffec23e4560bb65f Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Fri, 8 Mar 2024 12:51:26 +0100 +Subject: [PATCH 2/4] Remove confusing sentence from documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream commit: 824a95e1786b460102d9bf4a2cec0ce7973f882e + +Installonly packages are handled by autoremove command in a similar +way like other package. + +Resolves: https://issues.redhat.com/browse/RHEL-15902 +Signed-off-by: Petr Písař +--- + doc/command_ref.rst | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/doc/command_ref.rst b/doc/command_ref.rst +index 0e6cea01..b92a1f10 100644 +--- a/doc/command_ref.rst ++++ b/doc/command_ref.rst +@@ -501,9 +501,6 @@ Autoremove Command + + Removes all "leaf" packages from the system that were originally installed as dependencies of user-installed packages, but which are no longer required by any such package. + +-Packages listed in :ref:`installonlypkgs ` are never automatically removed by +-this command. +- + ``dnf [options] autoremove ...`` + + This is an alias for the :ref:`\remove_command-label` command with clean_requirements_on_remove set to +-- +2.45.0 + diff --git a/0018-Remove-leaf-word-from-documentation.patch b/0018-Remove-leaf-word-from-documentation.patch new file mode 100644 index 0000000..938dfc6 --- /dev/null +++ b/0018-Remove-leaf-word-from-documentation.patch @@ -0,0 +1,36 @@ +From 2ea32ace13f6a30f86e03b690f284c0ec0992a19 Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Fri, 8 Mar 2024 12:56:57 +0100 +Subject: [PATCH 3/4] Remove "leaf" word from documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream commit: a6d4cd745ce27c09d6cdb4302177b2bfed600549 + +Leaf packages term is not define in documentation and it even +represent different set of packages that are showed by leaves command. + +Related: https://issues.redhat.com/browse/RHELDOCS-17711 +Resolves: https://issues.redhat.com/browse/RHEL-15902 +Signed-off-by: Petr Písař +--- + doc/command_ref.rst | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/doc/command_ref.rst b/doc/command_ref.rst +index b92a1f10..8991df2f 100644 +--- a/doc/command_ref.rst ++++ b/doc/command_ref.rst +@@ -499,7 +499,7 @@ Autoremove Command + + ``dnf [options] autoremove`` + +- Removes all "leaf" packages from the system that were originally installed as dependencies of user-installed packages, but which are no longer required by any such package. ++ Removes all packages from the system that were originally installed as dependencies of user-installed packages, but which are no longer required by any such package. + + ``dnf [options] autoremove ...`` + +-- +2.45.0 + diff --git a/0019-Update-documentation-of-history-userinstalled-comman.patch b/0019-Update-documentation-of-history-userinstalled-comman.patch new file mode 100644 index 0000000..abe1735 --- /dev/null +++ b/0019-Update-documentation-of-history-userinstalled-comman.patch @@ -0,0 +1,37 @@ +From c09865aa3af8248c69b7aa064fe6e96f68e03de1 Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Fri, 8 Mar 2024 14:06:26 +0100 +Subject: [PATCH 4/4] Update documentation of history userinstalled command +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream commit: 929d9133971b53eabfd65d989ded0de8f72f95ea + +The described behavior differs from current behavior therefore +it might create a confusion. + +Resolves: https://issues.redhat.com/browse/RHEL-15902 +Signed-off-by: Petr Písař +--- + doc/command_ref.rst | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/doc/command_ref.rst b/doc/command_ref.rst +index 8991df2f..ffb84407 100644 +--- a/doc/command_ref.rst ++++ b/doc/command_ref.rst +@@ -795,8 +795,8 @@ transactions and act according to this information (assuming the + the current state of RPMDB, it will not undo the transaction. + + ``dnf history userinstalled`` +- Show all installonly packages, packages installed outside of DNF and packages not +- installed as dependency. I.e. it lists packages that will stay on the system when ++ Show all packages installed by user, installed from a group or a module profile, and packages ++ installed outside of DNF. I.e. it lists packages that will stay on the system when + :ref:`\autoremove_command-label` or :ref:`\remove_command-label` along with + `clean_requirements_on_remove` configuration option set to True is executed. Note the same + results can be accomplished with ``dnf repoquery --userinstalled``, and the repoquery +-- +2.45.0 + diff --git a/dnf.spec b/dnf.spec index f952772..0587282 100644 --- a/dnf.spec +++ b/dnf.spec @@ -69,7 +69,7 @@ It supports RPMs, modules and comps groups & environments. Name: dnf Version: 4.14.0 -Release: 10%{?dist} +Release: 11%{?dist} Summary: %{pkg_summary} # For a breakdown of the licensing, see PACKAGE-LICENSING License: GPLv2+ @@ -90,6 +90,10 @@ Patch12: 0012-RHEL-11345-Fix-japanese-translations.patch Patch13: 0013-RHEL-6396-Fix-substitution-in-kvp-in-add_new_repo.patch Patch14: 0014-RHEL-6304-base-Add-obsoleters-of-only-latest-versions.patch Patch15: 0015-Add-all-candidates-for-reinstall-to-solver.patch +Patch16: 0016-Fix-handling-installonly-packages-reasons.patch +Patch17: 0017-Remove-confusing-sentence-from-documentation.patch +Patch18: 0018-Remove-leaf-word-from-documentation.patch +Patch19: 0019-Update-documentation-of-history-userinstalled-comman.patch BuildArch: noarch BuildRequires: cmake @@ -378,6 +382,10 @@ popd %{python3_sitelib}/%{name}/automatic/ %changelog +* Mon May 06 2024 Petr Pisar - 4.14.0-11 +- Fix handling an installation reason of install-only packages on autoremove + (RHEL-15902) + * Tue Apr 23 2024 Petr Pisar - 4.14.0-10 - Fix preferring the lowest-cost repositories on a reinstallation (RHEL-25005)