summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-08-27 12:22:37 -0700
committerZac Medico <zmedico@gentoo.org>2010-08-27 12:22:37 -0700
commit2139ecd8616adcb7e1af08a299451a0651a9162c (patch)
treee55a5bb70087781c6967b2da4d10c637db57015f
parentbd7687fa56100f80c2962382730b75b82b4e67e0 (diff)
downloadportage-2139ecd8616adcb7e1af08a299451a0651a9162c.tar.gz
portage-2139ecd8616adcb7e1af08a299451a0651a9162c.tar.bz2
portage-2139ecd8616adcb7e1af08a299451a0651a9162c.zip
Use Package._metadata_exception() to handle invalid LICENSE, PROPERTIES,
PROVIDE, and RESTRICT, and generate IUSE.missing errors for repoman when appropriate.
-rw-r--r--pym/_emerge/Package.py34
1 files changed, 22 insertions, 12 deletions
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index f9b42f0de..1a786b6d2 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -5,9 +5,10 @@ import sys
from itertools import chain
import portage
from portage.cache.mappings import slot_dict_class
-from portage.dep import Atom, check_required_use, isvalidatom, use_reduce, \
+from portage.dep import Atom, check_required_use, use_reduce, \
paren_enclose, _slot_re
from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+from portage.exception import InvalidDependString
from _emerge.Task import Task
if sys.hexversion >= 0x3000000:
@@ -33,6 +34,7 @@ class Package(Task):
"_mtime_", "DEFINED_PHASES", "REQUIRED_USE"]
_dep_keys = ('DEPEND', 'PDEPEND', 'RDEPEND',)
+ _use_conditional_misc_keys = ('LICENSE', 'PROPERTIES', 'RESTRICT')
def __init__(self, **kwargs):
Task.__init__(self, **kwargs)
@@ -89,6 +91,25 @@ class Package(Task):
except portage.exception.InvalidDependString as e:
self._metadata_exception(k, e)
+ k = 'PROVIDE'
+ v = self.metadata.get(k)
+ if v:
+ try:
+ use_reduce(v, eapi=dep_eapi,
+ is_valid_flag=dep_valid_flag, token_class=Atom)
+ except InvalidDependString as e:
+ self._metadata_exception(k, e)
+
+ for k in self._use_conditional_misc_keys:
+ v = self.metadata.get(k)
+ if not v:
+ continue
+ try:
+ use_reduce(v, eapi=dep_eapi,
+ is_valid_flag=dep_valid_flag)
+ except InvalidDependString as e:
+ self._metadata_exception(k, e)
+
k = 'REQUIRED_USE'
v = self.metadata.get(k)
if v:
@@ -418,17 +439,6 @@ class _PackageMetadataWrapper(_PackageMetadataWrapperBase):
_PackageMetadataWrapperBase.__setitem__(self, k, v)
if k in self._wrapped_keys:
getattr(self, "_set_" + k.lower())(k, v)
- elif k in self._use_conditional_keys:
- try:
- reduced = use_reduce(v, matchall=1, flat=True)
- except portage.exception.InvalidDependString as e:
- self._pkg._invalid_metadata(k + ".syntax", "%s: %s" % (k, e))
- else:
- if reduced and k == 'PROVIDE':
- for x in reduced:
- if not isvalidatom(x):
- self._pkg._invalid_metadata(k + ".syntax",
- "%s: %s" % (k, x))
def _set_inherited(self, k, v):
if isinstance(v, basestring):