1 |
commit: eba99d86fe3bf43488c5df09419218d4b2941e90 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Apr 5 19:37:40 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Apr 5 19:37:40 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=eba99d86 |
7 |
|
8 |
Limit long slot conflict loop for bug #410801. |
9 |
|
10 |
--- |
11 |
pym/_emerge/resolver/slot_collision.py | 18 +++++++++++++++--- |
12 |
1 files changed, 15 insertions(+), 3 deletions(-) |
13 |
|
14 |
diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py |
15 |
index 1d522aa..a1c8714 100644 |
16 |
--- a/pym/_emerge/resolver/slot_collision.py |
17 |
+++ b/pym/_emerge/resolver/slot_collision.py |
18 |
@@ -1,4 +1,4 @@ |
19 |
-# Copyright 2010-2011 Gentoo Foundation |
20 |
+# Copyright 2010-2012 Gentoo Foundation |
21 |
# Distributed under the terms of the GNU General Public License v2 |
22 |
|
23 |
from __future__ import print_function |
24 |
@@ -80,6 +80,8 @@ class slot_conflict_handler(object): |
25 |
the needed USE changes and prepare the message for the user. |
26 |
""" |
27 |
|
28 |
+ _check_configuration_max = 1024 |
29 |
+ |
30 |
def __init__(self, depgraph): |
31 |
self.depgraph = depgraph |
32 |
self.myopts = depgraph._frozen_config.myopts |
33 |
@@ -663,14 +665,24 @@ class slot_conflict_handler(object): |
34 |
|
35 |
solutions = [] |
36 |
sol_gen = _solution_candidate_generator(all_involved_flags) |
37 |
- while(True): |
38 |
+ checked = 0 |
39 |
+ while True: |
40 |
candidate = sol_gen.get_candidate() |
41 |
if not candidate: |
42 |
break |
43 |
solution = self._check_solution(config, candidate, all_conflict_atoms_by_slotatom) |
44 |
+ checked += 1 |
45 |
if solution: |
46 |
solutions.append(solution) |
47 |
- |
48 |
+ |
49 |
+ if checked >= self._check_configuration_max: |
50 |
+ # TODO: Implement early elimination for candidates that would |
51 |
+ # change forced or masked flags, and don't count them here. |
52 |
+ if self.debug: |
53 |
+ writemsg("\nAborting _check_configuration due to " |
54 |
+ "excessive number of candidates.\n", noiselevel=-1) |
55 |
+ break |
56 |
+ |
57 |
if self.debug: |
58 |
if not solutions: |
59 |
writemsg("No viable solutions. Rejecting configuration.\n", noiselevel=-1) |