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

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



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ack.

On Thu, 13 May 2010, Chris Lumens wrote:

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() + \


- -- David Cantrell <dcantrell redhat com>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iEYEARECAAYFAkvsSdgACgkQ5hsjjIy1VklYlwCfctsLgDkOjGF8MFsLSj2eB1lO
q3oAnRFZ0XwU3WCEZClyRDfbgr00R+wT
=LxTs
-----END PGP SIGNATURE-----


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