From df1e465d93291689e425ddfd211d8680341322da Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 27 May 2010 03:43:21 -0700 Subject: [PATCH] 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. --- pym/_emerge/depgraph.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 1c6907669..5a7d2b761 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. -- 2.26.2