Blame SOURCES/BZ-1330423-skipbroken-installonly-limit-fix.patch

d2a170
commit 3c89608a67ee9fd35d1860c183951dde76464cd0
d2a170
Author: Michal Domonkos <mdomonko@redhat.com>
d2a170
Date:   Fri May 6 13:25:25 2016 +0200
d2a170
d2a170
    skipbroken: don't installonly_limit if new pkg fails. BZ 1330423
d2a170
    
d2a170
    This is a fix up for commit f8c1528.
d2a170
    - Add po instead of txmbr to txmbr.depends_on
d2a170
    - Make sure the depending po is not whatever was last stored in m
d2a170
d2a170
diff --git a/yum/__init__.py b/yum/__init__.py
d2a170
index 764e97d..cd66396 100644
d2a170
--- a/yum/__init__.py
d2a170
+++ b/yum/__init__.py
d2a170
@@ -6459,15 +6459,15 @@ much more problems).
d2a170
                 continue
d2a170
 
d2a170
             if m.name not in found:
d2a170
-                found[m.name] = 1
d2a170
+                found[m.name] = [m.po]
d2a170
             else:
d2a170
-                found[m.name] += 1
d2a170
+                found[m.name].append(m.po)
d2a170
 
d2a170
         for name in found:
d2a170
             installed = self.rpmdb.searchNevra(name=name)
d2a170
             installed = _sort_and_filter_installonly(installed)
d2a170
 
d2a170
-            total = len(installed) + found[name]
d2a170
+            total = len(installed) + len(found[name])
d2a170
             if total <= self.conf.installonly_limit:
d2a170
                 continue # Not adding enough to trigger.
d2a170
 
d2a170
@@ -6479,14 +6479,20 @@ much more problems).
d2a170
                     continue
d2a170
                 if numleft == 0:
d2a170
                     break
d2a170
-                toremove.append((po,m))
d2a170
+                toremove.append((po, found[name]))
d2a170
                 numleft -= 1
d2a170
                         
d2a170
-        for po,rel in toremove:
d2a170
+        for po, newpos in toremove:
d2a170
             txmbr = self.tsInfo.addErase(po)
d2a170
-            # Add a dep relation to the new version of the package, causing this one to be erased
d2a170
-            # this way skipbroken, should clean out the old one, if the new one is skipped
d2a170
-            txmbr.depends_on.append(rel)
d2a170
+            # Add a dep relation to the new version of the package that causes
d2a170
+            # this one to be erased.  This way skipbroken should drop the old
d2a170
+            # one from the transaction if the new one is skipped.  Note that we
d2a170
+            # can only do this for one new version, as skipbroken won't drop
d2a170
+            # deps that are shared with some other packages.  For consistency,
d2a170
+            # let's give up completely if we are installing multiple new
d2a170
+            # versions (which is rather uncommon anyway).
d2a170
+            if len(newpos) == 1:
d2a170
+                txmbr.depends_on.append(newpos[0])
d2a170
 
d2a170
     def processTransaction(self, callback=None,rpmTestDisplay=None, rpmDisplay=None):
d2a170
         """Process the current transaction.  This involves the