Store the component in BinaryPackage and SourcePackage

ubuntu/dry-run
Iain Lane 5 years ago committed by Iain Lane
parent 4f9a33ddab
commit 3fa9eceb89

@ -240,10 +240,10 @@ class Suites(object):
class SourcePackage(object):
__slots__ = ['source', 'version', 'section', 'binaries', 'maintainer', 'is_fakesrc', 'build_deps_arch',
'build_deps_indep', 'testsuite', 'testsuite_triggers']
'build_deps_indep', 'testsuite', 'testsuite_triggers', 'component']
def __init__(self, source, version, section, binaries, maintainer, is_fakesrc, build_deps_arch,
build_deps_indep, testsuite, testsuite_triggers):
build_deps_indep, testsuite, testsuite_triggers, component):
self.source = source
self.version = version
self.section = section
@ -254,6 +254,7 @@ class SourcePackage(object):
self.build_deps_indep = build_deps_indep
self.testsuite = testsuite
self.testsuite_triggers = testsuite_triggers
self.component = component
def __getitem__(self, item):
return getattr(self, self.__slots__[item])
@ -313,4 +314,5 @@ BinaryPackage = namedtuple('BinaryPackage', [
'is_essential',
'pkg_id',
'builtusing',
'component'
])

@ -216,7 +216,7 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
filename = os.path.join(basedir, component, "source", "Sources")
filename = possibly_compressed(filename)
self.logger.info("Loading source packages from %s", filename)
read_sources_file(filename, sources)
read_sources_file(filename, sources, component=component)
else:
filename = os.path.join(basedir, "Sources")
self.logger.info("Loading source packages from %s", filename)
@ -297,7 +297,7 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
"""
return separator.join(filter(None, (get_field(x) for x in field_names))) or None
def _read_packages_file(self, filename, arch, srcdist, packages=None, intern=sys.intern):
def _read_packages_file(self, filename, arch, srcdist, packages=None, intern=sys.intern, component=None):
self.logger.info("Loading binary packages from %s", filename)
if packages is None:
@ -385,6 +385,7 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
ess,
pkg_id,
builtusing,
component,
)
# if the source package is available in the distribution, then register this binary package
@ -399,7 +400,17 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
srcdist[source].binaries.add(pkg_id)
# if the source package doesn't exist, create a fake one
else:
srcdist[source] = SourcePackage(source, source_version, 'faux', {pkg_id}, None, True, None, None, [], [])
srcdist[source] = SourcePackage(source,
source_version,
'faux',
{pkg_id},
None,
True,
None,
None,
[],
[],
component)
# add the resulting dictionary to the package list
packages[pkg] = dpkg
@ -469,11 +480,13 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
self._read_packages_file(filename,
arch,
suite.sources,
packages)
packages,
component=component)
self._read_packages_file(udeb_filename,
arch,
suite.sources,
packages)
packages,
component=component)
# create provides
provides = create_provides_map(packages)
binaries[arch] = packages

@ -527,7 +527,7 @@ def read_release_file(suite_dir):
return result
def read_sources_file(filename, sources=None, intern=sys.intern):
def read_sources_file(filename, sources=None, intern=sys.intern, component=None):
"""Parse a single Sources file into a hash
Parse a single Sources file into a dict mapping a source package
@ -585,6 +585,7 @@ def read_sources_file(filename, sources=None, intern=sys.intern):
build_deps_indep,
get_field('Testsuite', '').split(),
get_field('Testsuite-Triggers', '').replace(',', '').split(),
component,
)
return sources

@ -79,7 +79,7 @@ def create_excuse(name, pkgs):
def create_source_package(name, version, section='devel', binaries=None):
if binaries is None:
binaries = set()
return SourcePackage(name, version, section, binaries, 'Random tester', False, None, None, ['autopkgtest'], [])
return SourcePackage(name, version, section, binaries, 'Random tester', False, None, None, ['autopkgtest'], [], 'fake-component')
def create_bin_package(pkg_id, source_name=None, depends=None, conflicts=None):
@ -101,6 +101,7 @@ def create_bin_package(pkg_id, source_name=None, depends=None, conflicts=None):
False,
pkg_id,
[],
'fake-component'
)

Loading…
Cancel
Save