[Yum-devel] Accumulated patches, time to drop or add? [1/4]

James Antill james.antill at redhat.com
Tue Jul 22 16:46:16 UTC 2008


 I have 4 branches which might be worth putting in for 3.2.18, everyone
may or maynot have looked at them before and they aren't "obviously
simple/wonderful" enough I've just committed them, so I'll just list
them and you can tell me what you think...

*  _quickWhatProvides
   group_pc
   repo-sacks
   repomd-checksums

  _quickWhatProvides

 The idea with this is when we get a provider of a requirement, when we
do the next requirement we check to see if the previous provider has it.
I think this is valid, and won't change anything ... but I'm not 100%.
Doing this speeds up matches where you have pkgA with _lots_ of deps. on
pkgB (the kernel people want to do this kind of thing).

-------------- next part --------------
commit 80bb298618570c85a2ac72b37c9009ebf1af235e
Author: James Antill <james at and.org>
Date:   Wed Jun 11 12:36:18 2008 -0400

     Try and solve the 666 requires on a single package problem, the
    kernel people want to try this for ABI stuff (each symbol is a provides).

diff --git a/yum/depsolve.py b/yum/depsolve.py
index 2577cef..ee57915 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -396,7 +396,24 @@ class Depsolve(object):
 
         return checkdeps, missingdep
         
+    def _quickWhatProvides(self, name, flags, version):
+        if self._last_req is None:
+            return False
 
+        if flags == 0:
+            flags = None
+        if type(version) in (types.StringType, types.NoneType, types.UnicodeType):
+            (r_e, r_v, r_r) = rpmUtils.miscutils.stringToVersion(version)
+        elif type(version) in (types.TupleType, types.ListType): # would this ever be a ListType?
+            (r_e, r_v, r_r) = version
+        
+        # Quick lookup, lots of reqs for one pkg:
+        po = self._last_req
+        if po.checkPrco('provides', (name, flags, (r_e, r_v, r_r))):
+            self.verbose_logger.debug(_('Quick matched %s to require for %s'), po, name)
+            return True
+        return False
+        
     def _requiringFromTransaction(self, requiringPo, requirement, errorlist):
         """processes the dependency resolution for a dep where requiring 
            package is in the transaction set"""
@@ -427,8 +444,10 @@ class Depsolve(object):
         #                   - if they are the same
         #                       - be confused but continue
 
-        provSack = self.whatProvides(needname, needflags, needversion)
+        if self._quickWhatProvides(needname, needflags, needversion):
+            return checkdeps, missingdep
 
+        provSack = self.whatProvides(needname, needflags, needversion)
         # get rid of things that are already in the rpmdb - b/c it's pointless to use them here
 
         for pkg in provSack.returnPackages():
@@ -483,8 +502,8 @@ class Depsolve(object):
                     _('%s already in ts, skipping this one'), pkg)
                 # FIXME: Remove this line, if it is not needed ?
                 # checkdeps = 1
+                self._last_req = pkg
                 return checkdeps, missingdep
-        
 
         # find the best one 
 
@@ -496,6 +515,7 @@ class Depsolve(object):
             for txmbr in results:
                 if pkg == txmbr.po:
                     checkdeps = True
+                    self._last_req = pkg
                     return checkdeps, missingdep
 
         # find out which arch of the ones we can choose from is closest
@@ -531,11 +551,13 @@ class Depsolve(object):
             txmbr = self.tsInfo.addUpdate(best, inst[0])
             txmbr.setAsDep(po=requiringPo)
             txmbr.reason = "dep"
+            self._last_req = best
         else:
             self.verbose_logger.debug(_('TSINFO: Marking %s as install for %s'), best,
                 requiringPo)
             txmbr = self.tsInfo.addInstall(best)
             txmbr.setAsDep(po=requiringPo)
+            self._last_req = best
 
             # if we had other packages with this name.arch that we found
             # before, they're not going to be installed anymore, so we
@@ -627,6 +649,7 @@ class Depsolve(object):
 
         self.po_with_problems = set()
         self._working_po = None
+        self._last_req = None
         self.tsInfo.resetResolved(hard=False)
 
         CheckDeps = True
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.baseurl.org/pipermail/yum-devel/attachments/20080722/bfefa300/attachment.pgp 


More information about the Yum-devel mailing list