Fix _getMissingLicenses() package.license handling so that settings
authorZac Medico <zmedico@gentoo.org>
Sat, 7 Aug 2010 01:00:30 +0000 (18:00 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 7 Aug 2010 01:00:30 +0000 (18:00 -0700)
from more specific atoms override those of less specific atoms.

pym/portage/package/ebuild/config.py

index ff9894d8e876cfd388016d14cdfb04adc3bf5d00..344810543ee7647b8f63eb801ba7fdeeff7da2e2 100644 (file)
@@ -1874,10 +1874,22 @@ class config(object):
                cp = cpv_getkey(cpv)
                cpdict = self._plicensedict.get(cp)
                if cpdict:
-                       accept_license = list(self._accept_license)
                        cpv_slot = "%s:%s" % (cpv, metadata["SLOT"])
-                       for atom in match_to_list(cpv_slot, list(cpdict)):
-                               accept_license.extend(cpdict[atom])
+                       keys = list(cpdict)
+                       plicence_list = []
+                       while keys:
+                               bestmatch = best_match_to_list(cpv_slot, keys)
+                               if bestmatch:
+                                       keys.remove(bestmatch)
+                                       plicence_list.append(cpdict[bestmatch])
+                               else:
+                                       break
+                       if plicence_list:
+                               # reverse, so the most specific atoms come last
+                               plicence_list.reverse()
+                               accept_license = list(self._accept_license)
+                               for x in plicence_list:
+                                       accept_license.extend(x)
 
                licenses = set(flatten(use_reduce(paren_reduce(
                        metadata["LICENSE"]), matchall=1)))