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/portage/dep/, lib/portage/tests/resolver/
Date: Sat, 01 Feb 2020 21:09:44
Message-Id: 1580590451.d77d933b4a9cb2b830e661806a2a8689ffbac0ef.zmedico@gentoo
1 commit: d77d933b4a9cb2b830e661806a2a8689ffbac0ef
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 1 04:53:45 2020 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 1 20:54:11 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d77d933b
7
8 depclean: do not eliminate upgrades (bug 707108)
9
10 For depclean actions, prefer choices where all packages have been
11 pulled into the graph, except for choices that eliminate upgrades.
12 This solves the test case for bug 707108, where depclean eliminated
13 a new slot of python that had been pulled in by a world update.
14 This should also prevent non-deterministic elimination of the
15 latest vala slot that was reported in bug 693790.
16
17 NOTE: There's a common perception (expressed in bug 705700) that
18 emerge is pulling in an "unecessary" python slot in cases when that
19 python slot is not enabled in PYTHON_TARGETS. However, the so-called
20 "unnecessary" slot is practically indistinguishable from a desirable
21 upgrade such as the missed llvm slot upgrade that was reported in
22 bug 706278. Therefore, be advised that emerge must pull in the
23 highest visible slot (regardless of PYTHON_TARGETS) in order to
24 ensure that a desirable upgrade is not missed.
25
26 Fixes: f7d83d75c6b0 ("dep_zapdeps: adjust || preference for slot upgrades (bug 706278)")
27 Bug: https://bugs.gentoo.org/707108
28 Bug: https://bugs.gentoo.org/706278
29 Bug: https://bugs.gentoo.org/705700
30 Bug: https://bugs.gentoo.org/693790
31 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
32
33 lib/portage/dep/dep_check.py | 23 +++++++++++++----------
34 lib/portage/tests/resolver/test_or_choices.py | 4 ++--
35 2 files changed, 15 insertions(+), 12 deletions(-)
36
37 diff --git a/lib/portage/dep/dep_check.py b/lib/portage/dep/dep_check.py
38 index a7ae2cfa4..8adb92da2 100644
39 --- a/lib/portage/dep/dep_check.py
40 +++ b/lib/portage/dep/dep_check.py
41 @@ -690,17 +690,12 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None,
42 # choice_1 will not be promoted, so move on
43 break
44 if (
45 - # For removal actions, prefer choices where all packages
46 - # have been pulled into the graph.
47 - (graph_interface and graph_interface.removal_action and
48 - choice_1.all_in_graph and not choice_2.all_in_graph)
49 -
50 # Prefer choices where all_installed_slots is True, except
51 # in cases where we want to upgrade to a new slot as in
52 # bug 706278. Don't compare new_slot_count here since that
53 # would aggressively override the preference order defined
54 # in the ebuild, breaking the test case for bug 645002.
55 - or (choice_1.all_installed_slots and
56 + (choice_1.all_installed_slots and
57 not choice_2.all_installed_slots and
58 not choice_2.want_update)
59 ):
60 @@ -711,8 +706,6 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None,
61 break
62
63 intersecting_cps = cps.intersection(choice_2.cp_map)
64 - if not intersecting_cps:
65 - continue
66 has_upgrade = False
67 has_downgrade = False
68 for cp in intersecting_cps:
69 @@ -724,8 +717,18 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None,
70 has_upgrade = True
71 else:
72 has_downgrade = True
73 - break
74 - if has_upgrade and not has_downgrade:
75 +
76 + if (
77 + # Prefer upgrades.
78 + (has_upgrade and not has_downgrade)
79 +
80 + # For removal actions, prefer choices where all packages
81 + # have been pulled into the graph, except for choices that
82 + # eliminate upgrades.
83 + or (graph_interface and graph_interface.removal_action and
84 + choice_1.all_in_graph and not choice_2.all_in_graph and
85 + not (has_downgrade and not has_upgrade))
86 + ):
87 # promote choice_1 in front of choice_2
88 choices.remove(choice_1)
89 index_2 = choices.index(choice_2)
90
91 diff --git a/lib/portage/tests/resolver/test_or_choices.py b/lib/portage/tests/resolver/test_or_choices.py
92 index 78946ccec..10c613e39 100644
93 --- a/lib/portage/tests/resolver/test_or_choices.py
94 +++ b/lib/portage/tests/resolver/test_or_choices.py
95 @@ -387,13 +387,13 @@ class OrChoicesTestCase(TestCase):
96 }
97
98 test_cases = (
99 - # Demonstrate bug 707108, where a new python slot is erroneosly
100 + # Test for bug 707108, where a new python slot was erroneously
101 # removed by emerge --depclean.
102 ResolverPlaygroundTestCase(
103 [],
104 options={"--depclean": True},
105 success=True,
106 - cleanlist=['dev-lang/python-3.8'],
107 + cleanlist=[],
108 ),
109 )