Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] circular_dependency_handler: limit USE combination search (bug 555698)
Date: Mon, 03 Aug 2015 07:33:41
Message-Id: 20150803003335.19ece402.dolsen@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] circular_dependency_handler: limit USE combination search (bug 555698) by Zac Medico
1 On Sun, 2 Aug 2015 23:21:36 -0700
2 Zac Medico <zmedico@g.o> wrote:
3
4 > Limit the number of USE combinations search to 1024, in order to
5 > avoid consuming unreasonable abouts of time. First, discard
6
7 ****** typo ^^ amounts
8
9
10 > irrelevent flags that are not enabled. Since extract_affecting_use
11 > doesn't distinguish between positive and negative effects (flag? vs.
12 > !flag?), assume a positive relationship. If there are still too many
13 > combinations, then don't bother to explore any of them.
14 >
15 > X-Gentoo-Bug: 555698
16 > X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=555698
17 > ---
18 > pym/_emerge/resolver/circular_dependency.py | 21
19 > +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
20 >
21 > diff --git a/pym/_emerge/resolver/circular_dependency.py
22 > b/pym/_emerge/resolver/circular_dependency.py index b710671..5c11956
23 > 100644 --- a/pym/_emerge/resolver/circular_dependency.py
24 > +++ b/pym/_emerge/resolver/circular_dependency.py
25 > @@ -14,7 +14,9 @@ from _emerge.DepPrioritySatisfiedRange import
26 > DepPrioritySatisfiedRange from _emerge.Package import Package
27 >
28 > class circular_dependency_handler(object):
29 > -
30 > +
31 > + MAX_AFFECTING_USE = 10
32 > +
33
34
35 ********* in the commit message you talk about the limit being set to
36 to 1024
37 but here it is set 10?
38
39 Clarify please.
40
41
42
43 > def __init__(self, depgraph, graph):
44 > self.depgraph = depgraph
45 > self.graph = graph
46 > @@ -156,7 +158,7 @@ class circular_dependency_handler(object):
47 > total_flags = set()
48 > total_flags.update(affecting_use,
49 > required_use_flags) total_flags.difference_update(untouchable_flags)
50 > - if len(total_flags) <= 10:
51 > + if len(total_flags) <=
52 > self.MAX_AFFECTING_USE: affecting_use = total_flags
53 >
54 > affecting_use = tuple(affecting_use)
55 > @@ -164,6 +166,21 @@ class circular_dependency_handler(object):
56 > if not affecting_use:
57 > continue
58 >
59
60
61 =================================================
62
63
64 > + if len(affecting_use) >
65 > self.MAX_AFFECTING_USE:
66 > + # Limit the number of combinations
67 > explored (bug #555698).
68 > + # First, discard irrelevent flags
69 > that are not enabled.
70 > + # Since extract_affecting_use
71 > doesn't distinguish between
72 > + # positive and negative effects
73 > (flag? vs. !flag?), assume
74 > + # a positive relationship.
75 > + current_use =
76 > self.depgraph._pkg_use_enabled(parent)
77 > + affecting_use = tuple(flag for flag
78 > in affecting_use
79 > + if flag in current_use)
80 > +
81 > + if len(affecting_use) >
82 > self.MAX_AFFECTING_USE:
83 > + # There are too many USE
84 > combinations to explore in
85 > + # a reasonable amount of
86 > time.
87 > + continue
88 > +
89
90
91
92 Damn, that _find_suggestions() is already 150+ LOC, up to 9 indent
93 levels deep, before you add this :/
94
95 Is there a way you can do this in a separate test/function? At least
96 it wouldn't be adding directly to something that already could use a
97 little refactoring. /me cringes at what repoman is...
98
99 > #We iterate over all possible settings of
100 > these use flags and gather #a set of possible changes
101 > #TODO: Use the information encoded in
102 > REQUIRED_USE
103
104
105
106 --
107 Brian Dolbec <dolsen>

Replies