Gentoo Archives: gentoo-portage-dev

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

Replies