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.
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
@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.
"""
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)
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)
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