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