Bug 507702 - obsoletes cannot be matched in rpm-python interface
Summary: obsoletes cannot be matched in rpm-python interface
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 11
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Panu Matilainen
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: 505996
TreeView+ depends on / blocked
Reported: 2009-06-23 20:01 UTC by seth vidal
Modified: 2013-07-29 01:57 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 507701
Last Closed: 2009-07-22 20:59:26 UTC
Type: ---

Attachments (Terms of Use)

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

Note You need to log in before you can comment on or make changes to this bug.