[Yum-devel] rpm --requires and primary.xml <requires>

James Antill james at fedoraproject.org
Wed May 6 14:57:35 UTC 2009


On Wed, 2009-05-06 at 10:42 -0400, Seth Vidal wrote:
> 
> On Wed, 6 May 2009, Panu Matilainen wrote:
> 
> > And you'd have to restart yum (or manage to unload and reload the rpm module 
> > entirely) after such update, otherwise yum would still be using the older 
> > librpm.
> 
> > Putting the rpmlib() provides into regular provides of the rpm package would 
> > be wrong as they're runtime dependencies, it'd need a new dependency flag or 
> > such that says so. Which btw would be useful occasionally, I remember a 
> > couple of cases where something like this would've been needed.
> 
> > Well, that's what rpm will tell the user eventually anyway, after a 
> > potentially huge download. I don't see how that's better for the user than 
> > having yum say so before wasting time on downloading stuff that can't be 
> > installed.
> >
> 
> So all I need is:
> 1. how to get the rpm capabilities from the running rpm instance

 This is the bit florian pointed out, roughly (in yum/depsolve):

+    def _getInstalledRpmlibs(self):
+        if hasattr(self, '_cached__getInstalledRpmlibs'):
+            return self._cached__getInstalledRpmlibs
+        self._cached__getInstalledRpmlibs = ret = {}
+        rev_flags = (((rpm.RPMSENSE_EQUAL | rpm.RPMSENSE_GREATER),  'GE'),
+                     ((rpm.RPMSENSE_EQUAL | rpm.RPMSENSE_LESS), 'LE'),
+                     (rpm.RPMSENSE_EQUAL, 'EQ'),
+                     (rpm.RPMSENSE_GREATER, 'GT'),
+                     (rpm.RPMSENSE_LESS, 'LT'))
+        for ds in rpm.ds.Rpmlib():
+            fl = ds.Flags()
+            ufl = None
+            for (rfl, rufl) in rev_flags:
+                if rfl & fl == rfl:
+                    ufl = rufl
+            assert ufl is not None
+            n = ds.N()
+            ret[n] = (n, ufl, rpmUtils.miscutils.stringToVersion(ds.EVR()))
+        return self._cached__getInstalledRpmlibs
+
+    installed_rpmlibs = property(lambda self: self._getInstalledRpmlibs())

...I think I tested this in _checkInstall() with:

         for req in sorted(txmbr_reqs, cmp=self._sort_reqs):
             if req[0].startswith('rpmlib('):
+                print "JDBG:", req
+                ir = self.installed_rpmlibs.get(req[0], None)
+                if ir is None or not rpmUtils.miscutils.rangeCompare(ir, req):
+                    print " ** FAIL", req

...and it "worked", when dealing with a local rpm.

> 2. and then store the rpmlib requires in the repodata - which is just a 
> nice bump in size for comparatively little functionality/benefit. :(

 Not only that, we'd need to change y-m-p (putting them in as normal
requires, is a bad idea IMO) and somehow create compat. code so yum can
use both old and new .sqlite files from the server.

-- 
James Antill <james at fedoraproject.org>
Fedora


More information about the Yum-devel mailing list