1 |
On Wed, 8 Mar 2017 03:09:06 -0800 |
2 |
Zac Medico <zmedico@g.o> wrote: |
3 |
|
4 |
> Fix package selection logic to avoid pulling in undesirable |
5 |
> rebuilds/updates during backtracking for slot operator rebuilds. |
6 |
> The undesirable rebuilds/updates have sent some calculations off |
7 |
> course, by triggering more and more rebuilds/updates with each |
8 |
> backtracking run. |
9 |
> |
10 |
> In order to solve the problem, make various adjustments to the |
11 |
> package selection logic so that installed packages are preferred |
12 |
> over rebuilds/updates when appropriate. Also update unit tests |
13 |
> to work with these adjustments. |
14 |
> |
15 |
> Fixes: 5842e87872fd ("Fix slot operator handling bug") |
16 |
> X-Gentoo-bug: 612042 |
17 |
> X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=612042 |
18 |
> --- |
19 |
> pym/_emerge/depgraph.py | 11 |
20 |
> +++++++++-- .../resolver/soname/test_slot_conflict_reinstall.py |
21 |
> | 16 +++++++++++++++- |
22 |
> pym/portage/tests/resolver/test_slot_abi.py | 12 |
23 |
> +++++------- pym/portage/tests/resolver/test_slot_conflict_rebuild.py |
24 |
> | 8 +++++++- 4 files changed, 36 insertions(+), 11 deletions(-) |
25 |
> |
26 |
> diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
27 |
> index ce0fde1..3ba631e 100644 |
28 |
> --- a/pym/_emerge/depgraph.py |
29 |
> +++ b/pym/_emerge/depgraph.py |
30 |
> @@ -2304,7 +2304,7 @@ class depgraph(object): |
31 |
> # Check for slot update first, since |
32 |
> we don't want to # trigger reinstall of the child package when a newer |
33 |
> # slot will be used instead. |
34 |
> - if rebuild_if_new_slot: |
35 |
> + if rebuild_if_new_slot and |
36 |
> dep.want_update: new_dep = self._slot_operator_update_probe(dep, |
37 |
> new_child_slot=True) |
38 |
> if new_dep is not None: |
39 |
> @@ -6241,7 +6241,7 @@ class depgraph(object): |
40 |
> if |
41 |
> highest_installed is None or pkg.version > highest_installed.version: |
42 |
> highest_installed = pkg |
43 |
> - if highest_installed: |
44 |
> + if highest_installed and |
45 |
> self._want_update_pkg(parent, highest_installed): non_installed = |
46 |
> [pkg for pkg in matched_packages \ if not pkg.installed and |
47 |
> pkg.version > highest_installed.version] |
48 |
> @@ -6285,11 +6285,18 @@ class depgraph(object): |
49 |
> built_timestamp != |
50 |
> installed_timestamp: return built_pkg, existing_node |
51 |
> |
52 |
> + inst_pkg = None |
53 |
> for pkg in matched_packages: |
54 |
> + if pkg.installed: |
55 |
> + inst_pkg = pkg |
56 |
> if pkg.installed and pkg.invalid: |
57 |
> matched_packages = [x for x |
58 |
> in \ matched_packages if x is not pkg] |
59 |
> |
60 |
> + if (inst_pkg is not None and parent is not |
61 |
> None and |
62 |
> + not self._want_update_pkg(parent, |
63 |
> inst_pkg)): |
64 |
> + return inst_pkg, existing_node |
65 |
> + |
66 |
> if avoid_update: |
67 |
> for pkg in matched_packages: |
68 |
> if pkg.installed and |
69 |
> self._pkg_visibility_check(pkg, autounmask_level): diff --git |
70 |
> a/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py |
71 |
> b/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py |
72 |
> index f474761..f715444 100644 --- |
73 |
> a/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py |
74 |
> +++ |
75 |
> b/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py |
76 |
> @@ -251,13 +251,27 @@ class |
77 |
> SonameSlotConflictReinstallTestCase(TestCase): success = True, |
78 |
> mergelist = [ '[binary]app-misc/B-2', |
79 |
> + '[binary]app-misc/A-2', |
80 |
> + ] |
81 |
> + ), |
82 |
> + ResolverPlaygroundTestCase( |
83 |
> + ["@world"], |
84 |
> + options = { |
85 |
> + "--ignore-soname-deps": "n", |
86 |
> + "--usepkgonly": True, |
87 |
> + "--update": True, |
88 |
> + "--deep": True, |
89 |
> + }, |
90 |
> + success = True, |
91 |
> + mergelist = [ |
92 |
> + '[binary]app-misc/B-2', |
93 |
> '[binary]app-misc/C-1', |
94 |
> '[binary]app-misc/A-2', |
95 |
> ] |
96 |
> ), |
97 |
> ) |
98 |
> |
99 |
> - world = [] |
100 |
> + world = ['app-misc/A'] |
101 |
> |
102 |
> playground = ResolverPlayground(binpkgs=binpkgs, |
103 |
> installed=installed, world=world, |
104 |
> debug=False) diff --git a/pym/portage/tests/resolver/test_slot_abi.py |
105 |
> b/pym/portage/tests/resolver/test_slot_abi.py index 7263504..7dbbebe |
106 |
> 100644 --- a/pym/portage/tests/resolver/test_slot_abi.py |
107 |
> +++ b/pym/portage/tests/resolver/test_slot_abi.py |
108 |
> @@ -170,23 +170,21 @@ class SlotAbiTestCase(TestCase): |
109 |
> |
110 |
> test_cases = ( |
111 |
> |
112 |
> + # The first 2 test cases don't trigger a |
113 |
> libreoffice rebuild |
114 |
> + # because sys-libs/db is the only package |
115 |
> requested, and a |
116 |
> + # rebuild is not necessary because the |
117 |
> sys-libs/db:4.7 slot |
118 |
> + # remains installed. |
119 |
> ResolverPlaygroundTestCase( |
120 |
> ["sys-libs/db"], |
121 |
> options = {"--oneshot": True}, |
122 |
> success = True, |
123 |
> - mergelist = ["sys-libs/db-4.8", |
124 |
> "app-office/libreoffice-3.5.4.2"]), - |
125 |
> - ResolverPlaygroundTestCase( |
126 |
> - ["sys-libs/db"], |
127 |
> - options = {"--oneshot": True, |
128 |
> "--ignore-built-slot-operator-deps": "y"}, |
129 |
> - success = True, |
130 |
> mergelist = ["sys-libs/db-4.8"]), |
131 |
> |
132 |
> ResolverPlaygroundTestCase( |
133 |
> ["sys-libs/db"], |
134 |
> options = {"--oneshot": True, |
135 |
> "--usepkg": True}, success = True, |
136 |
> - mergelist = |
137 |
> ["[binary]sys-libs/db-4.8", "app-office/libreoffice-3.5.4.2"]), |
138 |
> + mergelist = |
139 |
> ["[binary]sys-libs/db-4.8"]), |
140 |
> ResolverPlaygroundTestCase( |
141 |
> ["sys-libs/db"], |
142 |
> diff --git a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py |
143 |
> b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py index |
144 |
> 2dfa79c..95b6396 100644 --- |
145 |
> a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py +++ |
146 |
> b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py @@ -165,7 |
147 |
> +165,7 @@ class SlotConflictRebuildTestCase(TestCase): ["app-misc/A"], |
148 |
> ignore_mergelist_order=True, |
149 |
> all_permutations=True, |
150 |
> - options = {"--backtrack": 3, |
151 |
> '--deep': True}, |
152 |
> + options = {"--backtrack": 3, |
153 |
> '--update': True, '--deep': True}, success = True, |
154 |
> mergelist = expected_mergelist), |
155 |
> ) |
156 |
> @@ -229,6 +229,12 @@ class SlotConflictRebuildTestCase(TestCase): |
157 |
> ResolverPlaygroundTestCase( |
158 |
> ["app-misc/A"], |
159 |
> success = True, |
160 |
> + mergelist = ['app-misc/A-2']), |
161 |
> + |
162 |
> + ResolverPlaygroundTestCase( |
163 |
> + ["app-misc/A"], |
164 |
> + options={"--update": True, "--deep": |
165 |
> True}, |
166 |
> + success = True, |
167 |
> mergelist = ['app-misc/B-2', |
168 |
> 'app-misc/C-1', 'app-misc/A-2']), ) |
169 |
> |
170 |
|
171 |
looks good :) |
172 |
|
173 |
-- |
174 |
Brian Dolbec <dolsen> |