Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
The dnf documentation [1] says that the dnf.package.Package.reponame attribute is the "Id of repository the package was installed from (string)." Unfortunately, this attribute is always equal to "@System", no matter the repository a package has been installed from.
[1] https://dnf.readthedocs.io/en/latest/api_package.html?highlight=package#dnf.package.Package.reponame
Version-Release number of selected component (if applicable):
dnf-0:4.2.17-7.el8_2.noarch
rpm-0:4.14.2-37.el8.x86_64
Steps to Reproduce:
Run this piece of python code on RHEL 8.2:
```
import dnf
b = dnf.Base()
b.fill_sack(load_system_repo=True, load_available_repos=False)
for pkg in b.sack.query():
print(pkg.name + '-' + pkg.evr + ': ' + pkg.reponame)
```
Actual results:
The name of the repository from which a package has been installed is always @System:
...
NetworkManager-tui-1:1.22.8-5.el8_2: @System
acl-2.2.53-1.el8: @System
audit-3.0-0.17.20191104git1c2f876.el8: @System
...
Expected results:
I expect the reponame to match the repoid from which each package has been installed, e.g. "@rhel-8-for-x86_64-appstream-rpms".
Additional info:
The undocumented attribute dnf.package.Package._from_repo contains the correct repoid. When I use it instead of the reponame attribute, I get:
...
NetworkManager-tui-1:1.22.8-5.el8_2: @rhel-8-for-x86_64-baseos-rpms
acl-2.2.53-1.el8: @rhel-8-for-x86_64-baseos-rpms
audit-3.0-0.17.20191104git1c2f876.el8: @rhel-8-for-x86_64-baseos-rpms
...
I suggest that this not a bug? In case that you have only installed packages in set, all of them will have "@System" as a repo name, because they are installed. I suggest that you want to look at different value from a private attribute `_from_repo`. Is it what are you looking for?
Using the private attribute dnf.package.Package._from_repo is what I've mentioned in Additional info of the bug description. That's what I'm using as a workaround.
You mention installing packages in set. I'm not sure what that means. But the reponame is @System even for packages installed through dnf as a single package, e.g. by issuing `dnf install nano`. That's the reason it seems to me like a bug.
However, if it's not going to be fixed, at least the documentation should be updated. Because the current "reponame - Id of repository the package was installed from (string)." [1] is wrong now.
[1] https://dnf.readthedocs.io/en/latest/api_package.html?highlight=package#dnf.package.Package.reponame
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (dnf bug fix and enhancement update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2021:1657