diff options
author | 2020-09-19 14:32:41 -0700 | |
---|---|---|
committer | 2020-09-20 15:27:32 -0700 | |
commit | f64310749f176f8921b72ce282b4294efe81c3f0 (patch) | |
tree | 3c205d6167c1e04e54568bc06a7f6696225f7027 /lib/_emerge/depgraph.py | |
parent | Add mercurial sync support (diff) | |
download | portage-f64310749f176f8921b72ce282b4294efe81c3f0.tar.gz portage-f64310749f176f8921b72ce282b4294efe81c3f0.tar.bz2 portage-f64310749f176f8921b72ce282b4294efe81c3f0.zip |
_slot_confict_backtrack: minimize conflict atoms (bug 743631)
Prefer choices that minimize conflict atoms, so that choices
which satisfy all parents are preferred. This reduces the
minimum necessary backtrack tries from 21 to 7 for the unit
test related to bug 743115.
Bug: https://bugs.gentoo.org/743115
Bug: https://bugs.gentoo.org/743631
Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib/_emerge/depgraph.py')
-rw-r--r-- | lib/_emerge/depgraph.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 3f864aefc..7281d8692 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -1797,6 +1797,12 @@ class depgraph: if parent_atom not in parent_atoms) backtrack_data.append((to_be_masked, conflict_atoms)) + # Prefer choices that minimize conflict atoms. This is intended + # to take precedence over the earlier package version sort. The + # package version sort is still needed or else choices for the + # testOverlapSlotConflict method of VirtualMinimizeChildrenTestCase + # become non-deterministic. + backtrack_data.sort(key=lambda item: len(item[1])) to_be_masked = backtrack_data[-1][0] self._dynamic_config._backtrack_infos.setdefault( |