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' faux_section = 'faux'
if component != 'main': if component != 'main':
faux_section = "%s/faux" % component faux_section = "%s/faux" % component
src_data = SourcePackage(version, src_data = SourcePackage(pkg_name,
version,
sys.intern(faux_section), sys.intern(faux_section),
set(), set(),
None, None,
@ -627,7 +628,8 @@ class Britney(object):
pkg_list = [x.strip() for x in mandatory_field('Package-List').split("\n") pkg_list = [x.strip() for x in mandatory_field('Package-List').split("\n")
if x.strip() != '' and not x.strip().startswith("#")] if x.strip() != '' and not x.strip().startswith("#")]
src_data = SourcePackage(faux_version, src_data = SourcePackage(pkg_name,
faux_version,
faux_section, faux_section,
set(), set(),
None, None,

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

@ -314,7 +314,7 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
srcdist[source].binaries.add(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, 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

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

Loading…
Cancel
Save