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

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