Bug #497238: Fix unnecessary rebuild caused by equal versions in different repositories.
authorSebastian Luther <SebastianLuther@gmx.de>
Tue, 7 Jan 2014 22:21:40 +0000 (23:21 +0100)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Tue, 7 Jan 2014 22:21:40 +0000 (23:21 +0100)
pym/_emerge/depgraph.py
pym/portage/tests/resolver/test_slot_conflict_rebuild.py

index 763f3fde91554a6e0e3485121e9f638063950f1a..83035c2e7211fe082f35849a52728158f49b5633 100644 (file)
@@ -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
index 5acdadbb5fdafcd9992ea6624c774df3eaa15951..17737cf4565986d614d4b4102b423d263f3a0192 100644 (file)
@@ -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()