summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2020-01-31 20:53:45 -0800
committerZac Medico <zmedico@gentoo.org>2020-02-01 12:54:11 -0800
commitd77d933b4a9cb2b830e661806a2a8689ffbac0ef (patch)
tree1352677a56ab3a00fc2dad9786808723c2cec13b
parentAdd test case that demonstrates bug 707108 (diff)
downloadportage-d77d933b4a9cb2b830e661806a2a8689ffbac0ef.tar.gz
portage-d77d933b4a9cb2b830e661806a2a8689ffbac0ef.tar.bz2
portage-d77d933b4a9cb2b830e661806a2a8689ffbac0ef.zip
depclean: do not eliminate upgrades (bug 707108)
For depclean actions, prefer choices where all packages have been pulled into the graph, except for choices that eliminate upgrades. This solves the test case for bug 707108, where depclean eliminated a new slot of python that had been pulled in by a world update. This should also prevent non-deterministic elimination of the latest vala slot that was reported in bug 693790. NOTE: There's a common perception (expressed in bug 705700) that emerge is pulling in an "unecessary" python slot in cases when that python slot is not enabled in PYTHON_TARGETS. However, the so-called "unnecessary" slot is practically indistinguishable from a desirable upgrade such as the missed llvm slot upgrade that was reported in bug 706278. Therefore, be advised that emerge must pull in the highest visible slot (regardless of PYTHON_TARGETS) in order to ensure that a desirable upgrade is not missed. Fixes: f7d83d75c6b0 ("dep_zapdeps: adjust || preference for slot upgrades (bug 706278)") Bug: https://bugs.gentoo.org/707108 Bug: https://bugs.gentoo.org/706278 Bug: https://bugs.gentoo.org/705700 Bug: https://bugs.gentoo.org/693790 Signed-off-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r--lib/portage/dep/dep_check.py23
-rw-r--r--lib/portage/tests/resolver/test_or_choices.py4
2 files changed, 15 insertions, 12 deletions
diff --git a/lib/portage/dep/dep_check.py b/lib/portage/dep/dep_check.py
index a7ae2cfa4..8adb92da2 100644
--- a/lib/portage/dep/dep_check.py
+++ b/lib/portage/dep/dep_check.py
@@ -690,17 +690,12 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None,
# choice_1 will not be promoted, so move on
break
if (
- # For removal actions, prefer choices where all packages
- # have been pulled into the graph.
- (graph_interface and graph_interface.removal_action and
- choice_1.all_in_graph and not choice_2.all_in_graph)
-
# Prefer choices where all_installed_slots is True, except
# in cases where we want to upgrade to a new slot as in
# bug 706278. Don't compare new_slot_count here since that
# would aggressively override the preference order defined
# in the ebuild, breaking the test case for bug 645002.
- or (choice_1.all_installed_slots and
+ (choice_1.all_installed_slots and
not choice_2.all_installed_slots and
not choice_2.want_update)
):
@@ -711,8 +706,6 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None,
break
intersecting_cps = cps.intersection(choice_2.cp_map)
- if not intersecting_cps:
- continue
has_upgrade = False
has_downgrade = False
for cp in intersecting_cps:
@@ -724,8 +717,18 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None,
has_upgrade = True
else:
has_downgrade = True
- break
- if has_upgrade and not has_downgrade:
+
+ if (
+ # Prefer upgrades.
+ (has_upgrade and not has_downgrade)
+
+ # For removal actions, prefer choices where all packages
+ # have been pulled into the graph, except for choices that
+ # eliminate upgrades.
+ or (graph_interface and graph_interface.removal_action and
+ choice_1.all_in_graph and not choice_2.all_in_graph and
+ not (has_downgrade and not has_upgrade))
+ ):
# promote choice_1 in front of choice_2
choices.remove(choice_1)
index_2 = choices.index(choice_2)
diff --git a/lib/portage/tests/resolver/test_or_choices.py b/lib/portage/tests/resolver/test_or_choices.py
index 78946ccec..10c613e39 100644
--- a/lib/portage/tests/resolver/test_or_choices.py
+++ b/lib/portage/tests/resolver/test_or_choices.py
@@ -387,13 +387,13 @@ class OrChoicesTestCase(TestCase):
}
test_cases = (
- # Demonstrate bug 707108, where a new python slot is erroneosly
+ # Test for bug 707108, where a new python slot was erroneously
# removed by emerge --depclean.
ResolverPlaygroundTestCase(
[],
options={"--depclean": True},
success=True,
- cleanlist=['dev-lang/python-3.8'],
+ cleanlist=[],
),
)