Gentoo Archives: gentoo-portage-dev

From: SebastianLuther@×××.de
To: gentoo-portage-dev@l.g.o
Cc: Sebastian Luther <SebastianLuther@×××.de>
Subject: [gentoo-portage-dev] [PATCH] Another slot operator bug (bug 486580, try 2)
Date: Thu, 28 Nov 2013 10:34:28
Message-Id: 1385634849-32277-1-git-send-email-SebastianLuther@gmx.de
1 From: Sebastian Luther <SebastianLuther@×××.de>
2
3 This time rebuilds are scheduled properly, but we
4 might still forget to install the package that caused
5 the rebuild.
6
7 URL: https://bugs.gentoo.org/486580
8 ---
9 pym/_emerge/depgraph.py | 48 +++++++++++------
10 .../tests/resolver/test_slot_conflict_rebuild.py | 63 ++++++++++++++++++++++
11 2 files changed, 95 insertions(+), 16 deletions(-)
12
13 diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
14 index da2e604..0a998b5 100644
15 --- a/pym/_emerge/depgraph.py
16 +++ b/pym/_emerge/depgraph.py
17 @@ -2268,6 +2268,36 @@ class depgraph(object):
18 finally:
19 self._dynamic_config._autounmask = _autounmask_backup
20
21 + def _ignore_dependency(self, atom, pkg, child, dep, mypriority, recurse_satisfied):
22 + """
23 + In some cases, dep_check will return deps that shouldn't
24 + be proccessed any further, so they are identified and
25 + discarded here. Try to discard as few as possible since
26 + discarded dependencies reduce the amount of information
27 + available for optimization of merge order.
28 + Don't ignore dependencies if pkg has a slot operator dependency on the child
29 + and the child has changed slot/sub_slot.
30 + """
31 + slot_operator_rebuild = False
32 + if atom.slot_operator == '=' and \
33 + (pkg.root, pkg.slot_atom) in self._dynamic_config._slot_operator_replace_installed and \
34 + mypriority.satisfied and \
35 + mypriority.satisfied is not child and \
36 + mypriority.satisfied.installed and \
37 + not child.installed and \
38 + (child.slot != mypriority.satisfied.slot or child.sub_slot != mypriority.satisfied.sub_slot):
39 + slot_operator_rebuild = True
40 +
41 + return not atom.blocker and \
42 + not recurse_satisfied and \
43 + mypriority.satisfied and \
44 + mypriority.satisfied.visible and \
45 + dep.child is not None and \
46 + not dep.child.installed and \
47 + self._dynamic_config._slot_pkg_map[dep.child.root].get(
48 + dep.child.slot_atom) is None and \
49 + not slot_operator_rebuild
50 +
51 def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority,
52 dep_string, allow_unsatisfied):
53 depth = pkg.depth + 1
54 @@ -2357,14 +2387,7 @@ class depgraph(object):
55 # discarded dependencies reduce the amount of information
56 # available for optimization of merge order.
57 ignored = False
58 - if not atom.blocker and \
59 - not recurse_satisfied and \
60 - mypriority.satisfied and \
61 - mypriority.satisfied.visible and \
62 - dep.child is not None and \
63 - not dep.child.installed and \
64 - self._dynamic_config._slot_pkg_map[dep.child.root].get(
65 - dep.child.slot_atom) is None:
66 + if self._ignore_dependency(atom, pkg, child, dep, mypriority, recurse_satisfied):
67 myarg = None
68 try:
69 myarg = next(self._iter_atoms_for_pkg(dep.child), None)
70 @@ -2467,14 +2490,7 @@ class depgraph(object):
71 collapsed_parent=pkg, collapsed_priority=dep_priority)
72
73 ignored = False
74 - if not atom.blocker and \
75 - not recurse_satisfied and \
76 - mypriority.satisfied and \
77 - mypriority.satisfied.visible and \
78 - dep.child is not None and \
79 - not dep.child.installed and \
80 - self._dynamic_config._slot_pkg_map[dep.child.root].get(
81 - dep.child.slot_atom) is None:
82 + if self._ignore_dependency(atom, pkg, child, dep, mypriority, recurse_satisfied):
83 myarg = None
84 try:
85 myarg = next(self._iter_atoms_for_pkg(dep.child), None)
86 diff --git a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
87 index 74f5cc1..e3c517d 100644
88 --- a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
89 +++ b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
90 @@ -181,6 +181,69 @@ class SlotConflictRebuildTestCase(TestCase):
91 finally:
92 playground.cleanup()
93
94 + def testSlotConflictForgottenChild(self):
95 + """
96 + Similar to testSlotConflictMassRebuild above, but this time the rebuilds are scheduled,
97 + but the package causing the rebuild (the child) is not installed.
98 + """
99 + ebuilds = {
100 +
101 + "app-misc/A-2" : {
102 + "EAPI": "5",
103 + "DEPEND": "app-misc/B:= app-misc/C",
104 + "RDEPEND": "app-misc/B:= app-misc/C",
105 + },
106 +
107 + "app-misc/B-2" : {
108 + "EAPI": "5",
109 + "SLOT": "2"
110 + },
111 +
112 + "app-misc/C-1": {
113 + "EAPI": "5",
114 + "DEPEND": "app-misc/B:=",
115 + "RDEPEND": "app-misc/B:="
116 + },
117 + }
118 +
119 + installed = {
120 + "app-misc/A-1" : {
121 + "EAPI": "5",
122 + "DEPEND": "app-misc/B:1/1= app-misc/C",
123 + "RDEPEND": "app-misc/B:1/1= app-misc/C",
124 + },
125 +
126 + "app-misc/B-1" : {
127 + "EAPI": "5",
128 + "SLOT": "1"
129 + },
130 +
131 + "app-misc/C-1": {
132 + "EAPI": "5",
133 + "DEPEND": "app-misc/B:1/1=",
134 + "RDEPEND": "app-misc/B:1/1="
135 + },
136 + }
137 +
138 + test_cases = (
139 + ResolverPlaygroundTestCase(
140 + ["app-misc/A"],
141 + success = True,
142 + mergelist = ['app-misc/B-2', 'app-misc/C-1', 'app-misc/A-2']),
143 + )
144 +
145 + world = []
146 +
147 + playground = ResolverPlayground(ebuilds=ebuilds,
148 + installed=installed, world=world, debug=False)
149 + try:
150 + for test_case in test_cases:
151 + playground.run_TestCase(test_case)
152 + self.assertEqual(test_case.test_success, True, test_case.fail_msg)
153 + finally:
154 + playground.cleanup()
155 +
156 +
157 def testSlotConflictDepChange(self):
158 """
159 Bug 490362
160 --
161 1.8.1.5

Replies