diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-05-27 03:43:21 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-05-27 03:43:21 -0700 |
commit | df1e465d93291689e425ddfd211d8680341322da (patch) | |
tree | b1de207184029b8aef9084a5f8937d8acac40806 | |
parent | Make --deselect work for sets (bug 268798) (diff) | |
download | portage-idfetch-df1e465d93291689e425ddfd211d8680341322da.tar.gz portage-idfetch-df1e465d93291689e425ddfd211d8680341322da.tar.bz2 portage-idfetch-df1e465d93291689e425ddfd211d8680341322da.zip |
Bug #310947 - When expanding categories for atoms inside select_files,
make sure packages are available besides the installed one when preferring
the category of an installed package.
-rw-r--r-- | pym/_emerge/depgraph.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 1c690766..5a7d2b76 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1705,8 +1705,18 @@ class depgraph(object): if len(expanded_atoms) > 1 and len(installed_cp_set) == 1: installed_cp = next(iter(installed_cp_set)) - expanded_atoms = [atom for atom in expanded_atoms \ - if atom.cp == installed_cp] + for atom in expanded_atoms: + if atom.cp == installed_cp: + available = False + for pkg in self._iter_match_pkgs_any( + root_config, atom.without_use, + onlydeps=onlydeps): + if not pkg.installed: + available = True + break + if available: + expanded_atoms = [atom] + break # If a non-virtual package and one or more virtual packages # are in expanded_atoms, use the non-virtual package. @@ -2372,6 +2382,13 @@ class depgraph(object): show_mask_docs() print() + def _iter_match_pkgs_any(self, root_config, atom, onlydeps=False): + for db, pkg_type, built, installed, db_keys in \ + self._dynamic_config._filtered_trees[root_config.root]["dbs"]: + for pkg in self._iter_match_pkgs(root_config, + pkg_type, atom, onlydeps=onlydeps): + yield pkg + def _iter_match_pkgs(self, root_config, pkg_type, atom, onlydeps=False): """ Iterate over Package instances of pkg_type matching the given atom. |