Pass a list of USE flags into config.getMissingLicenses() so that the method can...
authorZac Medico <zmedico@gentoo.org>
Wed, 21 Mar 2007 00:14:35 +0000 (00:14 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 21 Mar 2007 00:14:35 +0000 (00:14 -0000)
svn path=/main/trunk/; revision=6260

pym/emerge/__init__.py
pym/portage/__init__.py
pym/portage/dbapi/porttree.py

index bd700ff927495af0be595000638194b201df33b2..11cb50a479390ae8fc0f9af16e1eb669a12715e7 100644 (file)
@@ -1693,10 +1693,15 @@ class depgraph:
                                                                                print comment
                                                                                oldcomment = comment
                                                                licenses = portdb.aux_get(p, ["LICENSE"])[0]
+                                                               uselist = []
+                                                               if "?" in licenses:
+                                                                       pkgsettings.setcpv(p, mydb=portdb)
+                                                                       uselist = pkgsettings.get("USE", "").split()
                                                                missing_licenses = []
                                                                try:
                                                                        missing_licenses = \
-                                                                       pkgsettings.getMissingLicenses(licenses, p)
+                                                                               pkgsettings.getMissingLicenses(
+                                                                                       licenses, p, uselist)
                                                                except portage.exception.InvalidDependString:
                                                                        # This will have already been reported
                                                                        # above via mreasons.
index 11dca580a55e136be081898690f8e491e674af20..1b04d35b1b2da55b71e316bc07528ff245f5c03c 100644 (file)
@@ -1748,7 +1748,7 @@ class config:
                if has_changed:
                        self.reset(keeping_pkg=1,use_cache=use_cache)
 
-       def getMissingLicenses(self, licenses, cpv):
+       def getMissingLicenses(self, licenses, cpv, uselist):
                """
                Take a LICENSE string and return a list any licenses that the user may
                may need to accept for the given package.  The returned list will not
@@ -1757,8 +1757,10 @@ class config:
 
                @param licenses: A raw LICENSE string as returned form dbapi.aux_get()
                @type licenses: String
-               @param cpv: The package name (for evaluation of USE conditionals)
+               @param cpv: The package name (for package.license support)
                @type cpv: String
+               @param uselist: A list of flags for evaluation of USE conditionals
+               @type uselist: List
                @rtype: List
                @return: A list of licenses that have not been accepted.
                """
@@ -1769,11 +1771,9 @@ class config:
                                acceptable_licenses.update(cpdict[atom])
                if "*" in acceptable_licenses:
                        return []
-               if "?" in licenses:
-                       self.setcpv(cpv)
                license_struct = portage.dep.paren_reduce(licenses)
                license_struct = portage.dep.use_reduce(
-                       license_struct, uselist=self["USE"].split())
+                       license_struct, uselist=uselist)
                license_struct = portage.dep.dep_opconvert(license_struct)
                return self._getMissingLicenses(license_struct, acceptable_licenses)
 
@@ -4717,8 +4717,13 @@ def getmaskingstatus(mycpv, settings=None, portdb=None):
        if kmask:
                rValue.append(kmask+" keyword")
 
+       uselist = []
+       if "?" in licenses:
+               settings.setcpv(mycpv, mydb=portdb)
+               uselist = settings.get("USE", "").split()
        try:
-               missing_licenses = settings.getMissingLicenses(licenses, mycpv)
+               missing_licenses = settings.getMissingLicenses(
+                       licenses, mycpv, uselist)
                if missing_licenses:
                        allowed_tokens = set(["||", "(", ")"])
                        allowed_tokens.update(missing_licenses)
index 4118a4da4cffd26bb063c5a1534815e2462d6c7f..af14499d67380a735061e47dc12deb8786ab9a07 100644 (file)
@@ -685,8 +685,13 @@ class portdbapi(dbapi):
                                        hasstable = True
                        if not match and ((hastesting and "~*" in pgroups) or (hasstable and "*" in pgroups) or "**" in pgroups):
                                match=1
+                       uselist = []
+                       if "?" in licenses:
+                               self.mysettings.setcpv(mycpv, mydb=self)
+                               uselist = self.mysettings.get("USE", "").split()
                        try:
-                               if self.mysettings.getMissingLicenses(licenses, mycpv):
+                               if self.mysettings.getMissingLicenses(
+                                       licenses, mycpv, uselist):
                                        match = 0
                        except InvalidDependString:
                                match = 0