1 |
I'm starting to be a bit sad about this for a couple of reasons. |
2 |
|
3 |
1) dep_zapdeps is pretty big at this point, and every tweak for || () just |
4 |
grows it. Do we have any idea: |
5 |
a) When dep_zapdeps will be 'done'? |
6 |
b) Plans for splitting it into more manageable pieces? |
7 |
2) In general I worry that the logic for || () will essentially never be |
8 |
complete, and we will be forced to tweak the implementation forever as |
9 |
cases arise where the algorithm fails to compute the 'right' answer. |
10 |
I'm a bit curious what 'right' even is anymore. The devmanual doesn't |
11 |
really describe how any-of dependencies are resolved and so the changes |
12 |
seem rather arbitrary. I am not worried about specific changes (like this |
13 |
one) but the fact that we continually apply changes to make the 'right' |
14 |
thing happen is the larger concern. |
15 |
|
16 |
-A |
17 |
|
18 |
On Tue, Jan 23, 2018 at 2:17 AM, Zac Medico <zmedico@g.o> wrote: |
19 |
|
20 |
> Fix the code from bug 643974 to set the installed_downgrade flag only |
21 |
> if the selected newer package is either installed or in the graph. This |
22 |
> is currently needed for appropriate handling of virtual/rust-1.19.0, |
23 |
> since there's an upgrade to dev-lang/rust-1.23.0 available which may |
24 |
> not be desired since it would mean that dev-lang/rust-bin-1.19.0 has |
25 |
> to be installed in order to satisfy virtual/rust-1.19.0: |
26 |
> |
27 |
> || ( =dev-lang/rust-1.19.0* =dev-lang/rust-bin-1.19.0* ) |
28 |
> |
29 |
> So, the rust-bin choice is desirable only if the rust-1.23.0 package is |
30 |
> already installed or in the graph. |
31 |
> |
32 |
> Fixes: 86ba22da7a2f ("dep_zapdeps: install new package, allow upgrade (bug |
33 |
> 643974)") |
34 |
> Bug: https://bugs.gentoo.org/645416 |
35 |
> --- |
36 |
> pym/portage/dep/dep_check.py | 10 ++-- |
37 |
> .../tests/resolver/test_or_upgrade_installed.py | 59 |
38 |
> ++++++++++++++++++++++ |
39 |
> 2 files changed, 66 insertions(+), 3 deletions(-) |
40 |
> |
41 |
> diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py |
42 |
> index c56f545ec..7e5a3186e 100644 |
43 |
> --- a/pym/portage/dep/dep_check.py |
44 |
> +++ b/pym/portage/dep/dep_check.py |
45 |
> @@ -463,11 +463,15 @@ def dep_zapdeps(unreduced, reduced, myroot, |
46 |
> use_binaries=0, trees=None): |
47 |
> avail_pkg = avail_pkg_use |
48 |
> avail_slot = Atom("%s:%s" % |
49 |
> (atom.cp, avail_pkg.slot)) |
50 |
> |
51 |
> - if downgrade_probe is not None: |
52 |
> + if downgrade_probe is not None and graph is not |
53 |
> None: |
54 |
> highest_in_slot = |
55 |
> mydbapi_match_pkgs(avail_slot) |
56 |
> + highest_in_slot = (highest_in_slot[-1] |
57 |
> + if highest_in_slot else None) |
58 |
> if (avail_pkg and highest_in_slot and |
59 |
> - avail_pkg < highest_in_slot[-1] and |
60 |
> - not downgrade_probe(avail_pkg)): |
61 |
> + avail_pkg < highest_in_slot and |
62 |
> + not downgrade_probe(avail_pkg) and |
63 |
> + (highest_in_slot.installed or |
64 |
> + highest_in_slot in graph)): |
65 |
> installed_downgrade = True |
66 |
> |
67 |
> slot_map[avail_slot] = avail_pkg |
68 |
> diff --git a/pym/portage/tests/resolver/test_or_upgrade_installed.py |
69 |
> b/pym/portage/tests/resolver/test_or_upgrade_installed.py |
70 |
> index 6e01d321d..7018e08de 100644 |
71 |
> --- a/pym/portage/tests/resolver/test_or_upgrade_installed.py |
72 |
> +++ b/pym/portage/tests/resolver/test_or_upgrade_installed.py |
73 |
> @@ -99,3 +99,62 @@ class OrUpgradeInstalledTestCase(TestCase): |
74 |
> finally: |
75 |
> playground.debug = False |
76 |
> playground.cleanup() |
77 |
> + |
78 |
> + def testVirtualRust(self): |
79 |
> + ebuilds = { |
80 |
> + 'dev-lang/rust-1.19.0': {}, |
81 |
> + 'dev-lang/rust-1.23.0': {}, |
82 |
> + 'dev-lang/rust-bin-1.19.0': {}, |
83 |
> + 'virtual/rust-1.19.0': { |
84 |
> + 'RDEPEND': '|| ( =dev-lang/rust-1.19.0* |
85 |
> =dev-lang/rust-bin-1.19.0* )' |
86 |
> + }, |
87 |
> + } |
88 |
> + |
89 |
> + installed = { |
90 |
> + 'dev-lang/rust-1.19.0': {}, |
91 |
> + 'virtual/rust-1.19.0': { |
92 |
> + 'RDEPEND': '|| ( =dev-lang/rust-1.19.0* |
93 |
> =dev-lang/rust-bin-1.19.0* )' |
94 |
> + }, |
95 |
> + } |
96 |
> + |
97 |
> + world = ['virtual/rust'] |
98 |
> + |
99 |
> + test_cases = ( |
100 |
> + # Test bug 645416, where rust-bin-1.19.0 was |
101 |
> pulled in |
102 |
> + # inappropriately due to the rust-1.23.0 update |
103 |
> being |
104 |
> + # available. |
105 |
> + ResolverPlaygroundTestCase( |
106 |
> + ['virtual/rust'], |
107 |
> + options={'--update': True, '--deep': True}, |
108 |
> + success=True, |
109 |
> + mergelist=[] |
110 |
> + ), |
111 |
> + # Test upgrade to rust-1.23.0, which is only |
112 |
> possible |
113 |
> + # if rust-bin-1.19.0 is installed in order to |
114 |
> satisfy |
115 |
> + # virtual/rust-1.19.0. |
116 |
> + ResolverPlaygroundTestCase( |
117 |
> + ['=dev-lang/rust-1.23.0', 'virtual/rust'], |
118 |
> + options={'--update': True, '--deep': True}, |
119 |
> + all_permutations=True, |
120 |
> + success=True, |
121 |
> + ambiguous_merge_order=True, |
122 |
> + mergelist=( |
123 |
> + ( |
124 |
> + 'dev-lang/rust-1.23.0', |
125 |
> + 'dev-lang/rust-bin-1.19.0', |
126 |
> + ), |
127 |
> + ), |
128 |
> + ), |
129 |
> + ) |
130 |
> + |
131 |
> + playground = ResolverPlayground(debug=False, |
132 |
> + ebuilds=ebuilds, installed=installed, world=world) |
133 |
> + |
134 |
> + try: |
135 |
> + for test_case in test_cases: |
136 |
> + playground.run_TestCase(test_case) |
137 |
> + self.assertEqual(test_case.test_success, |
138 |
> True, |
139 |
> + test_case.fail_msg) |
140 |
> + finally: |
141 |
> + playground.debug = False |
142 |
> + playground.cleanup() |
143 |
> -- |
144 |
> 2.13.6 |
145 |
> |
146 |
> |
147 |
> |