yifengyou / rpms / yum

Forked from rpms/yum 3 years ago
Clone

Blame SOURCES/BZ-1292150-updateinfo-list-available.patch

5e9bef
commit 8ccc79d82bf0894def61cd2643d63e4adf3dcd02
5e9bef
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
5e9bef
Date:   Wed Dec 16 15:31:15 2015 +0100
5e9bef
5e9bef
    Fix 'updateinfo list available' logic and make 'updates' the default
5e9bef
5e9bef
diff --git a/docs/yum.8 b/docs/yum.8
5e9bef
index 99862fa..e428148 100644
5e9bef
--- a/docs/yum.8
5e9bef
+++ b/docs/yum.8
5e9bef
@@ -630,20 +630,19 @@ to your machine (including anything installed, if you supply "all").
5e9bef
 .br
5e9bef
 
5e9bef
 .br
5e9bef
-.I \fR "\fB* all\fP"
5e9bef
-Is used to display information about both install and available advisories.
5e9bef
-.br
5e9bef
-.I \fR "\fB* available\fP"
5e9bef
-Is used to display information about just available advisories. This is the
5e9bef
-default.
5e9bef
+.I \fR "\fB* updates\fP"
5e9bef
+Is used to display information about advisories for packages that can be
5e9bef
+updated. This is the default.
5e9bef
 .br
5e9bef
 .I \fR "\fB* installed\fP"
5e9bef
-Is used to display information about just install advisories.
5e9bef
+Is used to display information only about installed advisories.
5e9bef
 .br
5e9bef
-.I \fR "\fB* updates\fP"
5e9bef
-This is mostly the same as "available" but it only shows advisory information
5e9bef
-for packages that can be updated to.
5e9bef
-
5e9bef
+.I \fR "\fB* available\fP"
5e9bef
+Is used to display information about advisories for packages available
5e9bef
+for updating or installation.
5e9bef
+.br
5e9bef
+.I \fR "\fB* all\fP"
5e9bef
+Is used to display information about both installed and available advisories.
5e9bef
 
5e9bef
 .br
5e9bef
 They all take as arguments:
5e9bef
diff -up yum-3.4.3/yumcommands.py.old yum-3.4.3/yumcommands.py
5e9bef
--- yum-3.4.3/yumcommands.py.old	2016-03-22 12:22:54.398569730 +0100
5e9bef
+++ yum-3.4.3/yumcommands.py	2016-03-22 12:27:30.261523615 +0100
5e9bef
@@ -4072,6 +4072,7 @@ class UpdateinfoCommand(YumCommand):
5e9bef
         extcmds, show_type, filt_type = self._parse_extcmds(extcmds)
5e9bef
 
5e9bef
         list_type = "available"
5e9bef
+        list_type = "updates"
5e9bef
         if extcmds and extcmds[0] in ("updates","available","installed", "all"):
5e9bef
             list_type = extcmds.pop(0)
5e9bef
             if filt_type is None:
5e9bef
@@ -4087,13 +4088,15 @@ class UpdateinfoCommand(YumCommand):
5e9bef
         used_map = _upi._ysp_gen_used_map(base.updateinfo_filters)
5e9bef
         iname2tup = {}
5e9bef
         if False: pass
5e9bef
-        elif list_type in ('installed', 'all'):
5e9bef
+        elif list_type == 'installed':
5e9bef
             name2tup = _upi._get_name2allpkgtup(base)
5e9bef
             iname2tup = _upi._get_name2instpkgtup(base)
5e9bef
         elif list_type == 'updates':
5e9bef
             name2tup = _upi._get_name2oldpkgtup(base)
5e9bef
-        elif list_type == 'available':
5e9bef
-            name2tup = _upi._get_name2instpkgtup(base)
5e9bef
+        elif list_type in ('available', 'all'):
5e9bef
+            name2tup = _upi._get_name2aallpkgtup(base)
5e9bef
+            iname2tup = _upi._get_name2instpkgtup(base)
5e9bef
+
5e9bef
 
5e9bef
         def _show_pkgtup(pkgtup):
5e9bef
             name = pkgtup[0]
5e9bef
@@ -4106,6 +4109,10 @@ class UpdateinfoCommand(YumCommand):
5e9bef
                     # Remove any that are newer than what we have installed
5e9bef
                     if _upi._rpm_tup_vercmp(iname2tup[name], pkgtup) < 0:
5e9bef
                         continue
5e9bef
+                if list_type == 'available':
5e9bef
+                    # Remove any that are installed
5e9bef
+                    if name in iname2tup and _upi._rpm_tup_vercmp(iname2tup[name], pkgtup) >= 0:
5e9bef
+                        continue
5e9bef
 
5e9bef
                 if _upi._ysp_should_filter_pkg(opts, name, notice, used_map):
5e9bef
                     yield (pkgtup, notice)