[yum-git] 2 commits - yum/depsolve.py

Florian Festi ffesti at linux.duke.edu
Mon May 26 09:57:31 UTC 2008


 yum/depsolve.py |   72 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 42 insertions(+), 30 deletions(-)

New commits:
commit bec9421eb464da4af918b0325f75bed0eb65f35c
Author: Florian Festi <ffesti at redhat.com>
Date:   Mon Feb 18 14:21:07 2008 +0100

    Restart .check* every time the tsInfo got modified to only resolve problems that still exist

diff --git a/yum/depsolve.py b/yum/depsolve.py
index 1fe8657..cc5ba2c 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -611,10 +611,17 @@ class Depsolve(object):
             # check global FileRequires
             if CheckRemoves:
                 CheckRemoves = False
-                for po, dep in self._checkFileRequires():
-                    (checkdep, missing, errormsgs) = self._processReq(po, dep)
-                    CheckDeps |= checkdep
-                    errors += errormsgs
+                filerequires = self._checkFileRequires()
+                while True:
+                    for po, dep in filerequires:
+                        (checkdep, missing, errormsgs) = self._processReq(po, dep)
+                        CheckDeps |= checkdep
+                        errors += errormsgs
+                        if CheckDeps:
+                            filerequires = self._checkFileRequires()
+                            break
+                    else:
+                        break # end while loop if for loop ran through
 
                 if CheckDeps:
                     if self.dsCallback: self.dsCallback.restartLoop()
@@ -624,10 +631,17 @@ class Depsolve(object):
             # check Conflicts
             if CheckInstalls:
                 CheckInstalls = False
-                for conflict in self._checkConflicts():
-                    (checkdep, errormsgs) = self._processConflict(*conflict)
-                    CheckDeps |= checkdep
-                    errors += errormsgs
+                conflicts = self._checkConflicts()
+                while True:
+                    for conflict in conflicts:
+                        (checkdep, errormsgs) = self._processConflict(*conflict)
+                        CheckDeps |= checkdep
+                        errors += errormsgs
+                        if checkdep:
+                            conflicts = self._checkConflicts()
+                            break
+                    else:
+                        break # end while loop if for loop ran through
 
                 if CheckDeps:
                     if self.dsCallback: self.dsCallback.restartLoop()
@@ -693,11 +707,21 @@ class Depsolve(object):
                 CheckRemoves = True
 
             missing_in_pkg = False
-            for po, dep in thisneeds:
-                (checkdep, missing, errormsgs) = self._processReq(po, dep)
-                CheckDeps |= checkdep
-                errors += errormsgs
-                missing_in_pkg |= missing
+
+            while True:
+                for po, dep in thisneeds:
+                    (checkdep, missing, errormsgs) = self._processReq(po, dep)
+                    CheckDeps |= checkdep
+                    errors += errormsgs
+                    missing_in_pkg |= missing
+                    if checkdep:
+                        if (txmbr.output_state in TS_INSTALL_STATES) == (txmbr.po.state != None):
+                            thisneeds = self._checkInstall(txmbr)
+                        else:
+                            thisneeds = self._checkRemove(txmbr)
+                        break
+                else:
+                    break
 
             if not missing_in_pkg:
                 self.tsInfo.markAsResolved(txmbr)
commit 58e9cbd609d9225ea9a7e3a0262362eb976973e1
Author: Florian Festi <ffesti at redhat.com>
Date:   Mon Feb 18 13:56:19 2008 +0100

    Make Depsolve.check* generators instead of returning lists

diff --git a/yum/depsolve.py b/yum/depsolve.py
index 190f33b..1fe8657 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -718,7 +718,6 @@ class Depsolve(object):
             oldreqs.extend(oldpo.returnPrco('requires'))
         oldreqs = set(oldreqs)
 
-        ret = []
         for req in txmbr_reqs:
             if req[0].startswith('rpmlib('):
                 continue
@@ -730,8 +729,7 @@ class Depsolve(object):
             self.verbose_logger.log(logginglevels.DEBUG_2, _("looking for %s as a requirement of %s"), req, txmbr)
             provs = self.tsInfo.getProvides(*req)
             if not provs:
-                ret.append( (txmbr.po, (req[0], req[1], version_tuple_to_string(req[2]))) )
-                continue
+                yield (txmbr.po, (req[0], req[1], version_tuple_to_string(req[2])))
 
             #Add relationship
             for po in provs:
@@ -741,8 +739,6 @@ class Depsolve(object):
                     pkgtup=po.pkgtup, output_states=TS_INSTALL_STATES):
                     member.relatedto.append((txmbr.po, 'dependson'))
 
-        return ret
-
     def _checkRemove(self, txmbr):
         po = txmbr.po
         provs = po.returnPrco('provides')
@@ -753,7 +749,6 @@ class Depsolve(object):
         for newpo in txmbr.updated_by:
             for p in newpo.provides:
                 newpoprovs[p] = 1
-        ret = []
         
         # iterate over the provides of the package being removed
         # and see what's actually going away
@@ -765,13 +760,11 @@ class Depsolve(object):
             for pkg, hits in self.tsInfo.getRequires(*prov).iteritems():
                 for rn, rf, rv in hits:
                     if not self.tsInfo.getProvides(rn, rf, rv):
-                        ret.append( (pkg, (rn, rf, version_tuple_to_string(rv))) )
-        return ret
+                        yield (pkg, (rn, rf, version_tuple_to_string(rv)))
 
     def _checkFileRequires(self):
         fileRequires = set()
         reverselookup = {}
-        ret = []
 
         # generate list of file requirement in rpmdb
         if self.installedFileRequires is None:
@@ -818,13 +811,9 @@ class Depsolve(object):
         for filename in fileRequires:
             if not self.tsInfo.getOldProvides(filename) and not self.tsInfo.getNewProvides(filename):
                 for po in reverselookup[filename]:
-                    ret.append( (po, (filename, 0, '')) )
-
-        return ret
-
+                    yield (po, (filename, 0, ''))
 
     def _checkConflicts(self):
-        ret = [ ]
         for po in self.rpmdb.returnPackages():
             if self.tsInfo.getMembersWithState(po.pkgtup, output_states=TS_REMOVE_STATES):
                 continue
@@ -833,7 +822,7 @@ class Depsolve(object):
                 for conflicting_po in self.tsInfo.getNewProvides(r, f, v):
                     if conflicting_po.pkgtup[0] == po.pkgtup[0] and conflicting_po.pkgtup[2:] == po.pkgtup[2:]:
                         continue
-                    ret.append( (po, (r, f, version_tuple_to_string(v)), conflicting_po) )
+                    yield (po, (r, f, version_tuple_to_string(v)), conflicting_po)
         for txmbr in self.tsInfo.getMembersWithState(output_states=TS_INSTALL_STATES):
             po = txmbr.po
             for conflict in txmbr.po.returnPrco('conflicts'):
@@ -841,8 +830,7 @@ class Depsolve(object):
                 for conflicting_po in self.tsInfo.getProvides(r, f, v):
                     if conflicting_po.pkgtup[0] == po.pkgtup[0] and conflicting_po.pkgtup[2:] == po.pkgtup[2:]:
                         continue
-                    ret.append( (po, (r, f, version_tuple_to_string(v)), conflicting_po) )
-        return ret
+                    yield (po, (r, f, version_tuple_to_string(v)), conflicting_po)
 
 
     def isPackageInstalled(self, pkgname):



More information about the Yum-cvs-commits mailing list