From fde519b4c6652d9f2140e8815760bf520c7dd54b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 26 Oct 2014 17:32:36 -0700 Subject: [PATCH] depgraph: fix bug #526160 This fixes _dep_check_composite_db to mask packages that aren't the highest visible match, but only if an update is desirable. This causes desirable updates to get pulled in for cases like bug #526160. The included unit test simulates the virtual/pypy update that triggered the bug. X-Gentoo-Bug: 526160 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=526160 --- pym/_emerge/depgraph.py | 21 ++++++++ pym/portage/tests/resolver/test_virtual_slot.py | 66 +++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 5180db5..7dc37f7 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -527,6 +527,8 @@ class depgraph(object): self._event_loop = (portage._internal_caller and global_event_loop() or EventLoop(main=False)) + self._select_atoms_parent = None + self.query = UserQuery(myopts).query def _load_vdb(self): @@ -4062,11 +4064,13 @@ class depgraph(object): self._dynamic_config._autounmask = False # backup state for restoration, in case of recursive # calls to this method + backup_parent = self._select_atoms_parent backup_state = mytrees.copy() try: # clear state from previous call, in case this # call is recursive (we have a backup, that we # will use to restore it later) + self._select_atoms_parent = None mytrees.pop("pkg_use_enabled", None) mytrees.pop("parent", None) mytrees.pop("atom_graph", None) @@ -4074,6 +4078,7 @@ class depgraph(object): mytrees["pkg_use_enabled"] = self._pkg_use_enabled if parent is not None: + self._select_atoms_parent = parent mytrees["parent"] = parent mytrees["atom_graph"] = atom_graph if priority is not None: @@ -4085,6 +4090,7 @@ class depgraph(object): finally: # restore state self._dynamic_config._autounmask = _autounmask_backup + self._select_atoms_parent = backup_parent mytrees.pop("pkg_use_enabled", None) mytrees.pop("parent", None) mytrees.pop("atom_graph", None) @@ -8529,6 +8535,21 @@ class _dep_check_composite_db(dbapi): elif not self._depgraph._equiv_ebuild_visible(pkg): return False + want_update = False + if self._depgraph._select_atoms_parent is not None: + want_update = \ + self._depgraph._want_update_pkg( + self._depgraph._select_atoms_parent, pkg) + + if want_update: + for new_child in self._depgraph._iter_similar_available( + pkg, next(iter(atom_set))): + if not self._depgraph._virt_deps_visible( + new_child, ignore_use=True): + continue + if pkg < new_child: + return False + in_graph = next(self._depgraph._dynamic_config._package_tracker.match( self._root, pkg.slot_atom, installed=False), None) diff --git a/pym/portage/tests/resolver/test_virtual_slot.py b/pym/portage/tests/resolver/test_virtual_slot.py index 1b19d77..2e5ca7f 100644 --- a/pym/portage/tests/resolver/test_virtual_slot.py +++ b/pym/portage/tests/resolver/test_virtual_slot.py @@ -92,6 +92,72 @@ class VirtualSlotResolverTestCase(TestCase): finally: playground.cleanup() + def testVirtualSubslotUpdate(self): + + ebuilds = { + "virtual/pypy-2.3.1" : { + "EAPI": "5", + "SLOT": "0/2.3", + "RDEPEND": "|| ( >=dev-python/pypy-2.3.1:0/2.3 >=dev-python/pypy-bin-2.3.1:0/2.3 ) " + }, + "virtual/pypy-2.4.0" : { + "EAPI": "5", + "SLOT": "0/2.4", + "RDEPEND": "|| ( >=dev-python/pypy-2.4.0:0/2.4 >=dev-python/pypy-bin-2.4.0:0/2.4 ) " + }, + "dev-python/pypy-2.3.1": { + "EAPI": "5", + "SLOT": "0/2.3" + }, + "dev-python/pypy-2.4.0": { + "EAPI": "5", + "SLOT": "0/2.4" + }, + "dev-python/pygments-1.6_p20140324-r1": { + "EAPI": "5", + "DEPEND": "virtual/pypy:=" + } + } + + installed = { + "virtual/pypy-2.3.1" : { + "EAPI": "5", + "SLOT": "0/2.3", + "RDEPEND": "|| ( >=dev-python/pypy-2.3.1:0/2.3 >=dev-python/pypy-bin-2.3.1:0/2.3 ) " + }, + "dev-python/pypy-2.3.1": { + "EAPI": "5", + "SLOT": "0/2.3" + }, + "dev-python/pygments-1.6_p20140324-r1": { + "EAPI": "5", + "DEPEND": "virtual/pypy:0/2.3=", + "RDEPEND": "virtual/pypy:0/2.3=", + } + } + + world = ["dev-python/pygments"] + + test_cases = ( + # bug 526160 - test for missed pypy sub-slot update + ResolverPlaygroundTestCase( + ["@world"], + options = {"--update": True, "--deep": True}, + success=True, + mergelist = ['dev-python/pypy-2.4.0', + 'virtual/pypy-2.4.0', + 'dev-python/pygments-1.6_p20140324-r1']), + ) + + playground = ResolverPlayground(debug=False, ebuilds=ebuilds, + installed=installed, world=world) + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, test_case.fail_msg) + finally: + playground.cleanup() + def testVirtualSlotDepclean(self): ebuilds = { -- 2.0.4