commit: 600b329949f8770fe2962987ee97567b65393c7e Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Tue Apr 10 21:29:44 2018 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Thu Apr 12 02:43:47 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=600b3299
_slot_operator.._reinstalls: probe binpkg rebuild (bug 652938) If the parent is not installed, check if it needs to be rebuilt against an installed instance, since otherwise it could trigger downgrade of an installed instance. Bug: https://bugs.gentoo.org/652938 Reviewed-by: Manuel RĂ¼ger <mrueg <AT> gentoo.org> pym/_emerge/depgraph.py | 10 ++++- .../tests/resolver/test_slot_operator_rebuild.py | 45 +++++++++++++++++++++- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 160ea5e94..67f912f5e 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2571,17 +2571,23 @@ class depgraph(object): isinstance(dep.parent, Package) and dep.parent.built): continue + # If the parent is not installed, check if it needs to be + # rebuilt against an installed instance, since otherwise + # it could trigger downgrade of an installed instance as + # in bug #652938. + want_update_probe = dep.want_update or not dep.parent.installed + # Check for slot update first, since we don't want to # trigger reinstall of the child package when a newer # slot will be used instead. - if rebuild_if_new_slot and dep.want_update: + if rebuild_if_new_slot and want_update_probe: new_dep = self._slot_operator_update_probe(dep, new_child_slot=True) if new_dep is not None: self._slot_operator_update_backtrack(dep, new_child_slot=new_dep.child) - if dep.want_update: + if want_update_probe: if self._slot_operator_update_probe(dep): self._slot_operator_update_backtrack(dep) diff --git a/pym/portage/tests/resolver/test_slot_operator_rebuild.py b/pym/portage/tests/resolver/test_slot_operator_rebuild.py index 42512aad8..381683331 100644 --- a/pym/portage/tests/resolver/test_slot_operator_rebuild.py +++ b/pym/portage/tests/resolver/test_slot_operator_rebuild.py @@ -1,4 +1,4 @@ -# Copyright 2014 Gentoo Foundation +# Copyright 2014-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -31,6 +31,32 @@ class SlotOperatorRebuildTestCase(TestCase): "RDEPEND": "|| ( app-misc/X app-misc/A:= )" }, + "app-misc/D-1" : { + "EAPI": "6", + "RDEPEND": "app-misc/E", + }, + + "app-misc/E-1" : { + "EAPI": "6", + "RDEPEND": "app-misc/F:=", + }, + + "app-misc/F-1" : { + "EAPI": "6", + "SLOT": "0/1" + }, + + "app-misc/F-2" : { + "EAPI": "6", + "SLOT": "0/2" + }, + } + + binpkgs = { + "app-misc/E-1" : { + "EAPI": "6", + "RDEPEND": "app-misc/F:0/1=", + }, } installed = { @@ -50,6 +76,10 @@ class SlotOperatorRebuildTestCase(TestCase): "RDEPEND": "|| ( app-misc/X app-misc/A:0/1= )" }, + "app-misc/F-2" : { + "EAPI": "6", + "SLOT": "0/2" + }, } world = ["app-misc/B", "app-misc/C"] @@ -68,9 +98,20 @@ class SlotOperatorRebuildTestCase(TestCase): mergelist = ['app-misc/A-2', ('app-misc/B-0', 'app-misc/C-0')] ), + # Test bug #652938, where a binary package built against an + # older subslot triggered downgrade of an installed package. + # In this case we want to reject the app-misc/E-1 binary + # package, and rebuild it against the installed instance of + # app-misc/F. + ResolverPlaygroundTestCase( + ["app-misc/D"], + options = {'--usepkg': True}, + success = True, + mergelist = ['app-misc/E-1', 'app-misc/D-1'] + ), ) - playground = ResolverPlayground(ebuilds=ebuilds, + playground = ResolverPlayground(ebuilds=ebuilds, binpkgs=binpkgs, installed=installed, world=world, debug=False) try: for test_case in test_cases:
