Add source to SourcePackage object

Adding a source parameter to the SourcePackage allow finding the source
the object is referring to, so that parameter doesn't have to be passed
along separately.

Signed-off-by: Ivo De Decker <ivodd@debian.org>
ubuntu/rebased
Ivo De Decker 5 years ago
parent 6ca84132f9
commit 3c8b7ba11d

@ -540,7 +540,8 @@ class Britney(object):
faux_section = 'faux'
if component != 'main':
faux_section = "%s/faux" % component
src_data = SourcePackage(version,
src_data = SourcePackage(pkg_name,
version,
sys.intern(faux_section),
set(),
None,
@ -627,7 +628,8 @@ class Britney(object):
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(pkg_name,
faux_version,
faux_section,
set(),
None,

@ -230,11 +230,12 @@ class Suites(object):
class SourcePackage(object):
__slots__ = ['version', 'section', 'binaries', 'maintainer', 'is_fakesrc', 'build_deps_arch', 'build_deps_indep',
'testsuite', 'testsuite_triggers']
__slots__ = ['source', 'version', 'section', 'binaries', 'maintainer', 'is_fakesrc', 'build_deps_arch',
'build_deps_indep', 'testsuite', 'testsuite_triggers']
def __init__(self, version, section, binaries, maintainer, is_fakesrc, build_deps_arch, build_deps_indep,
testsuite, testsuite_triggers):
def __init__(self, source, version, section, binaries, maintainer, is_fakesrc, build_deps_arch,
build_deps_indep, testsuite, testsuite_triggers):
self.source = source
self.version = version
self.section = section
self.binaries = binaries

@ -314,7 +314,7 @@ 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_version, 'faux', {pkg_id}, None, True, None, None, [], [])
srcdist[source] = SourcePackage(source, source_version, 'faux', {pkg_id}, None, True, None, None, [], [])
# add the resulting dictionary to the package list
packages[pkg] = dpkg

@ -554,7 +554,7 @@ def read_sources_file(filename, sources=None, intern=sys.intern):
# (in unstable) if some architectures have out-of-date
# binaries. We only ever consider the source with the
# largest version for migration.
if pkg in sources and apt_pkg.version_compare(sources[pkg][0], ver) > 0:
if pkg in sources and apt_pkg.version_compare(sources[pkg].version, ver) > 0:
continue
maint = get_field('Maintainer')
if maint:
@ -571,7 +571,8 @@ def read_sources_file(filename, sources=None, intern=sys.intern):
build_deps_indep = get_field('Build-Depends-Indep')
if build_deps_indep is not None:
build_deps_indep = sys.intern(build_deps_indep)
sources[intern(pkg)] = SourcePackage(intern(ver),
sources[intern(pkg)] = SourcePackage(intern(pkg),
intern(ver),
section,
set(),
maint,

Loading…
Cancel
Save