mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-28 19:01:35 +00:00
Create a SourcePackage class
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
204359e3bc
commit
5a19b4f74d
29
britney.py
29
britney.py
@ -229,6 +229,21 @@ check_field_name = dict((globals()[fn], fn) for fn in
|
|||||||
|
|
||||||
check_fields = sorted(check_field_name)
|
check_fields = sorted(check_field_name)
|
||||||
|
|
||||||
|
|
||||||
|
class SourcePackage(object):
|
||||||
|
|
||||||
|
__slots__ = ['version', 'section', 'binaries', 'maintainer', 'is_fakesrc']
|
||||||
|
|
||||||
|
def __init__(self, version, section, binaries, maintainer, is_fakesrc):
|
||||||
|
self.version = version
|
||||||
|
self.section = section
|
||||||
|
self.binaries = binaries
|
||||||
|
self.maintainer = maintainer
|
||||||
|
self.is_fakesrc = is_fakesrc
|
||||||
|
|
||||||
|
def __getitem__(self, item):
|
||||||
|
return getattr(self, self.__slots__[item])
|
||||||
|
|
||||||
BinaryPackageId = namedtuple('BinaryPackageId', [
|
BinaryPackageId = namedtuple('BinaryPackageId', [
|
||||||
'package_name',
|
'package_name',
|
||||||
'version',
|
'version',
|
||||||
@ -549,12 +564,12 @@ 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 = [version,
|
src_data = SourcePackage(version,
|
||||||
sys.intern(faux_section),
|
sys.intern(faux_section),
|
||||||
[],
|
[],
|
||||||
None,
|
None,
|
||||||
True,
|
True,
|
||||||
]
|
)
|
||||||
|
|
||||||
self.sources['testing'][pkg_name] = src_data
|
self.sources['testing'][pkg_name] = src_data
|
||||||
self.sources['unstable'][pkg_name] = src_data
|
self.sources['unstable'][pkg_name] = src_data
|
||||||
@ -623,12 +638,12 @@ class Britney(object):
|
|||||||
self.log(" - constraint %s" % pkg_name, type='I')
|
self.log(" - constraint %s" % pkg_name, type='I')
|
||||||
|
|
||||||
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 = [faux_version,
|
src_data = SourcePackage(faux_version,
|
||||||
faux_section,
|
faux_section,
|
||||||
[],
|
[],
|
||||||
None,
|
None,
|
||||||
True,
|
True,
|
||||||
]
|
)
|
||||||
self.sources['testing'][pkg_name] = src_data
|
self.sources['testing'][pkg_name] = src_data
|
||||||
self.sources['unstable'][pkg_name] = src_data
|
self.sources['unstable'][pkg_name] = src_data
|
||||||
keep_installable.append(pkg_name)
|
keep_installable.append(pkg_name)
|
||||||
@ -785,12 +800,12 @@ class Britney(object):
|
|||||||
# 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][0], ver) > 0:
|
||||||
continue
|
continue
|
||||||
sources[intern(pkg)] = [intern(ver),
|
sources[intern(pkg)] = SourcePackage(intern(ver),
|
||||||
intern(get_field('Section')),
|
intern(get_field('Section')),
|
||||||
[],
|
[],
|
||||||
get_field('Maintainer'),
|
get_field('Maintainer'),
|
||||||
False,
|
False,
|
||||||
]
|
)
|
||||||
return sources
|
return sources
|
||||||
|
|
||||||
def read_sources(self, basedir):
|
def read_sources(self, basedir):
|
||||||
@ -939,7 +954,7 @@ class Britney(object):
|
|||||||
srcdist[source][BINARIES].append(pkg_id)
|
srcdist[source][BINARIES].append(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] = [source_version, 'faux', [pkg_id], None, True]
|
srcdist[source] = SourcePackage(source_version, 'faux', [pkg_id], None, True)
|
||||||
|
|
||||||
# add the resulting dictionary to the package list
|
# add the resulting dictionary to the package list
|
||||||
packages[pkg] = dpkg
|
packages[pkg] = dpkg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user