[Yum-devel] [PATCH 3/3] fix for testRL_dcbd1 unittest -

Seth Vidal skvidal at fedoraproject.org
Thu Apr 8 18:07:42 UTC 2010


When we're doing an install for dep - make sure what we're installing provides for the thing we need.
this should really only ever happen on the obsolete pathway.

provides_for as a kwarg should probably be added to update(), too.
---
 yum/__init__.py |    7 ++++++-
 yum/depsolve.py |   32 +++++++++++++++++++-------------
 2 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 917fa1f..d83da8d 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -3037,8 +3037,13 @@ class YumBase(depsolve.Depsolve):
                     self.verbose_logger.warning(_('Package %s is obsoleted by %s which is already installed'), 
                                                 po, already_obs)
                 else:
+                    if 'provides_for' in kwargs:
+                        if not obsoleting_pkg.provides_for(kwargs['provides_for']):
+                            self.verbose_logger.warning(_('Package %s is obsoleted by %s, but obsoleting package does not provide for requirements'),
+                                                  po.name, obsoleting_pkg.name)
+                            continue
                     self.verbose_logger.warning(_('Package %s is obsoleted by %s, trying to install %s instead'),
-                        po.name, obsoleting_pkg.name, obsoleting_pkg)               
+                        po.name, obsoleting_pkg.name, obsoleting_pkg)
                     tx_return.extend(self.install(po=obsoleting_pkg))
                 continue
             
diff --git a/yum/depsolve.py b/yum/depsolve.py
index f654d84..48f77d5 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -562,19 +562,25 @@ class Depsolve(object):
         else:
             self.verbose_logger.debug(_('TSINFO: Marking %s as install for %s'), best,
                 requiringPo)
-            # FIXME: Don't we want .install() here, so obsoletes get done?
-            txmbr = self.tsInfo.addInstall(best)
-            txmbr.setAsDep(po=requiringPo)
-            txmbr.reason = "dep"
-            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
-            # should mark them to be re-checked
-            if best.pkgtup in upgraded:
-                map(self.tsInfo.remove, upgraded[best.pkgtup])
-
-        checkdeps = 1
+            reqtuple = misc.string_to_prco_tuple(needname + str(needflags) + needversion)
+            txmbrs = self.install(best, provides_for=reqtuple)
+            for txmbr in txmbrs:
+                txmbr.setAsDep(po=requiringPo)
+                txmbr.reason = "dep"
+                self._last_req = txmbr.po
+
+                # if we had other packages with this name.arch that we found
+                # before, they're not going to be installed anymore, so we
+                # should mark them to be re-checked
+                if txmbr.pkgtup in upgraded:
+                    map(self.tsInfo.remove, upgraded[txmbr.pkgtup])
+            if not txmbrs:
+                missingdep = 1
+                checkdeps = 0
+                msg = self._err_missing_requires(requiringPo, requirement)
+                errorlist.append(msg)
+            else:
+                checkdeps = 1
         
         return checkdeps, missingdep
 
-- 
1.6.6



More information about the Yum-devel mailing list