yifengyou / rpms / yum

Forked from rpms/yum 3 years ago
Clone

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

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