britney.py: Turn pkg_ids into namedtuples

Signed-off-by: Niels Thykier <niels@thykier.net>
debian
Niels Thykier 9 years ago
parent bee0a99528
commit 429e8f1199

@ -227,6 +227,12 @@ check_field_name = dict((globals()[fn], fn) for fn in
check_fields = sorted(check_field_name) check_fields = sorted(check_field_name)
BinaryPackageId = namedtuple('BinaryPackageId', [
'package_name',
'version',
'architecture',
])
BinaryPackage = namedtuple('BinaryPackage', [ BinaryPackage = namedtuple('BinaryPackage', [
'version', 'version',
'section', 'section',
@ -543,7 +549,7 @@ class Britney(object):
self.sources['unstable'][pkg_name] = src_data self.sources['unstable'][pkg_name] = src_data
for arch in archs: for arch in archs:
pkg_id = (pkg_name, version, arch) pkg_id = BinaryPackageId(pkg_name, version, arch)
if provides_raw: if provides_raw:
provides = self._parse_provides(pkg_id, provides_raw) provides = self._parse_provides(pkg_id, provides_raw)
else: else:
@ -636,7 +642,7 @@ class Britney(object):
elif ',' in a or '!' in a: elif ',' in a or '!' in a:
msg = "Invalid arch-restriction for %s: Uses comma or negation (for %s file %s)" msg = "Invalid arch-restriction for %s: Uses comma or negation (for %s file %s)"
raise ValueError(msg % (pkg, pkg_name, constraints_file)) raise ValueError(msg % (pkg, pkg_name, constraints_file))
pkg_id = (pkg_name, faux_version, arch) pkg_id = BinaryPackageId(pkg_name, faux_version, arch)
bin_data = BinaryPackage(faux_version, bin_data = BinaryPackage(faux_version,
faux_section, faux_section,
pkg_name, pkg_name,
@ -842,7 +848,7 @@ class Britney(object):
# largest version for migration. # largest version for migration.
pkg = intern(pkg) pkg = intern(pkg)
version = intern(version) version = intern(version)
pkg_id = (pkg, version, arch) pkg_id = BinaryPackageId(pkg, version, arch)
if pkg in packages: if pkg in packages:
old_pkg_data = packages[pkg] old_pkg_data = packages[pkg]

Loading…
Cancel
Save