Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/resolver/, lib/portage/tests/resolver/, lib/_emerge/
Date: Sun, 01 Sep 2019 17:54:12
Message-Id: 1567359234.994ac00aa764615ec6d319c7c1cb8123cf9f2aa1.zmedico@gentoo
1 commit: 994ac00aa764615ec6d319c7c1cb8123cf9f2aa1
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 24 22:30:29 2019 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 1 17:33:54 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=994ac00a
7
8 _slot_confict_backtrack: consider masking a package matched by all parent atoms (bug 692746)
9
10 When a slot conflict occurs involving a package that is matched by all
11 involved parent atoms, consider masking the package in order to avoid
12 a possible missed update. The included unit test demonstrates the case
13 fixed by this patch. There are 2 previously existing unit tests that
14 require larger backtracking values in order to succeed with this patch,
15 since more possible solutions are now considered.
16
17 Bug: https://bugs.gentoo.org/692746
18 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
19
20 lib/_emerge/depgraph.py | 5 ++
21 lib/_emerge/resolver/backtracking.py | 9 +++
22 .../resolver/test_slot_conflict_update_virt.py | 79 ++++++++++++++++++++++
23 .../resolver/test_slot_operator_complete_graph.py | 2 +-
24 .../test_slot_operator_runtime_pkg_mask.py | 2 +-
25 5 files changed, 95 insertions(+), 2 deletions(-)
26
27 diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
28 index 08240af67..6be1b3ec7 100644
29 --- a/lib/_emerge/depgraph.py
30 +++ b/lib/_emerge/depgraph.py
31 @@ -1768,6 +1768,11 @@ class depgraph(object):
32 debug = "--debug" in self._frozen_config.myopts
33 existing_node = next(self._dynamic_config._package_tracker.match(
34 root, slot_atom, installed=False))
35 + if existing_node not in conflict_pkgs:
36 + # Even though all parent atoms match existing_node,
37 + # consider masking it in order to avoid a missed update
38 + # as in bug 692746.
39 + conflict_pkgs.append(existing_node)
40 # In order to avoid a missed update, first mask lower versions
41 # that conflict with higher versions (the backtracker visits
42 # these in reverse order).
43
44 diff --git a/lib/_emerge/resolver/backtracking.py b/lib/_emerge/resolver/backtracking.py
45 index c29b9d42a..99e4565c8 100644
46 --- a/lib/_emerge/resolver/backtracking.py
47 +++ b/lib/_emerge/resolver/backtracking.py
48 @@ -135,11 +135,20 @@ class Backtracker(object):
49 continue
50
51 entry_is_valid = False
52 + any_conflict_parents = False
53
54 for ppkg, patom in runtime_pkg_mask[pkg].get("slot conflict", set()):
55 + any_conflict_parents = True
56 if ppkg not in runtime_pkg_mask:
57 entry_is_valid = True
58 break
59 + else:
60 + if not any_conflict_parents:
61 + # Even though pkg was involved in a slot conflict
62 + # where it was matched by all involved parent atoms,
63 + # consider masking it in order to avoid a missed
64 + # update as in bug 692746.
65 + entry_is_valid = True
66
67 if not entry_is_valid:
68 return False
69
70 diff --git a/lib/portage/tests/resolver/test_slot_conflict_update_virt.py b/lib/portage/tests/resolver/test_slot_conflict_update_virt.py
71 new file mode 100644
72 index 000000000..0bac095b8
73 --- /dev/null
74 +++ b/lib/portage/tests/resolver/test_slot_conflict_update_virt.py
75 @@ -0,0 +1,79 @@
76 +# Copyright 2019 Gentoo Authors
77 +# Distributed under the terms of the GNU General Public License v2
78 +
79 +from portage.tests import TestCase
80 +from portage.tests.resolver.ResolverPlayground import (ResolverPlayground,
81 + ResolverPlaygroundTestCase)
82 +
83 +class SlotConflictUpdateVirtTestCase(TestCase):
84 +
85 + def testSlotConflictUpdateVirt(self):
86 +
87 + ebuilds = {
88 + "dev-db/mysql-connector-c-6.1.11-r2" : {
89 + "EAPI": "7",
90 + "SLOT" : "0/18"
91 + },
92 +
93 + "dev-db/mysql-connector-c-8.0.17-r3" : {
94 + "EAPI": "7",
95 + "SLOT" : "0/21"
96 + },
97 +
98 + "virtual/libmysqlclient-18-r1" : {
99 + "EAPI": "7",
100 + "SLOT" : "0/18",
101 + "RDEPEND": "dev-db/mysql-connector-c:0/18",
102 + },
103 +
104 + "virtual/libmysqlclient-21" : {
105 + "EAPI": "7",
106 + "SLOT" : "0/21",
107 + "RDEPEND": "dev-db/mysql-connector-c:0/21",
108 + },
109 +
110 + "dev-perl/DBD-mysql-4.44.0" : {
111 + "EAPI": "7",
112 + "RDEPEND": "virtual/libmysqlclient:=",
113 + },
114 + }
115 +
116 + installed = {
117 + "dev-db/mysql-connector-c-6.1.11-r2" : {
118 + "EAPI": "7",
119 + "SLOT" : "0/18"
120 + },
121 +
122 + "virtual/libmysqlclient-18-r1" : {
123 + "EAPI": "7",
124 + "SLOT" : "0/18",
125 + "RDEPEND": "dev-db/mysql-connector-c:0/18",
126 + },
127 +
128 + "dev-perl/DBD-mysql-4.44.0" : {
129 + "EAPI": "7",
130 + "RDEPEND": "virtual/libmysqlclient:0/18=",
131 + },
132 + }
133 +
134 + world = ["dev-db/mysql-connector-c", "dev-perl/DBD-mysql"]
135 +
136 + test_cases = (
137 + # In order to avoid missed updates for bug 692746, consider
138 + # masking a package matched by all parent atoms.
139 + ResolverPlaygroundTestCase(
140 + ['@world'],
141 + options = {"--update": True, "--deep": True},
142 + success = True,
143 + mergelist = ['dev-db/mysql-connector-c-8.0.17-r3', 'virtual/libmysqlclient-21', 'dev-perl/DBD-mysql-4.44.0']),
144 + )
145 +
146 + playground = ResolverPlayground(ebuilds=ebuilds,
147 + installed=installed, world=world, debug=False)
148 + try:
149 + for test_case in test_cases:
150 + playground.run_TestCase(test_case)
151 + self.assertEqual(test_case.test_success, True, test_case.fail_msg)
152 + finally:
153 + playground.debug = False
154 + playground.cleanup()
155
156 diff --git a/lib/portage/tests/resolver/test_slot_operator_complete_graph.py b/lib/portage/tests/resolver/test_slot_operator_complete_graph.py
157 index 1d59bcef1..4dcae71ca 100644
158 --- a/lib/portage/tests/resolver/test_slot_operator_complete_graph.py
159 +++ b/lib/portage/tests/resolver/test_slot_operator_complete_graph.py
160 @@ -115,7 +115,7 @@ class SlotOperatorCompleteGraphTestCase(TestCase):
161 ResolverPlaygroundTestCase(
162 ["=app-misc/meta-pkg-2", "app-misc/C"],
163 options = {
164 - "--backtrack": 5,
165 + "--backtrack": 9,
166 },
167 success = True,
168 ambiguous_merge_order = True,
169
170 diff --git a/lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py b/lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py
171 index 0a5a7fa78..f8b53e2b5 100644
172 --- a/lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py
173 +++ b/lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py
174 @@ -110,7 +110,7 @@ class SlotOperatorRuntimePkgMaskTestCase(TestCase):
175 ResolverPlaygroundTestCase(
176 ["=app-misc/meta-pkg-2"],
177 options = {
178 - "--backtrack": 5,
179 + "--backtrack": 12,
180 },
181 success = True,
182 ambiguous_merge_order = True,