[Yum-devel] [PATCH] Use state-aware filename rpmdb index if rpm supports it

Panu Matilainen pmatilai at laiskiainen.org
Wed Aug 31 08:44:05 UTC 2011


This fixes some cases where yum depsolver and rpm >= 4.9.0
disagree on dependencies on removal (including but not limited
to the example in BZ 729973), causing "ERROR with transaction check
vs depsolve" errors. The state-aware file index is currently only
in rpm.org HEAD but likely to get backported to 4.9.x series.

Also it requires 'yum clean rpmdb' on first go to wipe previously cached
data, pointing out another problem: the state-aware files index is dynamic,
and should not be cached across transactions as a transaction can change
file states of packages that aren't included in that transaction.
---
 yum/rpmsack.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 635f03f..dd5ac04 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -442,13 +442,19 @@ class RPMDBPackageSack(PackageSackBase):
         """search the filelists in the rpms for anything matching name"""
 
         result = {}
+
+        # Use filestate-aware filename index if available
+        if hasattr(rpm, 'RPMDBI_INSTFILENAMES'):
+            fntag = 'instfilenames'
+        else:
+            fntag = 'basenames'
         
         name = os.path.normpath(name)
         # Note that globs can't be done. As of 4.8.1:
         #   mi.pattern('basenames', rpm.RPMMIRE_GLOB, name)
         # ...produces no results.
 
-        for hdr, idx in self._get_packages('basenames', name):
+        for hdr, idx in self._get_packages(fntag, name):
             pkg = self._makePackageObject(hdr, idx)
             result.setdefault(pkg.pkgid, pkg)
 
-- 
1.7.6



More information about the Yum-devel mailing list