Blame SOURCES/BZ-1399628-updateinfo-fix-wrong-pkg-count.patch

07a10e
commit 9474b6a7be57cd1c83da4a5db3fc0f48c61f6056
07a10e
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
07a10e
Date:   Wed Oct 26 13:42:04 2016 +0200
07a10e
07a10e
    Filter duplicate packages from different repos in doPackageLists(pkgnarrow='obsoletes').
07a10e
07a10e
diff --git a/yum/__init__.py b/yum/__init__.py
07a10e
index 9e38320..9780d96 100644
07a10e
--- a/yum/__init__.py
07a10e
+++ b/yum/__init__.py
07a10e
@@ -3109,9 +3109,13 @@ much more problems).
07a10e
                 pkgs = self.pkgSack.searchNevra(name=n, arch=a, ver=v, rel=r, epoch=e)
07a10e
                 pkgs = misc.filter_pkgs_repoid(pkgs, repoid)
07a10e
                 instpo = self.getInstalledPackageObject(instTup)
07a10e
-                for po in pkgs:
07a10e
-                    obsoletes.append(po)
07a10e
-                    obsoletesTuples.append((po, instpo))
07a10e
+                if len(pkgs) > 1:
07a10e
+                    self.verbose_logger.log(logginglevels.DEBUG_1,
07a10e
+                        _('More than one identical match in sack for %s'),
07a10e
+                        pkgs[0])
07a10e
+                if len(pkgs) >= 1:
07a10e
+                    obsoletes.append(pkgs[0])
07a10e
+                    obsoletesTuples.append((pkgs[0], instpo))
07a10e
             if patterns:
07a10e
                 exactmatch, matched, unmatched = \
07a10e
                    parsePackages(obsoletes, patterns, casematch=not ignore_case)
07a10e
07a10e
commit 400e248d3334d54fcf98d106d1cd84acae2e6e15
07a10e
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
07a10e
Date:   Mon Oct 31 10:28:04 2016 +0100
07a10e
07a10e
    Filter duplicates when counting security updates.
07a10e
07a10e
diff --git a/yum/updateinfo.py b/yum/updateinfo.py
07a10e
index 5dcd7df..35e4c0f 100644
07a10e
--- a/yum/updateinfo.py
07a10e
+++ b/yum/updateinfo.py
07a10e
@@ -456,8 +456,8 @@ def exclude_updates(base, filters=None):
07a10e
         for p in base.doPackageLists(pkgnarrow='available', patterns=pkgs_to_del, showdups=True).available:
07a10e
             ysp_del_pkg(p)
07a10e
 
07a10e
-    cnt = len(base.doPackageLists(pkgnarrow='updates').updates) + \
07a10e
-          len(base.doPackageLists(pkgnarrow='obsoletes').obsoletes)
07a10e
+    cnt = len(set(base.doPackageLists(pkgnarrow='updates').updates + \
07a10e
+                  base.doPackageLists(pkgnarrow='obsoletes').obsoletes))
07a10e
 
07a10e
     _ysp_chk_used_map(used_map, lambda x: base.verbose_logger.warn("%s", x))
07a10e
 
07a10e
07a10e
commit 02753215c8e28dbc75aacff678c33343d0539b33
07a10e
Author: Michal Domonkos <mdomonko@redhat.com>
07a10e
Date:   Wed Feb 15 16:51:57 2017 +0100
07a10e
07a10e
    updateinfo: filter pkg dupes from total count. BZ 1399628
07a10e
    
07a10e
    This complements commit 400e248.
07a10e
07a10e
diff --git a/yum/updateinfo.py b/yum/updateinfo.py
07a10e
index 35e4c0f..b6a42ea 100644
07a10e
--- a/yum/updateinfo.py
07a10e
+++ b/yum/updateinfo.py
07a10e
@@ -436,11 +436,8 @@ def exclude_updates(base, filters=None):
07a10e
 
07a10e
     used_map = _ysp_gen_used_map(opts)
07a10e
 
07a10e
-    upds = base.doPackageLists(pkgnarrow='updates')
07a10e
-    tot = len(upds.updates)
07a10e
-    # In theory we don't need to do this in some cases, but meh.
07a10e
-    upds = base.doPackageLists(pkgnarrow='obsoletes')
07a10e
-    tot += len(upds.obsoletes)
07a10e
+    tot = len(set(base.doPackageLists(pkgnarrow='updates').updates + \
07a10e
+                  base.doPackageLists(pkgnarrow='obsoletes').obsoletes))
07a10e
 
07a10e
     pkgs = base.pkgSack.returnPackages()
07a10e
     name2tup = _get_name2oldpkgtup(base)