|
|
|
@ -141,59 +141,10 @@ class InstallabilitySolver(object):
|
|
|
|
|
logger_name = ".".join((self.__class__.__module__, self.__class__.__name__))
|
|
|
|
|
self.logger = logging.getLogger(logger_name)
|
|
|
|
|
|
|
|
|
|
def _compute_group_order(self, groups, key2item):
|
|
|
|
|
def _compute_group_order_rms(self, rms, order, key, ptable, going_out):
|
|
|
|
|
sat_in_testing = self._inst_tester.any_of_these_are_in_the_suite
|
|
|
|
|
universe = self._universe
|
|
|
|
|
ptable = {}
|
|
|
|
|
order = {}
|
|
|
|
|
going_out = set()
|
|
|
|
|
going_in = set()
|
|
|
|
|
debug_solver = self.logger.isEnabledFor(logging.DEBUG)
|
|
|
|
|
|
|
|
|
|
# Build the tables
|
|
|
|
|
for (item, adds, rms) in groups:
|
|
|
|
|
key = str(item)
|
|
|
|
|
key2item[key] = item
|
|
|
|
|
order[key] = {'before': set(), 'after': set()}
|
|
|
|
|
going_in.update(adds)
|
|
|
|
|
going_out.update(rms)
|
|
|
|
|
for a in adds:
|
|
|
|
|
ptable[a] = key
|
|
|
|
|
for r in rms:
|
|
|
|
|
ptable[r] = key
|
|
|
|
|
|
|
|
|
|
if debug_solver: # pragma: no cover
|
|
|
|
|
self._dump_groups(groups)
|
|
|
|
|
|
|
|
|
|
# This large loop will add ordering constrains on each "item"
|
|
|
|
|
# that migrates based on various rules.
|
|
|
|
|
for (item, adds, rms) in groups:
|
|
|
|
|
key = str(item)
|
|
|
|
|
oldcons = set()
|
|
|
|
|
newcons = set()
|
|
|
|
|
for r in rms:
|
|
|
|
|
oldcons.update(universe.negative_dependencies_of(r))
|
|
|
|
|
for a in adds:
|
|
|
|
|
newcons.update(universe.negative_dependencies_of(a))
|
|
|
|
|
current = newcons & oldcons
|
|
|
|
|
oldcons -= current
|
|
|
|
|
newcons -= current
|
|
|
|
|
if oldcons:
|
|
|
|
|
# Some of the old binaries have "conflicts" that will
|
|
|
|
|
# be removed.
|
|
|
|
|
for o in ifilter_only(ptable, oldcons):
|
|
|
|
|
# "key" removes a conflict with one of
|
|
|
|
|
# "other"'s binaries, so it is probably a good
|
|
|
|
|
# idea to migrate "key" before "other"
|
|
|
|
|
other = ptable[o]
|
|
|
|
|
if other == key:
|
|
|
|
|
# "Self-conflicts" => ignore
|
|
|
|
|
continue
|
|
|
|
|
if debug_solver and other not in order[key]['before']: # pragma: no cover
|
|
|
|
|
self.logger.debug("Conflict induced order: %s before %s", key, other)
|
|
|
|
|
order[key]['before'].add(other)
|
|
|
|
|
order[other]['after'].add(key)
|
|
|
|
|
|
|
|
|
|
for r in rms:
|
|
|
|
|
# The binaries have reverse dependencies in testing;
|
|
|
|
|
# check if we can/should migrate them first.
|
|
|
|
@ -213,6 +164,10 @@ class InstallabilitySolver(object):
|
|
|
|
|
order[key]['after'].add(other)
|
|
|
|
|
order[other]['before'].add(key)
|
|
|
|
|
|
|
|
|
|
def _compute_group_order_adds(self, adds, order, key, ptable, going_out, going_in):
|
|
|
|
|
sat_in_testing = self._inst_tester.any_of_these_are_in_the_suite
|
|
|
|
|
universe = self._universe
|
|
|
|
|
debug_solver = self.logger.isEnabledFor(logging.DEBUG)
|
|
|
|
|
for a in adds:
|
|
|
|
|
# Check if this item should migrate before others
|
|
|
|
|
# (e.g. because they depend on a new [version of a]
|
|
|
|
@ -255,6 +210,61 @@ class InstallabilitySolver(object):
|
|
|
|
|
order[key]['before'].add(other)
|
|
|
|
|
order[other]['after'].add(key)
|
|
|
|
|
|
|
|
|
|
def _compute_group_order(self, groups, key2item):
|
|
|
|
|
universe = self._universe
|
|
|
|
|
ptable = {}
|
|
|
|
|
order = {}
|
|
|
|
|
going_out = set()
|
|
|
|
|
going_in = set()
|
|
|
|
|
debug_solver = self.logger.isEnabledFor(logging.DEBUG)
|
|
|
|
|
|
|
|
|
|
# Build the tables
|
|
|
|
|
for (item, adds, rms) in groups:
|
|
|
|
|
key = str(item)
|
|
|
|
|
key2item[key] = item
|
|
|
|
|
order[key] = {'before': set(), 'after': set()}
|
|
|
|
|
going_in.update(adds)
|
|
|
|
|
going_out.update(rms)
|
|
|
|
|
for a in adds:
|
|
|
|
|
ptable[a] = key
|
|
|
|
|
for r in rms:
|
|
|
|
|
ptable[r] = key
|
|
|
|
|
|
|
|
|
|
if debug_solver: # pragma: no cover
|
|
|
|
|
self._dump_groups(groups)
|
|
|
|
|
|
|
|
|
|
# This large loop will add ordering constrains on each "item"
|
|
|
|
|
# that migrates based on various rules.
|
|
|
|
|
for (item, adds, rms) in groups:
|
|
|
|
|
key = str(item)
|
|
|
|
|
oldcons = set()
|
|
|
|
|
newcons = set()
|
|
|
|
|
for r in rms:
|
|
|
|
|
oldcons.update(universe.negative_dependencies_of(r))
|
|
|
|
|
for a in adds:
|
|
|
|
|
newcons.update(universe.negative_dependencies_of(a))
|
|
|
|
|
current = newcons & oldcons
|
|
|
|
|
oldcons -= current
|
|
|
|
|
newcons -= current
|
|
|
|
|
if oldcons:
|
|
|
|
|
# Some of the old binaries have "conflicts" that will
|
|
|
|
|
# be removed.
|
|
|
|
|
for o in ifilter_only(ptable, oldcons):
|
|
|
|
|
# "key" removes a conflict with one of
|
|
|
|
|
# "other"'s binaries, so it is probably a good
|
|
|
|
|
# idea to migrate "key" before "other"
|
|
|
|
|
other = ptable[o]
|
|
|
|
|
if other == key:
|
|
|
|
|
# "Self-conflicts" => ignore
|
|
|
|
|
continue
|
|
|
|
|
if debug_solver and other not in order[key]['before']: # pragma: no cover
|
|
|
|
|
self.logger.debug("Conflict induced order: %s before %s", key, other)
|
|
|
|
|
order[key]['before'].add(other)
|
|
|
|
|
order[other]['after'].add(key)
|
|
|
|
|
|
|
|
|
|
self._compute_group_order_rms(rms, order, key, ptable, going_out)
|
|
|
|
|
self._compute_group_order_adds(adds, order, key, ptable, going_out, going_in)
|
|
|
|
|
|
|
|
|
|
return order
|
|
|
|
|
|
|
|
|
|
def _merge_items_into_components(self, comps, order):
|
|
|
|
|