[Yum-devel] [PATCH] 'list available foo-ver-rel' shows old packages. BZ 786116

Zdeněk Pavlas zpavlas at redhat.com
Wed Feb 1 12:24:40 UTC 2012


'list available' hides packages that are installed, or a newer
version is installed.  To find out the newest version installed,
ghe RPMDB query must not contain explicit version.
---
 yum/__init__.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 4c68e22..d1807c2 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2517,7 +2517,11 @@ class YumBase(depsolve.Depsolve):
         if pkgnarrow == 'all': 
             dinst = {}
             ndinst = {} # Newest versions by name.arch
-            for po in self.rpmdb.returnPackages(patterns=patterns,
+            rpm_patterns = patterns
+            if not showdups:
+                # need to find the newest, so strip versions if supplied
+                rpm_patterns = [re.sub('-\d.*', '-*', p) for p in rpm_patterns]
+            for po in self.rpmdb.returnPackages(patterns=rpm_patterns,
                                                 ignore_case=ic):
                 dinst[po.pkgtup] = po
                 if showdups:
-- 
1.7.4.4



More information about the Yum-devel mailing list