[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH rhel6-branch master] Add the best package for this arch to the optional package selector (#591653).



Before, we were just having ayum.searchNevra return a list of packages and grab
whatever happened to be first on that list.  Sometimes it ends up being the
x86-64 package, and sometimes it ends up being the i686 one instead.  To be
more deterministic, we should return the best package for the architecture
we're running on always.
---
 iw/GroupSelector.py |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/iw/GroupSelector.py b/iw/GroupSelector.py
index 4d64e59..29bc2ab 100644
--- a/iw/GroupSelector.py
+++ b/iw/GroupSelector.py
@@ -206,10 +206,19 @@ class OptionalPackageSelector:
             
 
     def __getPackageObject(self, pkgname):
-        pos = self.ayum.pkgSack.searchNevra(name=pkgname)
-        if len(pos) > 0:
-            return pos[0]
-        return None
+        try:
+            pkgs = self.ayum.pkgSack.returnNewestByName(pkgname)
+        except:
+            return None
+
+        if not pkgs:
+            return None
+
+        pkgs = self.ayum.bestPackagesFromList(pkgs)
+        if not pkgs:
+            return None
+
+        return pkgs[0]
 
     def _populate(self):
         pkgs = self.group.default_packages.keys() + \
-- 
1.7.0.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]