From 8d1b3138238bcfe0c78e58efc47788e08cbb8a07 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 30 Oct 2007 22:00:49 +0000 Subject: [PATCH] Implement license filtering for xmatch minimum-visible and 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 | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index aad388508..230c96cb6 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -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 -- 2.26.2