1 |
This fixes _dep_check_composite_db to mask packages that aren't the |
2 |
highest visible match, but only if an update is desirable. This causes |
3 |
desirable updates to get pulled in for cases like bug #526160. The |
4 |
included unit test simulates the virtual/pypy update that triggered |
5 |
the bug. |
6 |
|
7 |
X-Gentoo-Bug: 526160 |
8 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=526160 |
9 |
--- |
10 |
This updated patch fixes the new logic so that it only applies to |
11 |
virtual packages, since that's the only case where it is currently |
12 |
needed. |
13 |
|
14 |
pym/_emerge/depgraph.py | 24 +++++++++ |
15 |
pym/portage/tests/resolver/test_virtual_slot.py | 66 +++++++++++++++++++++++++ |
16 |
2 files changed, 90 insertions(+) |
17 |
|
18 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
19 |
index 5180db5..78b9236 100644 |
20 |
--- a/pym/_emerge/depgraph.py |
21 |
+++ b/pym/_emerge/depgraph.py |
22 |
@@ -527,6 +527,8 @@ class depgraph(object): |
23 |
self._event_loop = (portage._internal_caller and |
24 |
global_event_loop() or EventLoop(main=False)) |
25 |
|
26 |
+ self._select_atoms_parent = None |
27 |
+ |
28 |
self.query = UserQuery(myopts).query |
29 |
|
30 |
def _load_vdb(self): |
31 |
@@ -4062,11 +4064,13 @@ class depgraph(object): |
32 |
self._dynamic_config._autounmask = False |
33 |
# backup state for restoration, in case of recursive |
34 |
# calls to this method |
35 |
+ backup_parent = self._select_atoms_parent |
36 |
backup_state = mytrees.copy() |
37 |
try: |
38 |
# clear state from previous call, in case this |
39 |
# call is recursive (we have a backup, that we |
40 |
# will use to restore it later) |
41 |
+ self._select_atoms_parent = None |
42 |
mytrees.pop("pkg_use_enabled", None) |
43 |
mytrees.pop("parent", None) |
44 |
mytrees.pop("atom_graph", None) |
45 |
@@ -4074,6 +4078,7 @@ class depgraph(object): |
46 |
|
47 |
mytrees["pkg_use_enabled"] = self._pkg_use_enabled |
48 |
if parent is not None: |
49 |
+ self._select_atoms_parent = parent |
50 |
mytrees["parent"] = parent |
51 |
mytrees["atom_graph"] = atom_graph |
52 |
if priority is not None: |
53 |
@@ -4085,6 +4090,7 @@ class depgraph(object): |
54 |
finally: |
55 |
# restore state |
56 |
self._dynamic_config._autounmask = _autounmask_backup |
57 |
+ self._select_atoms_parent = backup_parent |
58 |
mytrees.pop("pkg_use_enabled", None) |
59 |
mytrees.pop("parent", None) |
60 |
mytrees.pop("atom_graph", None) |
61 |
@@ -8529,6 +8535,24 @@ class _dep_check_composite_db(dbapi): |
62 |
elif not self._depgraph._equiv_ebuild_visible(pkg): |
63 |
return False |
64 |
|
65 |
+ if pkg.cp.startswith("virtual/"): |
66 |
+ # Force virtual updates to be pulled in when appropriate |
67 |
+ # for bug #526160. |
68 |
+ want_update = False |
69 |
+ if self._depgraph._select_atoms_parent is not None: |
70 |
+ want_update = \ |
71 |
+ self._depgraph._want_update_pkg( |
72 |
+ self._depgraph._select_atoms_parent, pkg) |
73 |
+ |
74 |
+ if want_update: |
75 |
+ for new_child in self._depgraph._iter_similar_available( |
76 |
+ pkg, next(iter(atom_set))): |
77 |
+ if not self._depgraph._virt_deps_visible( |
78 |
+ new_child, ignore_use=True): |
79 |
+ continue |
80 |
+ if pkg < new_child: |
81 |
+ return False |
82 |
+ |
83 |
in_graph = next(self._depgraph._dynamic_config._package_tracker.match( |
84 |
self._root, pkg.slot_atom, installed=False), None) |
85 |
|
86 |
diff --git a/pym/portage/tests/resolver/test_virtual_slot.py b/pym/portage/tests/resolver/test_virtual_slot.py |
87 |
index 1b19d77..2e5ca7f 100644 |
88 |
--- a/pym/portage/tests/resolver/test_virtual_slot.py |
89 |
+++ b/pym/portage/tests/resolver/test_virtual_slot.py |
90 |
@@ -92,6 +92,72 @@ class VirtualSlotResolverTestCase(TestCase): |
91 |
finally: |
92 |
playground.cleanup() |
93 |
|
94 |
+ def testVirtualSubslotUpdate(self): |
95 |
+ |
96 |
+ ebuilds = { |
97 |
+ "virtual/pypy-2.3.1" : { |
98 |
+ "EAPI": "5", |
99 |
+ "SLOT": "0/2.3", |
100 |
+ "RDEPEND": "|| ( >=dev-python/pypy-2.3.1:0/2.3 >=dev-python/pypy-bin-2.3.1:0/2.3 ) " |
101 |
+ }, |
102 |
+ "virtual/pypy-2.4.0" : { |
103 |
+ "EAPI": "5", |
104 |
+ "SLOT": "0/2.4", |
105 |
+ "RDEPEND": "|| ( >=dev-python/pypy-2.4.0:0/2.4 >=dev-python/pypy-bin-2.4.0:0/2.4 ) " |
106 |
+ }, |
107 |
+ "dev-python/pypy-2.3.1": { |
108 |
+ "EAPI": "5", |
109 |
+ "SLOT": "0/2.3" |
110 |
+ }, |
111 |
+ "dev-python/pypy-2.4.0": { |
112 |
+ "EAPI": "5", |
113 |
+ "SLOT": "0/2.4" |
114 |
+ }, |
115 |
+ "dev-python/pygments-1.6_p20140324-r1": { |
116 |
+ "EAPI": "5", |
117 |
+ "DEPEND": "virtual/pypy:=" |
118 |
+ } |
119 |
+ } |
120 |
+ |
121 |
+ installed = { |
122 |
+ "virtual/pypy-2.3.1" : { |
123 |
+ "EAPI": "5", |
124 |
+ "SLOT": "0/2.3", |
125 |
+ "RDEPEND": "|| ( >=dev-python/pypy-2.3.1:0/2.3 >=dev-python/pypy-bin-2.3.1:0/2.3 ) " |
126 |
+ }, |
127 |
+ "dev-python/pypy-2.3.1": { |
128 |
+ "EAPI": "5", |
129 |
+ "SLOT": "0/2.3" |
130 |
+ }, |
131 |
+ "dev-python/pygments-1.6_p20140324-r1": { |
132 |
+ "EAPI": "5", |
133 |
+ "DEPEND": "virtual/pypy:0/2.3=", |
134 |
+ "RDEPEND": "virtual/pypy:0/2.3=", |
135 |
+ } |
136 |
+ } |
137 |
+ |
138 |
+ world = ["dev-python/pygments"] |
139 |
+ |
140 |
+ test_cases = ( |
141 |
+ # bug 526160 - test for missed pypy sub-slot update |
142 |
+ ResolverPlaygroundTestCase( |
143 |
+ ["@world"], |
144 |
+ options = {"--update": True, "--deep": True}, |
145 |
+ success=True, |
146 |
+ mergelist = ['dev-python/pypy-2.4.0', |
147 |
+ 'virtual/pypy-2.4.0', |
148 |
+ 'dev-python/pygments-1.6_p20140324-r1']), |
149 |
+ ) |
150 |
+ |
151 |
+ playground = ResolverPlayground(debug=False, ebuilds=ebuilds, |
152 |
+ installed=installed, world=world) |
153 |
+ try: |
154 |
+ for test_case in test_cases: |
155 |
+ playground.run_TestCase(test_case) |
156 |
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg) |
157 |
+ finally: |
158 |
+ playground.cleanup() |
159 |
+ |
160 |
def testVirtualSlotDepclean(self): |
161 |
|
162 |
ebuilds = { |
163 |
-- |
164 |
2.0.4 |