diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-04-27 07:35:57 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-05-04 12:27:31 -0700 |
commit | 4abea4acc567de87264f734428d883fef4e0abb6 (patch) | |
tree | e9f35533049d71e2c0d5640f326d35c9e3c693ca /pym/_emerge | |
parent | 55a00a199b363cf214c8526f65aa2f939edf73c8 (diff) | |
download | portage-4abea4acc567de87264f734428d883fef4e0abb6.tar.gz portage-4abea4acc567de87264f734428d883fef4e0abb6.tar.bz2 portage-4abea4acc567de87264f734428d883fef4e0abb6.zip |
expand_new_virt: validate EAPI, IUSE and USE
Diffstat (limited to 'pym/_emerge')
-rw-r--r-- | pym/_emerge/actions.py | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index ce52d4067..68b828256 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -31,7 +31,7 @@ from portage.cache.cache_errors import CacheError from portage.const import GLOBAL_CONFIG_PATH, NEWS_LIB_PATH from portage.const import _ENABLE_DYN_LINK_MAP from portage.dbapi.dep_expand import dep_expand -from portage.dep import Atom, extended_cp_match +from portage.dep import Atom, extended_cp_match, _get_useflag_re from portage.exception import InvalidAtom from portage.output import blue, bold, colorize, create_color_func, darkgreen, \ red, yellow @@ -1310,10 +1310,31 @@ def expand_new_virt(vardb, atom): continue traversed.add(virt_cpv) - rdepend, use = vardb.aux_get(virt_cpv, ["RDEPEND", "USE"]) - use = frozenset(use.split()) + eapi, iuse, rdepend, use = vardb.aux_get(virt_cpv, + ["EAPI", "IUSE", "RDEPEND", "USE"]) + if not portage.eapi_is_supported(eapi): + yield atom + continue + + # Validate IUSE and IUSE, for early detection of vardb corruption. + useflag_re = _get_useflag_re(eapi) + valid_iuse = [] + for x in iuse.split(): + if x[:1] in ("+", "-"): + x = x[1:] + if useflag_re.match(x) is not None: + valid_iuse.append(x) + valid_iuse = frozenset(valid_iuse) + + iuse_implicit_match = vardb.settings._iuse_implicit_match + valid_use = [] + for x in use.split(): + if x in valid_iuse or iuse_implicit_match(x): + valid_use.append(x) + valid_use = frozenset(valid_use) + success, atoms = portage.dep_check(rdepend, - None, vardb.settings, myuse=use, + None, vardb.settings, myuse=valid_use, myroot=vardb.root, trees={vardb.root:{"porttree":vardb.vartree, "vartree":vardb.vartree}}) |