1 |
commit: 1e61c439143b12d079e1fc344bbc0c192a84cbe0 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 11 02:54:51 2019 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 12 01:31:21 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1e61c439 |
7 |
|
8 |
_add_dep: less aggressive backtracking (bug 693836) |
9 |
|
10 |
In order to suppress the sort of aggressive backtracking that can |
11 |
trigger undesirable downgrades as in bug 693836, do not backtrack |
12 |
for an unsatisfied dependency if there's an available package in |
13 |
the runtime package mask which was involved in a slot conflict and |
14 |
satisfied all involved parent atoms. Instead, discard the current |
15 |
depgraph in favor of other backtracking configurations that may |
16 |
exist. This case would not have been encountered prior to the fix |
17 |
for bug 692746 which enabled backtracking for the type of slot |
18 |
conflict that is detected here. |
19 |
|
20 |
Fixes: 994ac00aa764 ("_slot_confict_backtrack: consider masking a package matched by all parent atoms (bug 692746)") |
21 |
Bug: https://bugs.gentoo.org/693836 |
22 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
23 |
|
24 |
lib/_emerge/depgraph.py | 13 ++++ |
25 |
.../test_aggressive_backtrack_downgrade.py | 91 ++++++++++++++++++++++ |
26 |
2 files changed, 104 insertions(+) |
27 |
|
28 |
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py |
29 |
index 6be1b3ec7..51614fc14 100644 |
30 |
--- a/lib/_emerge/depgraph.py |
31 |
+++ b/lib/_emerge/depgraph.py |
32 |
@@ -2888,6 +2888,19 @@ class depgraph(object): |
33 |
dep.atom.without_use if dep.atom.package |
34 |
else dep.atom, onlydeps=dep.onlydeps) |
35 |
if dep_pkg is None: |
36 |
+ |
37 |
+ # In order to suppress the sort of aggressive |
38 |
+ # backtracking that can trigger undesirable downgrades |
39 |
+ # as in bug 693836, do not backtrack if there's an |
40 |
+ # available package which was involved in a slot |
41 |
+ # conflict and satisfied all involved parent atoms. |
42 |
+ for dep_pkg, reasons in self._dynamic_config._runtime_pkg_mask.items(): |
43 |
+ if (dep.atom.match(dep_pkg) and |
44 |
+ len(reasons) == 1 and |
45 |
+ not reasons.get("slot conflict", True)): |
46 |
+ self._dynamic_config._skip_restart = True |
47 |
+ return 0 |
48 |
+ |
49 |
self._dynamic_config._backtrack_infos["missing dependency"] = dep |
50 |
self._dynamic_config._need_restart = True |
51 |
if debug: |
52 |
|
53 |
diff --git a/lib/portage/tests/resolver/test_aggressive_backtrack_downgrade.py b/lib/portage/tests/resolver/test_aggressive_backtrack_downgrade.py |
54 |
new file mode 100644 |
55 |
index 000000000..fbe85dc89 |
56 |
--- /dev/null |
57 |
+++ b/lib/portage/tests/resolver/test_aggressive_backtrack_downgrade.py |
58 |
@@ -0,0 +1,91 @@ |
59 |
+# Copyright 2019 Gentoo Authors |
60 |
+# Distributed under the terms of the GNU General Public License v2 |
61 |
+ |
62 |
+from portage.tests import TestCase |
63 |
+from portage.tests.resolver.ResolverPlayground import (ResolverPlayground, |
64 |
+ ResolverPlaygroundTestCase) |
65 |
+ |
66 |
+class AgressiveBacktrackDowngradeTestCase(TestCase): |
67 |
+ |
68 |
+ def testAgressiveBacktrackDowngrade(self): |
69 |
+ |
70 |
+ ebuilds = { |
71 |
+ 'www-client/firefox-69.0' : { |
72 |
+ 'EAPI': '7', |
73 |
+ 'RDEPEND': '=media-libs/libvpx-1.7*:0=[postproc] media-video/ffmpeg' |
74 |
+ }, |
75 |
+ |
76 |
+ 'www-client/firefox-60.9.0' : { |
77 |
+ 'EAPI': '7', |
78 |
+ 'RDEPEND': '' |
79 |
+ }, |
80 |
+ |
81 |
+ 'media-libs/libvpx-1.8.0' : { |
82 |
+ 'EAPI': '7', |
83 |
+ 'SLOT' : '0/6', |
84 |
+ 'IUSE': 'postproc', |
85 |
+ }, |
86 |
+ |
87 |
+ 'media-libs/libvpx-1.7.0' : { |
88 |
+ 'EAPI': '7', |
89 |
+ 'SLOT' : '0/5', |
90 |
+ 'IUSE': '+postproc', |
91 |
+ }, |
92 |
+ |
93 |
+ 'media-libs/libvpx-1.6.0' : { |
94 |
+ 'EAPI': '7', |
95 |
+ 'SLOT' : '0/4', |
96 |
+ 'IUSE': 'postproc', |
97 |
+ }, |
98 |
+ |
99 |
+ 'media-video/ffmpeg-4.2' : { |
100 |
+ 'EAPI': '7', |
101 |
+ 'RDEPEND': 'media-libs/libvpx:=', |
102 |
+ }, |
103 |
+ } |
104 |
+ |
105 |
+ installed = { |
106 |
+ 'www-client/firefox-69.0' : { |
107 |
+ 'EAPI': '7', |
108 |
+ 'RDEPEND': '=media-libs/libvpx-1.7*:0/5=[postproc] media-video/ffmpeg' |
109 |
+ }, |
110 |
+ |
111 |
+ 'media-libs/libvpx-1.7.0' : { |
112 |
+ 'EAPI': '7', |
113 |
+ 'SLOT' : '0/5', |
114 |
+ 'IUSE': '+postproc', |
115 |
+ 'USE': 'postproc', |
116 |
+ }, |
117 |
+ |
118 |
+ 'media-video/ffmpeg-4.2' : { |
119 |
+ 'EAPI': '7', |
120 |
+ 'RDEPEND': 'media-libs/libvpx:0/5=', |
121 |
+ }, |
122 |
+ } |
123 |
+ |
124 |
+ world = ['media-video/ffmpeg', 'www-client/firefox'] |
125 |
+ |
126 |
+ test_cases = ( |
127 |
+ # Test bug 693836, where an attempt to upgrade libvpx lead |
128 |
+ # to aggressive backtracking which ultimately triggered an |
129 |
+ # undesirable firefox downgrade like this: |
130 |
+ # [ebuild U ] media-libs/libvpx-1.8.0 [1.7.0] |
131 |
+ # [ebuild UD ] www-client/firefox-60.9.0 [69.0] |
132 |
+ # [ebuild rR ] media-video/ffmpeg-4.2 |
133 |
+ ResolverPlaygroundTestCase( |
134 |
+ ['@world'], |
135 |
+ options = {'--update': True, '--deep': True}, |
136 |
+ success = True, |
137 |
+ mergelist = [], |
138 |
+ ), |
139 |
+ ) |
140 |
+ |
141 |
+ playground = ResolverPlayground(ebuilds=ebuilds, |
142 |
+ installed=installed, world=world, debug=False) |
143 |
+ try: |
144 |
+ for test_case in test_cases: |
145 |
+ playground.run_TestCase(test_case) |
146 |
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg) |
147 |
+ finally: |
148 |
+ playground.debug = False |
149 |
+ playground.cleanup() |