Make config.regenerate() detect api-level updates to ACCEPT_LICENSE, for use
authorZac Medico <zmedico@gentoo.org>
Thu, 25 Jun 2009 19:41:48 +0000 (19:41 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 25 Jun 2009 19:41:48 +0000 (19:41 -0000)
in implementing the "free" filter for the packagekit backend.

svn path=/main/trunk/; revision=13694

pym/portage/__init__.py

index 62af949ade39df2f913f7bdc56b46ea915f836b8..41da40cf763f4dbdb185070e9affcad8daad6b7d 100644 (file)
@@ -1202,6 +1202,7 @@ class config(object):
                self.uvlist = []
                self._accept_chost_re = None
                self._accept_license = None
+               self._accept_license_str = None
 
                self.virtuals = {}
                self.virts_p = {}
@@ -2860,17 +2861,19 @@ class config(object):
                # ACCEPT_LICENSE is a lazily evaluated incremental, so that * can be
                # used to match all licenses without every having to explicitly expand
                # it to all licenses.
-               if self._accept_license is None:
-                       if self.local_config:
-                               mysplit = []
-                               for curdb in mydbs:
-                                       mysplit.extend(curdb.get('ACCEPT_LICENSE', '').split())
-                               if mysplit:
-                                       self.configlist[-1]['ACCEPT_LICENSE'] = ' '.join(mysplit)
+               if self.local_config:
+                       mysplit = []
+                       for curdb in mydbs:
+                               mysplit.extend(curdb.get('ACCEPT_LICENSE', '').split())
+                       accept_license_str = ' '.join(mysplit)
+                       if accept_license_str:
+                               self.configlist[-1]['ACCEPT_LICENSE'] = accept_license_str
+                       if accept_license_str != self._accept_license_str:
+                               self._accept_license_str = accept_license_str
                                self._accept_license = tuple(self.expandLicenseTokens(mysplit))
-                       else:
-                               # repoman will accept any license
-                               self._accept_license = ()
+               else:
+                       # repoman will accept any license
+                       self._accept_license = ()
 
                for mykey in myincrementals: