|
|
|
@ -90,75 +90,34 @@ class MigrationManager(object):
|
|
|
|
|
"""
|
|
|
|
|
# local copies for better performances
|
|
|
|
|
source_name = item.package
|
|
|
|
|
source_suite = item.suite
|
|
|
|
|
target_suite = self.suite_info.target_suite
|
|
|
|
|
binaries_s = source_suite.binaries
|
|
|
|
|
binaries_t = target_suite.binaries
|
|
|
|
|
pkg_universe = self.pkg_universe
|
|
|
|
|
|
|
|
|
|
adds = set()
|
|
|
|
|
rms = set()
|
|
|
|
|
smoothbins = set()
|
|
|
|
|
|
|
|
|
|
# remove all binary packages (if the source already exists)
|
|
|
|
|
if item.architecture == 'source' or not item.is_removal:
|
|
|
|
|
sources_t = target_suite.sources
|
|
|
|
|
if source_name in sources_t:
|
|
|
|
|
source_data = sources_t[source_name]
|
|
|
|
|
|
|
|
|
|
bins = []
|
|
|
|
|
# remove all the binaries
|
|
|
|
|
|
|
|
|
|
# first, build a list of eligible binaries
|
|
|
|
|
for pkg_id in source_data.binaries:
|
|
|
|
|
binary, _, parch = pkg_id
|
|
|
|
|
if item.architecture != 'source' and parch != item.architecture:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# Work around #815995
|
|
|
|
|
if item.architecture == 'source' and item.is_removal and binary not in binaries_t[parch]:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# Do not include hijacked binaries
|
|
|
|
|
if binaries_t[parch][binary].source != source_name:
|
|
|
|
|
continue
|
|
|
|
|
bins.append(pkg_id)
|
|
|
|
|
|
|
|
|
|
if allow_smooth_updates and source_suite.suite_class.is_primary_source:
|
|
|
|
|
smoothbins = find_smooth_updateable_binaries(bins,
|
|
|
|
|
source_suite.sources[source_name],
|
|
|
|
|
pkg_universe,
|
|
|
|
|
target_suite,
|
|
|
|
|
binaries_t,
|
|
|
|
|
binaries_s,
|
|
|
|
|
removals,
|
|
|
|
|
self.options.smooth_updates)
|
|
|
|
|
|
|
|
|
|
# remove all the binaries which aren't being smooth updated
|
|
|
|
|
if item.architecture != 'source' and source_suite.suite_class.is_additional_source:
|
|
|
|
|
# Special-case for pu/tpu:
|
|
|
|
|
# if this is a binary migration from *pu, only the arch:any
|
|
|
|
|
# packages will be present. ideally dak would also populate
|
|
|
|
|
# the arch-indep packages, but as that's not the case we
|
|
|
|
|
# must keep them around; they will not be re-added by the
|
|
|
|
|
# migration so will end up missing from testing
|
|
|
|
|
all_binaries = self.all_binaries
|
|
|
|
|
rms = {pkg_id for pkg_id in bins
|
|
|
|
|
if pkg_id not in smoothbins and all_binaries[pkg_id].architecture != 'all'}
|
|
|
|
|
else:
|
|
|
|
|
rms = {pkg_id for pkg_id in bins if pkg_id not in smoothbins}
|
|
|
|
|
if source_name in target_suite.sources:
|
|
|
|
|
rms, smoothbins = self._compute_removals(item, allow_smooth_updates, removals)
|
|
|
|
|
else:
|
|
|
|
|
rms = set()
|
|
|
|
|
smoothbins = set()
|
|
|
|
|
|
|
|
|
|
# single binary removal; used for clearing up after smooth
|
|
|
|
|
# updates but not supported as a manual hint
|
|
|
|
|
else:
|
|
|
|
|
assert source_name in binaries_t[item.architecture]
|
|
|
|
|
pkg_id = binaries_t[item.architecture][source_name].pkg_id
|
|
|
|
|
rms.add(pkg_id)
|
|
|
|
|
rms = {pkg_id}
|
|
|
|
|
smoothbins = set()
|
|
|
|
|
|
|
|
|
|
# add the new binary packages (if we are not removing)
|
|
|
|
|
if not item.is_removal:
|
|
|
|
|
source_suite = item.suite
|
|
|
|
|
binaries_s = source_suite.binaries
|
|
|
|
|
source_data = source_suite.sources[source_name]
|
|
|
|
|
source_ver_new = source_data.version
|
|
|
|
|
sources_t = target_suite.sources
|
|
|
|
|
if source_name in sources_t:
|
|
|
|
|
source_data_old = sources_t[source_name]
|
|
|
|
|
source_ver_old = source_data_old.version
|
|
|
|
@ -198,6 +157,61 @@ class MigrationManager(object):
|
|
|
|
|
|
|
|
|
|
return (adds, rms, smoothbins)
|
|
|
|
|
|
|
|
|
|
def _compute_removals(self, item, allow_smooth_updates, removals):
|
|
|
|
|
pkg_universe = self.pkg_universe
|
|
|
|
|
source_suite = item.suite
|
|
|
|
|
target_suite = self.suite_info.target_suite
|
|
|
|
|
binaries_s = source_suite.binaries
|
|
|
|
|
binaries_t = target_suite.binaries
|
|
|
|
|
source_name = item.package
|
|
|
|
|
source_data = target_suite.sources[source_name]
|
|
|
|
|
|
|
|
|
|
bins = []
|
|
|
|
|
# remove all the binaries
|
|
|
|
|
|
|
|
|
|
# first, build a list of eligible binaries
|
|
|
|
|
for pkg_id in source_data.binaries:
|
|
|
|
|
binary, _, parch = pkg_id
|
|
|
|
|
if item.architecture != 'source' and parch != item.architecture:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# Work around #815995
|
|
|
|
|
if item.architecture == 'source' and item.is_removal and binary not in binaries_t[parch]:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# Do not include hijacked binaries
|
|
|
|
|
if binaries_t[parch][binary].source != source_name:
|
|
|
|
|
continue
|
|
|
|
|
bins.append(pkg_id)
|
|
|
|
|
|
|
|
|
|
if allow_smooth_updates and source_suite.suite_class.is_primary_source:
|
|
|
|
|
smoothbins = find_smooth_updateable_binaries(bins,
|
|
|
|
|
source_suite.sources[source_name],
|
|
|
|
|
pkg_universe,
|
|
|
|
|
target_suite,
|
|
|
|
|
binaries_t,
|
|
|
|
|
binaries_s,
|
|
|
|
|
removals,
|
|
|
|
|
self.options.smooth_updates)
|
|
|
|
|
else:
|
|
|
|
|
smoothbins = set()
|
|
|
|
|
|
|
|
|
|
# remove all the binaries which aren't being smooth updated
|
|
|
|
|
if item.architecture != 'source' and source_suite.suite_class.is_additional_source:
|
|
|
|
|
# Special-case for pu/tpu:
|
|
|
|
|
# if this is a binary migration from *pu, only the arch:any
|
|
|
|
|
# packages will be present. ideally dak would also populate
|
|
|
|
|
# the arch-indep packages, but as that's not the case we
|
|
|
|
|
# must keep them around; they will not be re-added by the
|
|
|
|
|
# migration so will end up missing from testing
|
|
|
|
|
all_binaries = self.all_binaries
|
|
|
|
|
rms = {pkg_id for pkg_id in bins
|
|
|
|
|
if pkg_id not in smoothbins and all_binaries[pkg_id].architecture != 'all'}
|
|
|
|
|
else:
|
|
|
|
|
rms = {pkg_id for pkg_id in bins if pkg_id not in smoothbins}
|
|
|
|
|
|
|
|
|
|
return rms, smoothbins
|
|
|
|
|
|
|
|
|
|
def _apply_item_to_target_suite(self, item, removals=frozenset()):
|
|
|
|
|
"""Apply a change to the target suite as requested by `item`
|
|
|
|
|
|
|
|
|
|