Skip to content

Commit

Permalink
Fix 'updateinfo list available' logic and make 'updates' the default
Browse files Browse the repository at this point in the history
  • Loading branch information
megaumi committed Dec 16, 2015
1 parent cc08cae commit 8ccc79d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
21 changes: 10 additions & 11 deletions docs/yum.8
Original file line number Diff line number Diff line change
Expand Up @@ -630,20 +630,19 @@ to your machine (including anything installed, if you supply "all").
.br

.br
.I \fR "\fB* all\fP"
Is used to display information about both install and available advisories.
.br
.I \fR "\fB* available\fP"
Is used to display information about just available advisories. This is the
default.
.I \fR "\fB* updates\fP"
Is used to display information about advisories for packages that can be
updated. This is the default.
.br
.I \fR "\fB* installed\fP"
Is used to display information about just install advisories.
Is used to display information only about installed advisories.
.br
.I \fR "\fB* updates\fP"
This is mostly the same as "available" but it only shows advisory information
for packages that can be updated to.

.I \fR "\fB* available\fP"
Is used to display information about advisories for packages available
for updating or installation.
.br
.I \fR "\fB* all\fP"
Is used to display information about both installed and available advisories.

.br
They all take as arguments:
Expand Down
13 changes: 9 additions & 4 deletions yumcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4101,7 +4101,7 @@ def msg(x):
opts = _upi._updateinfofilter2opts(base.updateinfo_filters)
extcmds, show_type, filt_type = self._parse_extcmds(extcmds)

list_type = "available"
list_type = "updates"
if extcmds and extcmds[0] in ("updates","available","installed", "all"):
list_type = extcmds.pop(0)
if filt_type is None:
Expand All @@ -4111,13 +4111,14 @@ def msg(x):
used_map = _upi._ysp_gen_used_map(base.updateinfo_filters)
iname2tup = {}
if False: pass
elif list_type in ('installed', 'all'):
elif list_type == 'installed':
name2tup = _upi._get_name2allpkgtup(base)
iname2tup = _upi._get_name2instpkgtup(base)
elif list_type == 'updates':
name2tup = _upi._get_name2oldpkgtup(base)
elif list_type == 'available':
name2tup = _upi._get_name2instpkgtup(base)
elif list_type in ('available', 'all'):
name2tup = _upi._get_name2aallpkgtup(base)
iname2tup = _upi._get_name2instpkgtup(base)

if filt_type == "newpackage":
self.doCommand_li_new(base, list_type, extcmds, md_info, msg,
Expand All @@ -4135,6 +4136,10 @@ def _show_pkgtup(pkgtup):
# Remove any that are newer than what we have installed
if _upi._rpm_tup_vercmp(iname2tup[name], pkgtup) < 0:
continue
if list_type == 'available':
# Remove any that are installed
if name in iname2tup and _upi._rpm_tup_vercmp(iname2tup[name], pkgtup) >= 0:
continue

if _upi._ysp_should_filter_pkg(opts, name, notice, used_map):
yield (pkgtup, notice)
Expand Down

0 comments on commit 8ccc79d

Please sign in to comment.