From f3b89e80bc5779a784427b1435758c0f88946c05 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 2 Aug 2013 01:54:25 -0700 Subject: [PATCH] _slot_confict_backtrack: simplify code The order of backtrack_data is simply based on version comparison since commit 9b6f69e2a66c0f1d1d6545208edb3c45eacfd845. --- pym/_emerge/depgraph.py | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 39ae3eab8..4f9d0f027 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -6,7 +6,6 @@ from __future__ import print_function, unicode_literals import errno import io import logging -import operator import stat import sys import textwrap @@ -959,20 +958,11 @@ class depgraph(object): debug = "--debug" in self._frozen_config.myopts existing_node = self._dynamic_config._slot_pkg_map[root][slot_atom] + # In order to avoid a missed update, first mask lower versions + # that conflict with higher versions (the backtracker visits + # these in reverse order). + conflict_pkgs.sort(reverse=True) backtrack_data = [] - # The ordering of backtrack_data can make - # a difference here, because both mask actions may lead - # to valid, but different, solutions and the one with - # 'existing_node' masked is usually the better one. Because - # of that, we choose an order such that - # the backtracker will first explore the choice with - # existing_node masked. The backtracker reverses the - # order, so the order it uses is the reverse of the - # order shown here. See bug #339606. - if existing_node in conflict_pkgs and \ - existing_node is not conflict_pkgs[-1]: - conflict_pkgs.remove(existing_node) - conflict_pkgs.append(existing_node) for to_be_masked in conflict_pkgs: # For missed update messages, find out which # atoms matched to_be_selected that did not @@ -983,11 +973,6 @@ class depgraph(object): if parent_atom not in parent_atoms) backtrack_data.append((to_be_masked, conflict_atoms)) - if len(backtrack_data) > 1: - # In order to avoid a missed update, first mask lower - # versions that conflict with higher versions. - backtrack_data.sort(key=operator.itemgetter(0), reverse=True) - to_be_masked = backtrack_data[-1][0] self._dynamic_config._backtrack_infos.setdefault( -- 2.26.2