Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH] _backtrack_depgraph: fix bug #523048
Date: Thu, 18 Sep 2014 18:47:02
Message-Id: 541B289F.2090007@gentoo.org
1 This fixes _backtrack_depgraph to immediately report necessary
2 REQUIRED_USE changes instead of discarding the graph. This is
3 accomplished by replacing the depgraph.success_without_autounmask
4 method with a new need_config_change method that accounts for both
5 autounmask and REQUIRED_USE changes.
6
7 X-Gentoo-Bug: 523048
8 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=523048
9 ---
10 pym/_emerge/depgraph.py | 11 +++++++----
11 pym/portage/tests/resolver/ResolverPlayground.py | 16 ++++++++++++++--
12 2 files changed, 21 insertions(+), 6 deletions(-)
13
14 diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
15 index 6332733..e7ae720 100644
16 --- a/pym/_emerge/depgraph.py
17 +++ b/pym/_emerge/depgraph.py
18 @@ -421,6 +421,7 @@ class _dynamic_depgraph_config(object):
19 self._buildpkgonly_deps_unsatisfied = False
20 self._autounmask = depgraph._frozen_config.myopts.get('--autounmask') != 'n'
21 self._success_without_autounmask = False
22 + self._required_use_unsatisfied = False
23 self._traverse_ignored_deps = False
24 self._complete_mode = False
25 self._slot_operator_deps = {}
26 @@ -2461,6 +2462,7 @@ class depgraph(object):
27 self._dynamic_config._unsatisfied_deps_for_display.append(
28 ((pkg.root, atom),
29 {"myparent" : dep.parent, "show_req_use" : pkg}))
30 + self._dynamic_config._required_use_unsatisfied = True
31 self._dynamic_config._skip_restart = True
32 return 0
33
34 @@ -8390,8 +8392,9 @@ class depgraph(object):
35 return self._dynamic_config._need_restart and \
36 not self._dynamic_config._skip_restart
37
38 - def success_without_autounmask(self):
39 - return self._dynamic_config._success_without_autounmask
40 + def need_config_change(self):
41 + return self._dynamic_config._success_without_autounmask or \
42 + self._dynamic_config._required_use_unsatisfied
43
44 def autounmask_breakage_detected(self):
45 try:
46 @@ -8665,7 +8668,7 @@ def _backtrack_depgraph(settings, trees, myopts, myparams, myaction, myfiles, sp
47 backtrack_parameters=backtrack_parameters)
48 success, favorites = mydepgraph.select_files(myfiles)
49
50 - if success or mydepgraph.success_without_autounmask():
51 + if success or mydepgraph.need_config_change():
52 break
53 elif not allow_backtracking:
54 break
55 @@ -8677,7 +8680,7 @@ def _backtrack_depgraph(settings, trees, myopts, myparams, myaction, myfiles, sp
56 else:
57 break
58
59 - if not (success or mydepgraph.success_without_autounmask()) and backtracked:
60 + if not (success or mydepgraph.need_config_change()) and backtracked:
61
62 if debug:
63 writemsg_level(
64 diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py
65 index 646987d..8560871 100644
66 --- a/pym/portage/tests/resolver/ResolverPlayground.py
67 +++ b/pym/portage/tests/resolver/ResolverPlayground.py
68 @@ -674,7 +674,8 @@ class ResolverPlaygroundTestCase(object):
69 expected = x
70 break
71 elif key in ("unstable_keywords", "needed_p_mask_changes",
72 - "unsatisfied_deps") and expected is not None:
73 + "unsatisfied_deps", "required_use_unsatisfied") and \
74 + expected is not None:
75 expected = set(expected)
76
77 elif key == "forced_rebuilds" and expected is not None:
78 @@ -693,10 +694,12 @@ class ResolverPlaygroundResult(object):
79
80 checks = (
81 "success", "mergelist", "use_changes", "license_changes", "unstable_keywords", "slot_collision_solutions",
82 - "circular_dependency_solutions", "needed_p_mask_changes", "unsatisfied_deps", "forced_rebuilds"
83 + "circular_dependency_solutions", "needed_p_mask_changes", "unsatisfied_deps", "forced_rebuilds",
84 + "required_use_unsatisfied"
85 )
86 optional_checks = (
87 "forced_rebuilds",
88 + "required_use_unsatisfied",
89 "unsatisfied_deps"
90 )
91
92 @@ -714,6 +717,7 @@ class ResolverPlaygroundResult(object):
93 self.circular_dependency_solutions = None
94 self.unsatisfied_deps = frozenset()
95 self.forced_rebuilds = None
96 + self.required_use_unsatisfied = None
97
98 if self.depgraph._dynamic_config._serialized_tasks_cache is not None:
99 self.mergelist = []
100 @@ -780,6 +784,14 @@ class ResolverPlaygroundResult(object):
101 if self.depgraph._forced_rebuilds:
102 self.forced_rebuilds = dict(self._iter_forced_rebuilds())
103
104 + required_use_unsatisfied = []
105 + for pargs, kwargs in \
106 + self.depgraph._dynamic_config._unsatisfied_deps_for_display:
107 + if "show_req_use" in kwargs:
108 + required_use_unsatisfied.append(pargs[1])
109 + if required_use_unsatisfied:
110 + self.required_use_unsatisfied = set(required_use_unsatisfied)
111 +
112 def _iter_forced_rebuilds(self):
113 for child_dict in self.depgraph._forced_rebuilds.values():
114 for child, parents in child_dict.items():
115 --
116 1.8.5.5

Replies