Bug 2119691
| Summary: | Lack of "leaves options" in the DNF replacement for package-cleanup | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Christophe Besson <cbesson> |
| Component: | dnf | Assignee: | Jaroslav Mracek <jmracek> |
| Status: | CLOSED DUPLICATE | QA Contact: | swm-qe |
| Severity: | medium | Docs Contact: | |
| Priority: | low | ||
| Version: | 8.6 | CC: | amkulkar, james.antill, jcastran |
| Target Milestone: | rc | Keywords: | FutureFeature, Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-03-20 11:17:08 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Thank you very much for the report. There are two different approaches how to manage leave packages on the system. The first of all - using reason - internal information how package was installed to the system. The information is used for removal operation or by `dnf autoremove` to remove unused dependencies.
Or using leave plugin that compute dependencies tree and then report the top packages as leave.
For systems that are deployed and maintain by dnf (including Anaconda) the first approach is sufficient.
To check all reasons for installed packages you can use 'dnf repoquery --installed --qf "%{name}.%{arch} %{reason}"'
As you can see it is not easy subject therefore we need more specific information what the customer want to achieved rather how it was achieved in the past.
The reason can give the same result most of the time, but it's not the same. If the user installed all packages with a glob (dnf install ipg-*), the reason will be "user" for the 3 pkgs. Whereas the previous command printed only "ipg-foo" in both cases because it has no dependency. --unneeded gives only a subset (the libs) of `package-cleanup --leaves --all`. Indeed the DNF leave plugin would help to provide the same feature but AFAICS it does not seem shipped with RHEL 8. I can see leaves.py in the src.rpm, but the file is not included in the dnf-plugins-core rpm or in a separate pkg (python3-dnf-leaves?) Leave plugin is not yet available in RHEL but it is available in Fedora - therefore for testing you can use a fedora build (documentation - https://dnf-plugins-core.readthedocs.io/en/latest/leaves.html). We've got a request to delivery the leave plugin to RHEL -Bug 2134638 - Please enable the leaves and show-leaves DNF plugins. If you think that this is a solution, I will close the bug as a duplicate. Do you need anything specific for testing for leave plugin? What we could - add leave and show-leaves plugin to RHEL9 What would be very difficult - add a new option, plugin to RHEL8 - to late in lifecycle of RHEL8 I have suggestion for RHEL8 If you use `dnf install ipg-*` all of packages matching `ipg-*` are marked as user installed. If user don't want to handle them as user installed - it is possible to mark them as dependency - `dnf mark remove ipg-*` and then mark some of the packages from them as a user installed `dnf mark install ipg-<something>`. See documentation - https://dnf.readthedocs.io/en/latest/command_ref.html#mark-command-label If the workaround is ok and the solution for RHEL9 is not acceptable for the customer - then I will close it as wontfix. May I ask you to share with me your preferences how to handle the bug report? Because there is no response I am closing the bug as duplicate with bug requesting Leave and show leave plugin in RHEL9. *** This bug has been marked as a duplicate of bug 2134638 *** Sorry for the late reply, it has been suggested to the customer last week but no feedback. It is indeed late for the RHEL 8 lifecycle. |
Description of problem: RHEL 7 (and RHEL 6 as well) provided a set of features for which there is no obvious replacement. The customer was using the below command to find out the RPMs that were installed on the host on which nothing else currently installed depends. On RHEL 6/7: # /usr/bin/package-cleanup --disablerepo="*" --enablerepo="ipgtest" --noplugins --leaves --leaf-regex="^(ipg)" ipg-foo-1.0-1.noarch On RHEL 8: # /usr/bin/package-cleanup --disablerepo="*" --enablerepo="ipgtest" --noplugins --leaves --leaf-regex="^(ipg)" usage: dnf repoquery [-c [config file]] [-q] [-v] [--version] <--cut--> dnf repoquery: error: unrecognized arguments: --leaf-regex=^(ipg) The command "package-cleanup --leaves" has been mapped to "dnf repoquery --unneeded". Both commands return the same output, which is limited to the libraries. It seems there are no alternatives for the --all and --leaf-regex options: LEAVES OPTIONS --all When listing leaf nodes also list leaf nodes that are not libraries. --leaf-regex A package name that matches this regular expression will be considered a leaf. --exclude-devel When listing leaf nodes do not list development packages. --exclude-bin When listing leaf nodes do not list packages with files in bin directories. Version-Release number of selected component (if applicable): dnf-4.7.0-8.el8.noarch libdnf-0.63.0-8.el8.x86_64 How reproducible: Always Steps to Reproduce: 1. Create a set of 3 fake RPMs, ipg-foo depending on ipg-bar, itself depending on ipg-baz (without any dep) 2. Put them in a repo and install them 3. Run the command mentioned in the description Actual results: dnf repoquery: error: unrecognized arguments: --leaf-regex=^(ipg) Expected results: Implement old options or provides an alternative. Additional info: As a workaround, the customer uses the RPM command to see which packages have no deps on the installed system: # for i in `rpm -q -g ipg` ; do rpm --test -e $i 2>/dev/null && echo $i ; done