mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-29 03:11:33 +00:00
Make SourcePackage.binaries a set
The recent code changes made use remove from the "binaries" field in SourcePackages. Lists are not particularly optimized for this kind of removal and we have a few source packages with a lot of binary packages (e.g. libreoffice, gcc-X-cross{,-ports}) that might trip poor performance. Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
37a173af67
commit
f928c7ed3d
@ -534,7 +534,7 @@ class Britney(object):
|
|||||||
faux_section = "%s/faux" % component
|
faux_section = "%s/faux" % component
|
||||||
src_data = SourcePackage(version,
|
src_data = SourcePackage(version,
|
||||||
sys.intern(faux_section),
|
sys.intern(faux_section),
|
||||||
[],
|
set(),
|
||||||
None,
|
None,
|
||||||
True,
|
True,
|
||||||
None,
|
None,
|
||||||
@ -565,7 +565,7 @@ class Britney(object):
|
|||||||
pkg_id,
|
pkg_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
src_data.binaries.append(pkg_id)
|
src_data.binaries.add(pkg_id)
|
||||||
target_suite.binaries[arch][pkg_name] = bin_data
|
target_suite.binaries[arch][pkg_name] = bin_data
|
||||||
pri_source_suite.binaries[arch][pkg_name] = bin_data
|
pri_source_suite.binaries[arch][pkg_name] = bin_data
|
||||||
self.all_binaries[pkg_id] = bin_data
|
self.all_binaries[pkg_id] = bin_data
|
||||||
@ -614,7 +614,7 @@ class Britney(object):
|
|||||||
pkg_list = [x.strip() for x in mandatory_field('Package-List').split("\n") if x.strip() != '' and not x.strip().startswith("#")]
|
pkg_list = [x.strip() for x in mandatory_field('Package-List').split("\n") if x.strip() != '' and not x.strip().startswith("#")]
|
||||||
src_data = SourcePackage(faux_version,
|
src_data = SourcePackage(faux_version,
|
||||||
faux_section,
|
faux_section,
|
||||||
[],
|
set(),
|
||||||
None,
|
None,
|
||||||
True,
|
True,
|
||||||
None,
|
None,
|
||||||
@ -659,7 +659,7 @@ class Britney(object):
|
|||||||
False,
|
False,
|
||||||
pkg_id,
|
pkg_id,
|
||||||
)
|
)
|
||||||
src_data.binaries.append(pkg_id)
|
src_data.binaries.add(pkg_id)
|
||||||
target_suite.binaries[arch][pkg_name] = bin_data
|
target_suite.binaries[arch][pkg_name] = bin_data
|
||||||
pri_source_suite.binaries[arch][pkg_name] = bin_data
|
pri_source_suite.binaries[arch][pkg_name] = bin_data
|
||||||
self.all_binaries[pkg_id] = bin_data
|
self.all_binaries[pkg_id] = bin_data
|
||||||
|
@ -226,7 +226,7 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
|
|||||||
# stop-gap relies on the packages files being sorted by name
|
# stop-gap relies on the packages files being sorted by name
|
||||||
# and the version, so it is not particularly resilient.
|
# and the version, so it is not particularly resilient.
|
||||||
if pkg_id not in old_src_binaries:
|
if pkg_id not in old_src_binaries:
|
||||||
old_src_binaries.append(pkg_id)
|
old_src_binaries.add(pkg_id)
|
||||||
|
|
||||||
# Merge Pre-Depends with Depends and Conflicts with
|
# Merge Pre-Depends with Depends and Conflicts with
|
||||||
# Breaks. Britney is not interested in the "finer
|
# Breaks. Britney is not interested in the "finer
|
||||||
@ -280,10 +280,10 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
|
|||||||
# of the versions we include as only the package name and
|
# of the versions we include as only the package name and
|
||||||
# architecture are recorded.
|
# architecture are recorded.
|
||||||
if pkg_id not in srcdist[source].binaries:
|
if pkg_id not in srcdist[source].binaries:
|
||||||
srcdist[source].binaries.append(pkg_id)
|
srcdist[source].binaries.add(pkg_id)
|
||||||
# if the source package doesn't exist, create a fake one
|
# if the source package doesn't exist, create a fake one
|
||||||
else:
|
else:
|
||||||
srcdist[source] = SourcePackage(source_version, 'faux', [pkg_id], None, True, None, None, [], [])
|
srcdist[source] = SourcePackage(source_version, 'faux', {pkg_id}, None, True, None, None, [], [])
|
||||||
|
|
||||||
# add the resulting dictionary to the package list
|
# add the resulting dictionary to the package list
|
||||||
packages[pkg] = dpkg
|
packages[pkg] = dpkg
|
||||||
|
@ -259,7 +259,7 @@ class MigrationManager(object):
|
|||||||
# always create a new list of binaries
|
# always create a new list of binaries
|
||||||
sources_t[source_name].binaries = copy.copy(old_source.binaries)
|
sources_t[source_name].binaries = copy.copy(old_source.binaries)
|
||||||
else:
|
else:
|
||||||
sources_t[source_name].binaries = list()
|
sources_t[source_name].binaries = set()
|
||||||
|
|
||||||
undo['sources'][source_name] = old_source
|
undo['sources'][source_name] = old_source
|
||||||
|
|
||||||
@ -291,8 +291,7 @@ class MigrationManager(object):
|
|||||||
del provides_t_a[provided_pkg]
|
del provides_t_a[provided_pkg]
|
||||||
# for source removal, the source is already gone
|
# for source removal, the source is already gone
|
||||||
if source_name in sources_t:
|
if source_name in sources_t:
|
||||||
if rm_pkg_id in sources_t[source_name].binaries:
|
sources_t[source_name].binaries.discard(rm_pkg_id)
|
||||||
sources_t[source_name].binaries.remove(rm_pkg_id)
|
|
||||||
# finally, remove the binary package
|
# finally, remove the binary package
|
||||||
del binaries_t_a[binary]
|
del binaries_t_a[binary]
|
||||||
target_suite.remove_binary(rm_pkg_id)
|
target_suite.remove_binary(rm_pkg_id)
|
||||||
@ -346,8 +345,7 @@ class MigrationManager(object):
|
|||||||
target_suite.add_binary(updated_pkg_id)
|
target_suite.add_binary(updated_pkg_id)
|
||||||
updated_binaries.add(updated_pkg_id)
|
updated_binaries.add(updated_pkg_id)
|
||||||
# add the binary to the source package
|
# add the binary to the source package
|
||||||
if updated_pkg_id not in sources_t[source_name].binaries:
|
sources_t[source_name].binaries.add(updated_pkg_id)
|
||||||
sources_t[source_name].binaries.append(updated_pkg_id)
|
|
||||||
# register new provided packages
|
# register new provided packages
|
||||||
for provided_pkg, prov_version, _ in new_pkg_data.provides:
|
for provided_pkg, prov_version, _ in new_pkg_data.provides:
|
||||||
key = (provided_pkg, parch)
|
key = (provided_pkg, parch)
|
||||||
|
@ -22,6 +22,7 @@ import os
|
|||||||
import json
|
import json
|
||||||
import tarfile
|
import tarfile
|
||||||
import io
|
import io
|
||||||
|
import itertools
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
@ -577,7 +578,7 @@ class AutopkgtestPolicy(BasePolicy):
|
|||||||
pkg_universe = self.britney.pkg_universe
|
pkg_universe = self.britney.pkg_universe
|
||||||
# plus all direct reverse dependencies and test triggers of its
|
# plus all direct reverse dependencies and test triggers of its
|
||||||
# binaries which have an autopkgtest
|
# binaries which have an autopkgtest
|
||||||
for binary in srcinfo.binaries + extra_bins:
|
for binary in itertools.chain(srcinfo.binaries, extra_bins):
|
||||||
rdeps = pkg_universe.reverse_dependencies_of(binary)
|
rdeps = pkg_universe.reverse_dependencies_of(binary)
|
||||||
for rdep in rdeps:
|
for rdep in rdeps:
|
||||||
try:
|
try:
|
||||||
|
@ -617,7 +617,7 @@ def read_sources_file(filename, sources=None, intern=sys.intern):
|
|||||||
build_deps_indep = sys.intern(build_deps_indep)
|
build_deps_indep = sys.intern(build_deps_indep)
|
||||||
sources[intern(pkg)] = SourcePackage(intern(ver),
|
sources[intern(pkg)] = SourcePackage(intern(ver),
|
||||||
section,
|
section,
|
||||||
[],
|
set(),
|
||||||
maint,
|
maint,
|
||||||
False,
|
False,
|
||||||
build_deps_arch,
|
build_deps_arch,
|
||||||
|
@ -60,7 +60,7 @@ def create_excuse(name):
|
|||||||
|
|
||||||
def create_source_package(version, section='devel', binaries=None):
|
def create_source_package(version, section='devel', binaries=None):
|
||||||
if binaries is None:
|
if binaries is None:
|
||||||
binaries = []
|
binaries = set()
|
||||||
return SourcePackage(version, section, binaries, 'Random tester', False, None, None, ['autopkgtest'], [])
|
return SourcePackage(version, section, binaries, 'Random tester', False, None, None, ['autopkgtest'], [])
|
||||||
|
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ def build_sources_from_universe_and_inst_tester(policy, pkg_universe, inst_teste
|
|||||||
binaries_s = {}
|
binaries_s = {}
|
||||||
for pkg_id in pkg_universe:
|
for pkg_id in pkg_universe:
|
||||||
pkg_name = pkg_id.package_name
|
pkg_name = pkg_id.package_name
|
||||||
src_universe[pkg_id] = create_source_package(pkg_id.version, binaries=[pkg_id])
|
src_universe[pkg_id] = create_source_package(pkg_id.version, binaries={pkg_id})
|
||||||
bin_universe[pkg_id] = create_bin_package(pkg_id)
|
bin_universe[pkg_id] = create_bin_package(pkg_id)
|
||||||
if inst_tester.is_pkg_in_the_suite(pkg_id):
|
if inst_tester.is_pkg_in_the_suite(pkg_id):
|
||||||
if pkg_name in suite_info.target_suite.sources:
|
if pkg_name in suite_info.target_suite.sources:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user