Fix /etc/portage/package.keywords handling so that more specific
authorZac Medico <zmedico@gentoo.org>
Mon, 9 Aug 2010 10:35:45 +0000 (03:35 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 9 Aug 2010 10:35:45 +0000 (03:35 -0700)
atoms override less specific atoms.

pym/portage/package/ebuild/config.py

index 74a158f45e141474fc134b066d7d4afb5f2b598b..23d7f219da3dc3f05e3ff0cf83b1bf95ac9fb015 100644 (file)
@@ -1817,11 +1817,23 @@ class config(object):
                pkgdict = self.pkeywordsdict.get(cp)
                matches = False
                if pkgdict:
-                       cpv_slot_list = ["%s:%s" % (cpv, metadata["SLOT"])]
-                       for atom, pkgkeywords in pkgdict.items():
-                               if match_from_list(atom, cpv_slot_list):
-                                       matches = True
-                                       pgroups.extend(pkgkeywords)
+                       cpv_slot = "%s:%s" % (cpv, metadata["SLOT"])
+                       pkg_accept_keywords = []
+                       keys = list(pkgdict)
+                       while keys:
+                               best_match = best_match_to_list(cpv_slot, keys)
+                               if best_match:
+                                       keys.remove(best_match)
+                                       pkg_accept_keywords.append(pkgdict[best_match])
+                               else:
+                                       break
+                       if pkg_accept_keywords:
+                               # reverse, so the most specific atoms come last
+                               pkg_accept_keywords.reverse()
+                               for x in pkg_accept_keywords:
+                                       pgroups.extend(x)
+                               matches = True
+
                if matches or egroups:
                        pgroups.extend(egroups)
                        inc_pgroups = set()