From ecf817d1b1913ddff65fb020c6bc5558d550d2bd Mon Sep 17 00:00:00 2001 From: Sebastian Luther Date: Tue, 7 Jan 2014 23:21:40 +0100 Subject: [PATCH] Bug #497238: Fix unnecessary rebuild caused by equal versions in different repositories. --- pym/_emerge/depgraph.py | 4 +- .../resolver/test_slot_conflict_rebuild.py | 44 ++++++++++++++++++- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 763f3fde9..83035c2e7 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1,4 +1,4 @@ -# Copyright 1999-2013 Gentoo Foundation +# Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function, unicode_literals @@ -1376,7 +1376,7 @@ class depgraph(object): selective and \ dep.parent.installed and \ dep.child.installed and \ - dep.parent.cpv == replacement_parent.cpv and \ + dep.parent >= replacement_parent and \ dep.child.cpv == pkg.cpv: # Then can happen if the child's sub-slot changed # without a revision bump. The sub-slot change is diff --git a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py index 5acdadbb5..17737cf45 100644 --- a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py +++ b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py @@ -1,4 +1,4 @@ -# Copyright 2012-2013 Gentoo Foundation +# Copyright 2012-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -364,3 +364,45 @@ class SlotConflictRebuildTestCase(TestCase): self.assertEqual(test_case.test_success, True, test_case.fail_msg) finally: playground.cleanup() + + + def testSlotConflictMultiRepo(self): + """ + Bug 497238 + Different repositories contain the same cpv with different sub-slots for + a slot operator child. + Downgrading the slot operator parent would result in a sub-slot change of + the installed package by changing the source repository. + Make sure we don't perform this undesirable rebuild. + """ + ebuilds = { + "net-firewall/iptables-1.4.21::overlay" : { "EAPI": "5", "SLOT": "0/10" }, + "sys-apps/iproute2-3.11.0::overlay" : { "EAPI": "5", "RDEPEND": "net-firewall/iptables:=" }, + + "net-firewall/iptables-1.4.21" : { "EAPI": "5", "SLOT": "0" }, + "sys-apps/iproute2-3.12.0": { "EAPI": "5", "RDEPEND": "net-firewall/iptables:=" }, + } + + installed = { + "net-firewall/iptables-1.4.21::overlay" : { "EAPI": "5", "SLOT": "0/10" }, + "sys-apps/iproute2-3.12.0": { "EAPI": "5", "RDEPEND": "net-firewall/iptables:0/10=" }, + } + + world = ["sys-apps/iproute2"] + + test_cases = ( + ResolverPlaygroundTestCase( + ["@world"], + options = {"--deep": True, "--update": True, "--verbose": True}, + success = True, + mergelist = []), + ) + + playground = ResolverPlayground(ebuilds=ebuilds, + installed=installed, world=world, debug=False) + 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() -- 2.26.2