diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-08-25 22:44:05 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-25 22:44:05 -0700 |
commit | 561b4dabdc289cf6561b384e50d1138d5f30dd52 (patch) | |
tree | 57369bc9fb20837e0cc59ab8eade7f7916c39250 | |
parent | d06aed54e0bf0b74eb34b5ca65e1e6991afb030b (diff) | |
download | portage-561b4dabdc289cf6561b384e50d1138d5f30dd52.tar.gz portage-561b4dabdc289cf6561b384e50d1138d5f30dd52.tar.bz2 portage-561b4dabdc289cf6561b384e50d1138d5f30dd52.zip |
Make Package._validate_deps() use check_required_use() to validate
REQUIRED_USE.
-rw-r--r-- | pym/_emerge/Package.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index 7abcfe5fd..3be8009a6 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -5,7 +5,7 @@ import sys from itertools import chain import portage from portage.cache.mappings import slot_dict_class -from portage.dep import Atom, isvalidatom, use_reduce, \ +from portage.dep import Atom, check_required_use, isvalidatom, use_reduce, \ paren_enclose, _slot_re from portage.eapi import eapi_has_src_uri_arrows, eapi_has_slot_deps, \ eapi_has_use_deps, eapi_has_strong_blocks, eapi_has_iuse_defaults, \ @@ -55,10 +55,6 @@ class Package(Task): not eapi_has_iuse_defaults(self.metadata["EAPI"]): self._invalid_metadata('IUSE.invalid', "IUSE contains defaults, but EAPI doesn't allow them") - if self.metadata.get("REQUIRED_USE") and \ - not eapi_has_required_use(self.metadata["EAPI"]): - self._invalid_metadata('REQUIRED_USE.invalid', - "REQUIRED_USE set, but EAPI doesn't allow it") self.slot_atom = portage.dep.Atom("%s:%s" % (self.cp, slot)) self.category, self.pf = portage.catsplit(self.cpv) self.cpv_split = portage.catpkgsplit(self.cpv) @@ -114,6 +110,20 @@ class Package(Task): " not supported with EAPI='%s':" + \ " '%s'") % (k, eapi, atom)) + k = 'REQUIRED_USE' + v = self.metadata.get(k) + if v: + if not eapi_has_required_use(eapi): + self._invalid_metadata(k + '.invalid', + "REQUIRED_USE set, but EAPI='%s' doesn't allow it" % eapi) + else: + try: + check_required_use(v, (), + self.iuse.is_valid_flag) + except portage.exception.InvalidDependString as e: + self._invalid_metadata(k + ".syntax", + "%s: %s" % (k, e)) + k = 'SRC_URI' v = self.metadata.get(k) if v: |