summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-10-06 19:19:43 +0000
committerZac Medico <zmedico@gentoo.org>2007-10-06 19:19:43 +0000
commitc56cea442f35c9b835ad35f951de1406faff9938 (patch)
treeb66cf130a8e753503467ad0e65edabee12b1ddbb
parent314c8fe35ae30bdce0148af29d744af5a411655a (diff)
downloadportage-c56cea442f35c9b835ad35f951de1406faff9938.tar.gz
portage-c56cea442f35c9b835ad35f951de1406faff9938.tar.bz2
portage-c56cea442f35c9b835ad35f951de1406faff9938.zip
Fix package.license support so that SLOT atoms
will work. svn path=/main/trunk/; revision=7985
-rw-r--r--pym/emerge/__init__.py12
-rw-r--r--pym/portage/__init__.py25
-rw-r--r--pym/portage/dbapi/porttree.py8
3 files changed, 23 insertions, 22 deletions
diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py
index 6f4875f3c..d64107263 100644
--- a/pym/emerge/__init__.py
+++ b/pym/emerge/__init__.py
@@ -1904,6 +1904,7 @@ class depgraph(object):
print "!!! One of the following masked packages is required to complete your request:"
oldcomment = ""
shown_licenses = []
+ portdb_keys = ["LICENSE","SLOT"]
for p in alleb:
mreasons = portage.getmaskingstatus(p,
settings=pkgsettings, portdb=portdb)
@@ -1918,19 +1919,20 @@ class depgraph(object):
print comment
oldcomment = comment
try:
- licenses = portdb.aux_get(p, ["LICENSE"])[0]
+ metadata = dict(izip(portdb_keys,
+ portdb.aux_get(p, portdb_keys)))
except KeyError:
# Corruption will have been reported above.
continue
- uselist = []
- if "?" in licenses:
+ metadata["USE"] = ""
+ if "?" in metadata["LICENSE"]:
pkgsettings.setcpv(p, mydb=portdb)
- uselist = pkgsettings.get("USE", "").split()
+ metadata["USE"] = pkgsettings.get("USE", "")
missing_licenses = []
try:
missing_licenses = \
pkgsettings.getMissingLicenses(
- licenses, p, uselist)
+ p, metadata)
except portage.exception.InvalidDependString:
# This will have already been reported
# above via mreasons.
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 505848f7f..760819f41 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -1834,19 +1834,17 @@ class config(object):
if has_changed:
self.reset(keeping_pkg=1,use_cache=use_cache)
- def getMissingLicenses(self, licenses, cpv, uselist):
+ def getMissingLicenses(self, cpv, metadata):
"""
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
contain any licenses that have already been accepted. This method
can throw an InvalidDependString exception.
- @param licenses: A raw LICENSE string as returned form dbapi.aux_get()
- @type licenses: String
@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
+ @param metadata: A dictionary of raw package metadata
+ @type metadata: dict
@rtype: List
@return: A list of licenses that have not been accepted.
"""
@@ -1856,11 +1854,12 @@ class config(object):
cpdict = self._plicensedict.get(dep_getkey(cpv), None)
if cpdict:
acceptable_licenses = self._accept_license.copy()
- for atom in match_to_list(cpv, cpdict.keys()):
+ cpv_slot = "%s:%s" % (cpv, metadata["SLOT"])
+ for atom in match_to_list(cpv_slot, cpdict.keys()):
acceptable_licenses.update(cpdict[atom])
- license_struct = portage.dep.paren_reduce(licenses)
+ license_struct = portage.dep.paren_reduce(metadata["LICENSE"])
license_struct = portage.dep.use_reduce(
- license_struct, uselist=uselist)
+ license_struct, uselist=metadata["USE"].split())
license_struct = portage.dep.dep_opconvert(license_struct)
return self._getMissingLicenses(license_struct, acceptable_licenses)
@@ -5013,8 +5012,8 @@ def getmaskingstatus(mycpv, settings=None, portdb=None):
# keywords checking
try:
- mygroups, licenses, eapi = portdb.aux_get(
- mycpv, ["KEYWORDS", "LICENSE", "EAPI"])
+ eapi, mygroups, licenses, slot = portdb.aux_get(
+ mycpv, ["EAPI", "KEYWORDS", "LICENSE", "SLOT"])
except KeyError:
# The "depend" phase apparently failed for some reason. An associated
# error message will have already been printed to stderr.
@@ -5074,13 +5073,13 @@ def getmaskingstatus(mycpv, settings=None, portdb=None):
if kmask:
rValue.append(kmask+" keyword")
- uselist = []
+ use = ""
if "?" in licenses:
settings.setcpv(mycpv, mydb=portdb)
- uselist = settings.get("USE", "").split()
+ use = settings.get("USE", "")
try:
missing_licenses = settings.getMissingLicenses(
- licenses, mycpv, uselist)
+ mycpv, {"LICENSE":licenses, "SLOT":slot, "USE":use})
if missing_licenses:
allowed_tokens = set(["||", "(", ")"])
allowed_tokens.update(missing_licenses)
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 03550033a..3990a827e 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -728,13 +728,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 = []
+ use = ""
if "?" in licenses:
self.doebuild_settings.setcpv(mycpv, mydb=self)
- uselist = self.doebuild_settings.get("USE", "").split()
+ use = self.doebuild_settings.get("USE", "")
try:
- if self.mysettings.getMissingLicenses(
- licenses, mycpv, uselist):
+ if self.mysettings.getMissingLicenses(mycpv,
+ {"LICENSE":licenses, "SLOT":slot, "USE":use}):
match = 0
except InvalidDependString:
match = 0