Bug 507702

Summary: obsoletes cannot be matched in rpm-python interface
Product: [Fedora] Fedora Reporter: seth vidal <svidal>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 11CC: ffesti, james.antill, jnovy, n3npq, pmatilai, sundaram, tcallawa
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 507701 Environment:
Last Closed: 2009-07-22 20:59:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 505996    

Description seth vidal 2009-06-23 20:01:52 UTC
Description of problem:

Debugging a yum depsolving problem I noticed I wasn't getting results back when I checked to see if an installed package obsoleted a package that was being proposed to be installed.

I started testing various tests and found that nothing is ever returned as matching obsoletes by name or complete. 

Example code:
import rpm
ts = rpm.TransactionSet()
mi = ts.dbMatch(1090, 'mod_gzip')
for hdr in mi:
    print hdr['name']

on the system I have it  should return 'httpd', at the least.

I also tested it using rpm.RPMTAG_OBSOLETES, rpm.RPMTAG_OBSOLETENAME  to no avail.

Finally, I noticed some odd output in rpm -qa --obsoletes for example:

in any case - I'm pretty sure ts.dbMatch() used to work against obsoletes, but it doesn't seem to work anymore.

Comment 1 Jeff Johnson 2009-06-24 02:17:28 UTC
rpm.RPMTAG_OBSOLETENAME is the "official" tag name. Other
aliases can and do wander off.

If /var/lib/rpm/Obsoletename doesn't exist, then you
need to add to the tag indices that are built and do --rebuilddb.

You also have to ensure that the index is populated, empty
indices are not 0b in length.

But  using 1090 should iterate the /var/lib/rpm/Obsoletename
index no matter what names/aliases are attached, and
    rpm -q --qf '%(name}\n' --obsoletes mod_gzip
should be equivalent to the python code that you have supplied, which
gives you a double check on your expectations.

Have fun!

Comment 2 Panu Matilainen 2009-06-24 07:30:16 UTC
There's no index on obsoletes so match iterator can't be used to look for them, that's always been the case AFAIK. Adding indexes is easy, but it requires --rebuilddb to become usable so doing it in updates is a bit nasty.

Comment 3 seth vidal 2009-06-24 13:03:50 UTC
interesting. Well this makes things kinda painful b/c walking each package is not going to be quick enough.

Comment 4 Rahul Sundaram 2009-07-22 20:59:26 UTC
According to rawhide report, rpm 4.7.1 is included and that fixes the problem