Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] _slot_operator.._reinstalls: probe binpkg rebuild (bug 652938)
Date: Tue, 10 Apr 2018 21:42:53
Message-Id: 20180410214215.18740-1-zmedico@gentoo.org
1 If the parent is not installed, check if it needs to be rebuilt against
2 an installed instance, since otherwise it could trigger downgrade of
3 an installed instance.
4
5 Bug: https://bugs.gentoo.org/652938
6 ---
7 pym/_emerge/depgraph.py | 10 ++++-
8 .../tests/resolver/test_slot_operator_rebuild.py | 43 +++++++++++++++++++++-
9 2 files changed, 50 insertions(+), 3 deletions(-)
10
11 diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
12 index 160ea5e94..67f912f5e 100644
13 --- a/pym/_emerge/depgraph.py
14 +++ b/pym/_emerge/depgraph.py
15 @@ -2571,17 +2571,23 @@ class depgraph(object):
16 isinstance(dep.parent, Package) and dep.parent.built):
17 continue
18
19 + # If the parent is not installed, check if it needs to be
20 + # rebuilt against an installed instance, since otherwise
21 + # it could trigger downgrade of an installed instance as
22 + # in bug #652938.
23 + want_update_probe = dep.want_update or not dep.parent.installed
24 +
25 # Check for slot update first, since we don't want to
26 # trigger reinstall of the child package when a newer
27 # slot will be used instead.
28 - if rebuild_if_new_slot and dep.want_update:
29 + if rebuild_if_new_slot and want_update_probe:
30 new_dep = self._slot_operator_update_probe(dep,
31 new_child_slot=True)
32 if new_dep is not None:
33 self._slot_operator_update_backtrack(dep,
34 new_child_slot=new_dep.child)
35
36 - if dep.want_update:
37 + if want_update_probe:
38 if self._slot_operator_update_probe(dep):
39 self._slot_operator_update_backtrack(dep)
40
41 diff --git a/pym/portage/tests/resolver/test_slot_operator_rebuild.py b/pym/portage/tests/resolver/test_slot_operator_rebuild.py
42 index 42512aad8..46bad7de4 100644
43 --- a/pym/portage/tests/resolver/test_slot_operator_rebuild.py
44 +++ b/pym/portage/tests/resolver/test_slot_operator_rebuild.py
45 @@ -31,6 +31,32 @@ class SlotOperatorRebuildTestCase(TestCase):
46 "RDEPEND": "|| ( app-misc/X app-misc/A:= )"
47 },
48
49 + "app-misc/D-1" : {
50 + "EAPI": "6",
51 + "RDEPEND": "app-misc/E",
52 + },
53 +
54 + "app-misc/E-1" : {
55 + "EAPI": "6",
56 + "RDEPEND": "app-misc/F:=",
57 + },
58 +
59 + "app-misc/F-1" : {
60 + "EAPI": "6",
61 + "SLOT": "0/1"
62 + },
63 +
64 + "app-misc/F-2" : {
65 + "EAPI": "6",
66 + "SLOT": "0/2"
67 + },
68 + }
69 +
70 + binpkgs = {
71 + "app-misc/E-1" : {
72 + "EAPI": "6",
73 + "RDEPEND": "app-misc/F:0/1=",
74 + },
75 }
76
77 installed = {
78 @@ -50,6 +76,10 @@ class SlotOperatorRebuildTestCase(TestCase):
79 "RDEPEND": "|| ( app-misc/X app-misc/A:0/1= )"
80 },
81
82 + "app-misc/F-2" : {
83 + "EAPI": "6",
84 + "SLOT": "0/2"
85 + },
86 }
87
88 world = ["app-misc/B", "app-misc/C"]
89 @@ -68,9 +98,20 @@ class SlotOperatorRebuildTestCase(TestCase):
90 mergelist = ['app-misc/A-2', ('app-misc/B-0', 'app-misc/C-0')]
91 ),
92
93 + # Test bug #652938, where a binary package built against an
94 + # older subslot triggered downgrade of an installed package.
95 + # In this case we want to reject the app-misc/E-1 binary
96 + # package, and rebuild it against the installed instance of
97 + # app-misc/F.
98 + ResolverPlaygroundTestCase(
99 + ["app-misc/D"],
100 + options = {'--usepkg': True},
101 + success = True,
102 + mergelist = ['app-misc/E-1', 'app-misc/D-1']
103 + ),
104 )
105
106 - playground = ResolverPlayground(ebuilds=ebuilds,
107 + playground = ResolverPlayground(ebuilds=ebuilds, binpkgs=binpkgs,
108 installed=installed, world=world, debug=False)
109 try:
110 for test_case in test_cases:
111 --
112 2.13.6