diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-04-05 12:37:40 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-04-05 12:37:40 -0700 |
commit | eba99d86fe3bf43488c5df09419218d4b2941e90 (patch) | |
tree | 7f7fac9548b380a6408678af73f9e81abb3e4e42 | |
parent | 001b0184cf72159a7d3c57501eb685205481ad3f (diff) | |
download | portage-eba99d86fe3bf43488c5df09419218d4b2941e90.tar.gz portage-eba99d86fe3bf43488c5df09419218d4b2941e90.tar.bz2 portage-eba99d86fe3bf43488c5df09419218d4b2941e90.zip |
Limit long slot conflict loop for bug #410801.
-rw-r--r-- | pym/_emerge/resolver/slot_collision.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py index 1d522aabd..a1c87146c 100644 --- a/pym/_emerge/resolver/slot_collision.py +++ b/pym/_emerge/resolver/slot_collision.py @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Gentoo Foundation +# Copyright 2010-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function @@ -80,6 +80,8 @@ class slot_conflict_handler(object): the needed USE changes and prepare the message for the user. """ + _check_configuration_max = 1024 + def __init__(self, depgraph): self.depgraph = depgraph self.myopts = depgraph._frozen_config.myopts @@ -663,14 +665,24 @@ class slot_conflict_handler(object): solutions = [] sol_gen = _solution_candidate_generator(all_involved_flags) - while(True): + checked = 0 + while True: candidate = sol_gen.get_candidate() if not candidate: break solution = self._check_solution(config, candidate, all_conflict_atoms_by_slotatom) + checked += 1 if solution: solutions.append(solution) - + + if checked >= self._check_configuration_max: + # TODO: Implement early elimination for candidates that would + # change forced or masked flags, and don't count them here. + if self.debug: + writemsg("\nAborting _check_configuration due to " + "excessive number of candidates.\n", noiselevel=-1) + break + if self.debug: if not solutions: writemsg("No viable solutions. Rejecting configuration.\n", noiselevel=-1) |