Blame SOURCES/BZ-1328023-updateinfo-traceback.patch

eb5f31
commit f2fc1ef96b0de995e2a61bf219b5d2c1d5a09503
eb5f31
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
eb5f31
Date:   Wed Mar 5 17:49:02 2014 +0100
eb5f31
eb5f31
     Fix 'yum updateinfo list all new-packages' traceback. BZ 1072945
eb5f31
    
eb5f31
    And make 'list' and 'info' indicate if the package is installed.
eb5f31
eb5f31
diff --git a/yumcommands.py b/yumcommands.py
eb5f31
index 74e4333..4e72a71 100644
eb5f31
--- a/yumcommands.py
eb5f31
+++ b/yumcommands.py
eb5f31
@@ -3840,7 +3840,7 @@ class UpdateinfoCommand(YumCommand):
eb5f31
             mark = ''
eb5f31
             if list_type == 'all':
eb5f31
                 mark = '  '
eb5f31
-                if _upi._rpm_tup_vercmp(iname2tup[pkgtup[0]], pkgtup) >= 0:
eb5f31
+                if pkgtup[0] in iname2tup and _upi._rpm_tup_vercmp(iname2tup[pkgtup[0]], pkgtup) >= 0:
eb5f31
                     mark = 'i '
eb5f31
             tn = notice['type']
eb5f31
             if tn == 'security' and notice['severity']:
eb5f31
@@ -3879,7 +3879,7 @@ class UpdateinfoCommand(YumCommand):
eb5f31
                 obj = notice.__str__()
eb5f31
 
eb5f31
             if list_type == 'all':
eb5f31
-                if _upi._rpm_tup_vercmp(iname2tup[pkgtup[0]], pkgtup) >= 0:
eb5f31
+                if pkgtup[0] in iname2tup and _upi._rpm_tup_vercmp(iname2tup[pkgtup[0]], pkgtup) >= 0:
eb5f31
                     obj = obj + "\n  Installed : true"
eb5f31
                 else:
eb5f31
                     obj = obj + "\n  Installed : false"
eb5f31
@@ -4029,7 +4029,7 @@ class UpdateinfoCommand(YumCommand):
eb5f31
             return 0, [basecmd + ' ' + subcommand + ' done']
eb5f31
 
eb5f31
     def doCommand_li_new(self, base, list_type, extcmds, md_info, msg,
eb5f31
-                         show_pkgs):
eb5f31
+                         show_pkgs, iname2tup):
eb5f31
         done_pkgs = set()
eb5f31
         data = []
eb5f31
         for (notice, pkgtup) in sorted(self._get_new_pkgs(md_info),
eb5f31
@@ -4055,7 +4055,7 @@ class UpdateinfoCommand(YumCommand):
eb5f31
                 continue
eb5f31
             done_pkgs.add(n)
eb5f31
             data.append((notice, pkgtup, pkgs[0]))
eb5f31
-        show_pkgs(base, md_info, list_type, None, {}, data, msg)
eb5f31
+        show_pkgs(base, md_info, list_type, None, iname2tup, data, msg)
eb5f31
 
eb5f31
     def _parse_extcmds(self, extcmds):
eb5f31
         filt_type = None
eb5f31
@@ -4086,12 +4086,6 @@ class UpdateinfoCommand(YumCommand):
eb5f31
             if filt_type is None:
eb5f31
                 extcmds, show_type, filt_type = self._parse_extcmds(extcmds)
eb5f31
 
eb5f31
-        if filt_type == "newpackage":
eb5f31
-            # No filtering here, as we want what isn't installed...
eb5f31
-            self.doCommand_li_new(base, list_type, extcmds, md_info, msg,
eb5f31
-                                  show_pkgs)
eb5f31
-            return 0, [basecmd + ' new done']
eb5f31
-
eb5f31
         opts.sec_cmds = extcmds
eb5f31
         used_map = _upi._ysp_gen_used_map(base.updateinfo_filters)
eb5f31
         iname2tup = {}
eb5f31
diff -up yum-3.4.3/yumcommands.py.old yum-3.4.3/yumcommands.py
eb5f31
--- yum-3.4.3/yumcommands.py.old	2016-05-10 17:19:04.007269059 +0200
eb5f31
+++ yum-3.4.3/yumcommands.py	2016-05-10 17:20:11.320698042 +0200
eb5f31
@@ -4094,6 +4094,10 @@ class UpdateinfoCommand(YumCommand):
eb5f31
             name2tup = _upi._get_name2aallpkgtup(base)
eb5f31
             iname2tup = _upi._get_name2instpkgtup(base)
eb5f31
 
eb5f31
+        if filt_type == "newpackage":
eb5f31
+            self.doCommand_li_new(base, list_type, extcmds, md_info, msg,
eb5f31
+                                  show_pkgs, iname2tup)
eb5f31
+            return 0, [basecmd + ' new done']
eb5f31
 
eb5f31
         def _show_pkgtup(pkgtup):
eb5f31
             name = pkgtup[0]