[Yum-devel] [PATCH] Search for other installed packages, for available lists in "all". BZ 786116.

James Antill james at and.org
Wed Feb 1 20:01:50 UTC 2012


 This is needed so we get available/old_available/reinstall correct, but
we still can't put the other installed packages in the "install" list
(because then list all foo-3* will show foo-2 packages, which is bad).
This means that the colouring is still "wrong", but meh.
---
 yum/__init__.py |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 0ace29d..e321320 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2574,10 +2574,20 @@ class YumBase(depsolve.Depsolve):
                     key = (pkg.name, pkg.arch)
                     if pkg.pkgtup in dinst:
                         reinstall_available.append(pkg)
-                    elif key not in ndinst or pkg.verGT(ndinst[key]):
-                        available.append(pkg)
                     else:
-                        old_available.append(pkg)
+                        if key not in ndinst:
+                            #  Might be because pattern specified a version, so
+                            # we need to do a search for name/arch to find any
+                            # installed.
+                            ipkgs = self.rpmdb.searchNevra(pkg.name,
+                                                           arch=pkg.arch)
+                            if ipkgs:
+                                ndinst[key] = sorted(ipkgs)[-1]
+
+                        if key not in ndinst or pkg.verGT(ndinst[key]):
+                            available.append(pkg)
+                        else:
+                            old_available.append(pkg)
 
         # produce the updates list of tuples
         elif pkgnarrow == 'updates':
-- 
1.7.6.4



More information about the Yum-devel mailing list