On Sun, 2014-06-01 at 18:03 +0200, Lars Ellenberg wrote:
> On Fri, May 30, 2014 at 05:18:19PM -0400, James Antill wrote:
> > On Fri, 2014-05-30 at 16:46 +0200, Lars Ellenberg wrote:
> > > Hi there.
> > > (Cc me, I'm not subscribed)
> > > 
> > > I've got a "yum check" taking two hours.
> > > (really single core CPU time, actually, not much IO going on there, 
> > > afaics)
> > 
> >  That is not normal. Whenever I've seen this kind of problem it's always
> > been a problem in the rpm indexes, rpm --rebuilddb might help.
> 
> Did that.
> Does not help.

 Ok, please try the attached patch[1]. It directly asks the rpm indexes
for an answer, and doesn't bother doing any of the yum side stuff as we
already know the answer.


[1] It's measurably faster here, for normal/sane pkgs. But then it's
doing a lot less :).

commit b810d119c89f1995662bc1c8d4d9aa8b25786149
Author: James Antill <ja...@and.org>
Date:   Mon Jun 2 13:04:03 2014 -0400

    Have check provides check directly against the rpm index, and then quit.

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 138e53f..2d718c1 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -1633,14 +1633,31 @@ class RPMDBPackageSack(PackageSackBase):
                 problems.append(RPMDBProblemObsoleted(pkg, obsoleter=obspo))
         return problems
 
+    def _check_provides_get(self, pkg, provtup):
+        """ This is kind of a super quick version of getProvides(), because all
+            we really care about is that the rpm provides index is functional.
+            We already know the answer to the provides. """
+
+        if False: # This is the slow/steady way...
+            name, flags, version = provtup
+            return pkg in self.getProvides(name, flags, version)
+
+        prcotype = 'provides'
+        n = provtup[0]
+        tag = self.DEP_TABLE[prcotype][0]
+        for hdr, idx in self._get_packages(tag, misc.to_utf8(n)):
+            po = self._makePackageObject(hdr, idx)
+            if po == pkg:
+                return True
+        return False
+
     def check_provides(self):
         """ For each package, check that a provides search for it's name (and
             everything it provides) finds it. """
         problems = []
         for pkg in sorted(self.returnPackages()):
             for provtup in pkg.provides:
-                name, flags, version = provtup
-                if pkg not in self.getProvides(name, flags, version):
+                if not self._check_provides_get(pkg, provtup):
                     problems.append(RPMDBProblemProvides(pkg, provide=provtup))
                     break
         return problems
_______________________________________________
Yum-devel mailing list
Yum-devel@lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to