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 09:28:01
Message-Id: 1385630869-23455-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 | 30 ++++++++++-
10 .../tests/resolver/test_slot_conflict_rebuild.py | 63 ++++++++++++++++++++++
11 2 files changed, 91 insertions(+), 2 deletions(-)
12
13 diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
14 index da2e604..0f8f76d 100644
15 --- a/pym/_emerge/depgraph.py
16 +++ b/pym/_emerge/depgraph.py
17 @@ -2356,6 +2356,18 @@ class depgraph(object):
18 # discarded here. Try to discard as few as possible since
19 # discarded dependencies reduce the amount of information
20 # available for optimization of merge order.
21 + # Don't ignore dependencies if pkg as a slot operator dependency on the child
22 + # and the child has changed slot/sub_slot
23 + slot_operator_rebuild = False
24 + if atom.slot_operator == '=' and \
25 + (pkg.root, pkg.slot_atom) in self._dynamic_config._slot_operator_replace_installed and \
26 + mypriority.satisfied and \
27 + mypriority.satisfied is not child and \
28 + mypriority.satisfied.installed and \
29 + not child.installed and \
30 + (child.slot != mypriority.satisfied.slot or child.sub_slot != mypriority.satisfied.sub_slot):
31 + slot_operator_rebuild = True
32 +
33 ignored = False
34 if not atom.blocker and \
35 not recurse_satisfied and \
36 @@ -2364,7 +2376,8 @@ class depgraph(object):
37 dep.child is not None and \
38 not dep.child.installed and \
39 self._dynamic_config._slot_pkg_map[dep.child.root].get(
40 - dep.child.slot_atom) is None:
41 + dep.child.slot_atom) is None and \
42 + not slot_operator_rebuild:
43 myarg = None
44 try:
45 myarg = next(self._iter_atoms_for_pkg(dep.child), None)
46 @@ -2466,6 +2479,18 @@ class depgraph(object):
47 parent=virt_pkg, priority=mypriority, root=dep_root,
48 collapsed_parent=pkg, collapsed_priority=dep_priority)
49
50 + # Don't ignore dependencies if pkg as a slot operator dependency on the child
51 + # and the child has changed slot/sub_slot
52 + slot_operator_rebuild = False
53 + if atom.slot_operator == '=' and \
54 + (pkg.root, pkg.slot_atom) in self._dynamic_config._slot_operator_replace_installed and \
55 + mypriority.satisfied and \
56 + mypriority.satisfied is not child and \
57 + mypriority.satisfied.installed and \
58 + not child.installed and \
59 + (child.slot != mypriority.satisfied.slot or child.sub_slot != mypriority.satisfied.sub_slot):
60 + slot_operator_rebuild = True
61 +
62 ignored = False
63 if not atom.blocker and \
64 not recurse_satisfied and \
65 @@ -2474,7 +2499,8 @@ class depgraph(object):
66 dep.child is not None and \
67 not dep.child.installed and \
68 self._dynamic_config._slot_pkg_map[dep.child.root].get(
69 - dep.child.slot_atom) is None:
70 + dep.child.slot_atom) is None and \
71 + not slot_operator_rebuild:
72 myarg = None
73 try:
74 myarg = next(self._iter_atoms_for_pkg(dep.child), None)
75 diff --git a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
76 index 74f5cc1..e3c517d 100644
77 --- a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
78 +++ b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
79 @@ -181,6 +181,69 @@ class SlotConflictRebuildTestCase(TestCase):
80 finally:
81 playground.cleanup()
82
83 + def testSlotConflictForgottenChild(self):
84 + """
85 + Similar to testSlotConflictMassRebuild above, but this time the rebuilds are scheduled,
86 + but the package causing the rebuild (the child) is not installed.
87 + """
88 + ebuilds = {
89 +
90 + "app-misc/A-2" : {
91 + "EAPI": "5",
92 + "DEPEND": "app-misc/B:= app-misc/C",
93 + "RDEPEND": "app-misc/B:= app-misc/C",
94 + },
95 +
96 + "app-misc/B-2" : {
97 + "EAPI": "5",
98 + "SLOT": "2"
99 + },
100 +
101 + "app-misc/C-1": {
102 + "EAPI": "5",
103 + "DEPEND": "app-misc/B:=",
104 + "RDEPEND": "app-misc/B:="
105 + },
106 + }
107 +
108 + installed = {
109 + "app-misc/A-1" : {
110 + "EAPI": "5",
111 + "DEPEND": "app-misc/B:1/1= app-misc/C",
112 + "RDEPEND": "app-misc/B:1/1= app-misc/C",
113 + },
114 +
115 + "app-misc/B-1" : {
116 + "EAPI": "5",
117 + "SLOT": "1"
118 + },
119 +
120 + "app-misc/C-1": {
121 + "EAPI": "5",
122 + "DEPEND": "app-misc/B:1/1=",
123 + "RDEPEND": "app-misc/B:1/1="
124 + },
125 + }
126 +
127 + test_cases = (
128 + ResolverPlaygroundTestCase(
129 + ["app-misc/A"],
130 + success = True,
131 + mergelist = ['app-misc/B-2', 'app-misc/C-1', 'app-misc/A-2']),
132 + )
133 +
134 + world = []
135 +
136 + playground = ResolverPlayground(ebuilds=ebuilds,
137 + installed=installed, world=world, debug=False)
138 + try:
139 + for test_case in test_cases:
140 + playground.run_TestCase(test_case)
141 + self.assertEqual(test_case.test_success, True, test_case.fail_msg)
142 + finally:
143 + playground.cleanup()
144 +
145 +
146 def testSlotConflictDepChange(self):
147 """
148 Bug 490362
149 --
150 1.8.1.5

Replies

Subject Author
Re: [gentoo-portage-dev] [PATCH] Another slot operator bug (bug 486580, try 2) Sebastian Luther <SebastianLuther@×××.de>