diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-08-26 10:12:25 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-26 10:12:25 -0700 |
commit | ebfcfc636536a3d6fcaa0c0d8de27cac391b5b3c (patch) | |
tree | c5725977ca1f08036de078f2ca5b4b0c60ef34b5 | |
parent | b0b3fdd9b572d9341e0456c7e1e241c795929224 (diff) | |
download | portage-ebfcfc636536a3d6fcaa0c0d8de27cac391b5b3c.tar.gz portage-ebfcfc636536a3d6fcaa0c0d8de27cac391b5b3c.tar.bz2 portage-ebfcfc636536a3d6fcaa0c0d8de27cac391b5b3c.zip |
Make use_reduce() call Atom.evaluate_conditionals() when matchall is False,
and pass token_class=Atom in use_reduce() calls so that external
Atom.evaluate_conditionals() calls can be eliminated.
-rw-r--r-- | pym/portage/dbapi/bintree.py | 14 | ||||
-rw-r--r-- | pym/portage/dep/__init__.py | 4 | ||||
-rw-r--r-- | pym/portage/dep/dep_check.py | 5 | ||||
-rw-r--r-- | pym/portage/package/ebuild/doebuild.py | 12 |
4 files changed, 7 insertions, 28 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 9b1535e49..b4e240783 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -18,7 +18,7 @@ portage.proxy.lazyimport.lazyimport(globals(), from portage.cache.mappings import slot_dict_class from portage.dbapi.virtual import fakedbapi -from portage.dep import use_reduce, paren_enclose +from portage.dep import Atom, use_reduce, paren_enclose from portage.exception import InvalidPackageName, \ PermissionDenied, PortageException from portage.localization import _ @@ -1087,22 +1087,12 @@ class binarytree(object): for k in self._pkgindex_use_evaluated_keys: try: deps = metadata[k] - deps = use_reduce(deps, uselist=raw_use) + deps = use_reduce(deps, uselist=raw_use, token_class=Atom) deps = paren_enclose(deps) except portage.exception.InvalidDependString as e: writemsg("%s: %s\n" % (k, str(e)), noiselevel=-1) raise - if k in _vdb_use_conditional_atoms: - v_split = [] - for x in deps.split(): - try: - x = portage.dep.Atom(x) - except portage.exception.InvalidAtom: - v_split.append(x) - else: - v_split.append(str(x.evaluate_conditionals(raw_use))) - deps = ' '.join(v_split) metadata[k] = deps def exists_specific(self, cpv): diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index c6bd4ea21..8a31b3f6d 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -486,6 +486,10 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i raise portage.exception.InvalidDependString( _("Invalid token '%s' in '%s', token %s") % (token, depstr, pos+1)) + if not matchall and \ + hasattr(token, 'evaluate_conditionals'): + token = token.evaluate_conditionals(uselist) + stack[level].append(token) if level != 0: diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py index 9b4e97097..bfbdc608e 100644 --- a/pym/portage/dep/dep_check.py +++ b/pym/portage/dep/dep_check.py @@ -80,11 +80,6 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", if repoman: x = x._eval_qa_conditionals(use_mask, use_force) - if not repoman and \ - myuse is not None and x.use: - if x.use.conditional: - x = x.evaluate_conditionals(myuse) - mykey = x.cp if not mykey.startswith("virtual/"): newsplit.append(x) diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index af4ee5ef4..9b2e3e8e7 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -1463,20 +1463,10 @@ def _post_src_install_uid_fix(mysettings, out): v = mysettings.configdict['pkg'].get(k) if v is None: continue - v = use_reduce(v, uselist=use) + v = use_reduce(v, uselist=use, token_class=Atom) v = paren_enclose(v) if not v: continue - if v in _vdb_use_conditional_atoms: - v_split = [] - for x in v.split(): - try: - x = Atom(x) - except InvalidAtom: - v_split.append(x) - else: - v_split.append(str(x.evaluate_conditionals(use))) - v = ' '.join(v_split) codecs.open(_unicode_encode(os.path.join(build_info_dir, k), encoding=_encodings['fs'], errors='strict'), mode='w', encoding=_encodings['repo.content'], |