| Summary: | Cannot iterate all packages loaded by load_system_repo from RPM db | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | cqi | ||||
| Component: | hawkey | Assignee: | Ales Kozumplik <akozumpl> | ||||
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 19 | CC: | akozumpl, cqi, jzeleny | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2013-10-01 08:23:58 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: | |||||
| Attachments: |
|
||||||
Hi, this must be the bug we discussed. I'll take a look. The difference in some package names is that hawkey doesn't print out nonzero epoch --- that is probably a bug, I'll have to dig deeper into that. The mismatch in counts is because 'rpm -qa' also outputs the gpg keys kept in rpmdb, which is kind of an RPM-specific hack and we don't return these by design. So it's the other way round: hawkey correctly outputs package epochs if they are nonzero, the default 'rpm -qa' never outputs epochs, which is also the correct behavior for rpm.
If I modify your script slightly, i.e.:
def no_epoch_str(pkg):
return '%s-%s-%s.%s' % (pkg.name, pkg.version, pkg.release, pkg.arch)
def packages_count_from_hawkey():
sack = hawkey.Sack()
sack.load_system_repo()
packages = hawkey.Query(sack)
return map(no_epoch_str, packages)
I get two same outputs for both paths of obtaining the package list, the only difference is that 'rpm -qa' returns the gpgkeys present in the DB as described in comment 2.
Closing this as NOTABUG.
|
Created attachment 805688 [details] simple Python script playing with hawkey Description of problem: Iterating all packages loaded via load_system_repo cannot get same result of command `rpm -aq`. I'm running Fedora 19. And hawkey packages are hawkey-0.3.16-2.git1e5a593.fc19.x86_64 python-hawkey-0.3.16-2.git1e5a593.fc19.x86_64 How reproducible: A Python script is attached. Run the script. Steps to Reproduce: $ python hawkey_script.py Actual results: 1. the total number of packages is not same. hawkey always returns less packages than rpm, no matter what runing the script after installing or updating packages. 2. many packages listed by `rpm -aq` are not included in the result generated by hawkey.