Implement license filtering for xmatch minimum-visible and
authorZac Medico <zmedico@gentoo.org>
Tue, 30 Oct 2007 22:00:49 +0000 (22:00 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 30 Oct 2007 22:00:49 +0000 (22:00 -0000)
bestmatch-visible. Also, make the gvisible license filtering
conditional on config.local_config since repoman doesn't do
license filtering.

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

pym/portage/dbapi/porttree.py

index aad3885088e22d05ca13d7154b226c463b07d0ac..230c96cb637d122f384752089894bd6ef040ce27 100644 (file)
@@ -597,14 +597,13 @@ class portdbapi(dbapi):
                        # Find the minimum matching visible version. This is optimized to
                        # minimize the number of metadata accesses (improves performance
                        # especially in cases where metadata needs to be generated).
-                       # This does not implement LICENSE filtering since it's only
-                       # intended for use by repoman.
                        if mydep == mykey:
                                mylist = self.cp_list(mykey)
                        else:
                                mylist = match_from_list(mydep, self.cp_list(mykey))
                        myval = ""
                        settings = self.mysettings
+                       local_config = settings.local_config
                        if level == "minimum-visible":
                                iterfunc = iter
                        else:
@@ -626,6 +625,16 @@ class portdbapi(dbapi):
                                        continue
                                if settings.getProfileMaskAtom(cpv, metadata):
                                        continue
+                               if local_config:
+                                       metadata["USE"] = ""
+                                       if "?" in metadata["LICENSE"]:
+                                               self.doebuild_settings.setcpv(cpv, mydb=metadata)
+                                               metadata["USE"] = self.doebuild_settings.get("USE", "")
+                                       try:
+                                               if settings.getMissingLicenses(cpv, metadata):
+                                                       continue
+                                       except InvalidDependString:
+                                               continue
                                myval = cpv
                                break
                elif level == "bestmatch-list":
@@ -702,6 +711,7 @@ class portdbapi(dbapi):
                newlist=[]
                aux_keys = ["IUSE", "KEYWORDS", "LICENSE", "EAPI", "SLOT"]
                metadata = {}
+               local_config = self.mysettings.local_config
                for mycpv in mylist:
                        metadata.clear()
                        try:
@@ -718,15 +728,16 @@ class portdbapi(dbapi):
                                continue
                        if self.mysettings.getMissingKeywords(mycpv, metadata):
                                continue
-                       metadata["USE"] = ""
-                       if "?" in metadata["LICENSE"]:
-                               self.doebuild_settings.setcpv(mycpv, mydb=metadata)
-                               metadata["USE"] = self.doebuild_settings.get("USE", "")
-                       try:
-                               if self.mysettings.getMissingLicenses(mycpv, metadata):
+                       if local_config:
+                               metadata["USE"] = ""
+                               if "?" in metadata["LICENSE"]:
+                                       self.doebuild_settings.setcpv(mycpv, mydb=metadata)
+                                       metadata["USE"] = self.doebuild_settings.get("USE", "")
+                               try:
+                                       if self.mysettings.getMissingLicenses(mycpv, metadata):
+                                               continue
+                               except InvalidDependString:
                                        continue
-                       except InvalidDependString:
-                               continue
                        newlist.append(mycpv)
                return newlist