Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] _solve_..slot_conflicts: make "forced" set recursive (bug 632210)
Date: Fri, 29 Sep 2017 07:26:19
Message-Id: 20170929072601.220262-1-zmedico@gentoo.org
1 When the slot conflict solver decides that it is "forced"
2 to choose a particular package, recursively force the
3 dependencies as well. Prior to this fix, substitution of
4 @world in the arguments for SlotConflictMaskUpdateTestCase
5 caused the test to fail because the solver removed
6 boost-build-1.53.0 from the graph event though it had
7 added the parent boost-1.53.0 package to the "forced"
8 set.
9
10 X-Gentoo-bug: 632210
11 X-Gentoo-bug-url: https://bugs.gentoo.org/632210
12 ---
13 pym/_emerge/depgraph.py | 13 +++++++++++++
14 pym/portage/tests/resolver/test_slot_conflict_update.py | 2 +-
15 2 files changed, 14 insertions(+), 1 deletion(-)
16
17 diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
18 index 785c036b8..3b81c5c76 100644
19 --- a/pym/_emerge/depgraph.py
20 +++ b/pym/_emerge/depgraph.py
21 @@ -1457,6 +1457,19 @@ class depgraph(object):
22
23 # Remove 'non_conflict_node' and or_tuples from 'forced'.
24 forced = set(pkg for pkg in forced if isinstance(pkg, Package))
25 +
26 + # Add dependendencies of forced packages.
27 + stack = list(forced)
28 + traversed = set()
29 + while stack:
30 + pkg = stack.pop()
31 + traversed.add(pkg)
32 + for child in conflict_graph.child_nodes(pkg):
33 + if (isinstance(child, Package) and
34 + child not in traversed):
35 + forced.add(child)
36 + stack.append(child)
37 +
38 non_forced = set(pkg for pkg in conflict_pkgs if pkg not in forced)
39
40 if debug:
41 diff --git a/pym/portage/tests/resolver/test_slot_conflict_update.py b/pym/portage/tests/resolver/test_slot_conflict_update.py
42 index 331e5788b..f251d01f1 100644
43 --- a/pym/portage/tests/resolver/test_slot_conflict_update.py
44 +++ b/pym/portage/tests/resolver/test_slot_conflict_update.py
45 @@ -80,7 +80,7 @@ class SlotConflictUpdateTestCase(TestCase):
46 # this behavior makes SlotConflictMaskUpdateTestCase
47 # fail.
48 ResolverPlaygroundTestCase(
49 - world,
50 + ['@world'],
51 all_permutations = True,
52 options = {"--update": True, "--deep": True},
53 success = True,
54 --
55 2.13.5

Replies