Skip to content

Commit

Permalink
Fix 'yum updateinfo list all new-packages' traceback. BZ 1072945
Browse files Browse the repository at this point in the history
And make 'list' and 'info' indicate if the package is installed.
  • Loading branch information
megaumi committed Mar 5, 2014
1 parent 1275346 commit f2fc1ef
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions yumcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3840,7 +3840,7 @@ def list_show_pkgs(self, base, md_info, list_type, show_type,
mark = ''
if list_type == 'all':
mark = ' '
if _upi._rpm_tup_vercmp(iname2tup[pkgtup[0]], pkgtup) >= 0:
if pkgtup[0] in iname2tup and _upi._rpm_tup_vercmp(iname2tup[pkgtup[0]], pkgtup) >= 0:
mark = 'i '
tn = notice['type']
if tn == 'security' and notice['severity']:
Expand Down Expand Up @@ -3879,7 +3879,7 @@ def info_show_pkgs(self, base, md_info, list_type, show_type,
obj = notice.__str__()

if list_type == 'all':
if _upi._rpm_tup_vercmp(iname2tup[pkgtup[0]], pkgtup) >= 0:
if pkgtup[0] in iname2tup and _upi._rpm_tup_vercmp(iname2tup[pkgtup[0]], pkgtup) >= 0:
obj = obj + "\n Installed : true"
else:
obj = obj + "\n Installed : false"
Expand Down Expand Up @@ -4029,7 +4029,7 @@ def _msg(x):
return 0, [basecmd + ' ' + subcommand + ' done']

def doCommand_li_new(self, base, list_type, extcmds, md_info, msg,
show_pkgs):
show_pkgs, iname2tup):
done_pkgs = set()
data = []
for (notice, pkgtup) in sorted(self._get_new_pkgs(md_info),
Expand All @@ -4055,7 +4055,7 @@ def doCommand_li_new(self, base, list_type, extcmds, md_info, msg,
continue
done_pkgs.add(n)
data.append((notice, pkgtup, pkgs[0]))
show_pkgs(base, md_info, list_type, None, {}, data, msg)
show_pkgs(base, md_info, list_type, None, iname2tup, data, msg)

def _parse_extcmds(self, extcmds):
filt_type = None
Expand Down Expand Up @@ -4086,12 +4086,6 @@ def msg(x):
if filt_type is None:
extcmds, show_type, filt_type = self._parse_extcmds(extcmds)

if filt_type == "newpackage":
# No filtering here, as we want what isn't installed...
self.doCommand_li_new(base, list_type, extcmds, md_info, msg,
show_pkgs)
return 0, [basecmd + ' new done']

opts.sec_cmds = extcmds
used_map = _upi._ysp_gen_used_map(base.updateinfo_filters)
iname2tup = {}
Expand All @@ -4104,6 +4098,11 @@ def msg(x):
elif list_type == 'available':
name2tup = _upi._get_name2instpkgtup(base)

if filt_type == "newpackage":
self.doCommand_li_new(base, list_type, extcmds, md_info, msg,
show_pkgs, iname2tup)
return 0, [basecmd + ' new done']

def _show_pkgtup(pkgtup):
name = pkgtup[0]
notices = reversed(md_info.get_applicable_notices(pkgtup))
Expand Down

0 comments on commit f2fc1ef

Please sign in to comment.