From 98f9c4499ca0dc4899ffcb69d30e23d1d7ea9814 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 14 Sep 2009 05:31:08 +0000 Subject: [PATCH] Generate architecture-qualified package relations as needed for flavours that exist for multiple architectures (Closes: #278729) svn path=/dists/trunk/linux-2.6/; revision=14227 --- debian/bin/gencontrol.py | 60 ++++++++++++++++++++++++++++++++++++++-- debian/changelog | 2 ++ 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py index 739944eb8..0586af5e3 100755 --- a/debian/bin/gencontrol.py +++ b/debian/bin/gencontrol.py @@ -8,13 +8,67 @@ from debian_linux.debian import * from debian_linux.gencontrol import Gencontrol as Base from debian_linux.utils import Templates +def maxzip(*its): + '''Variant of zip() that continues until all iterators are exhausted, + padding with None as necessary.''' + its = [iter(it) for it in its] + while True: + value = [] + stop = True + for it in its: + try: + value.append(it.next()) + except StopIteration: + value.append(None) + else: + stop = False + if stop: + break + yield value + +def add_arch_relation(merged_arches, merged_rel, arch, rel): + # Add arch-qualification as necessary + for m_group, group in maxzip(merged_rel, rel): + for m_entry, entry in maxzip(m_group or [], group or []): + # Is either entry unqualified? + if m_entry and not m_entry.arches or entry and not entry.arches: + # Are they equal? + if (m_entry and not m_entry.arches and + entry and not entry.arches and + m_entry.name == entry.name and + str(m_entry.operator) == str(entry.operator) and + m_entry.version == entry.version): + # Merged entry remains applicable to all architectures + pass + else: + # Entries must be arch-qualified + if m_entry: + m_entry.arches = merged_arches[:] + if entry: + entry.arches = [arch] + # And now apply the standard merge + merged_rel.extend(rel) + def add_arch_package(packages, arch, package): + package['Architecture'] = [arch] name = package['Package'] if packages.has_key(name): - package = packages.get(name) - package['Architecture'].append(arch) + merged_package = packages.get(name) + assert str(package['Description']) == str(merged_package['Description']) + for field in 'Depends', 'Provides', 'Suggests', 'Recommends', 'Conflicts': + try: + merged_rel = merged_package[field] + except KeyError: + merged_rel = PackageRelation() + try: + rel = package[field] + except KeyError: + pass + else: + add_arch_relation(merged_package['Architecture'], merged_rel, + arch, rel) + merged_package['Architecture'].append(arch) else: - package['Architecture'] = [arch] packages.append(package) class Gencontrol(Base): diff --git a/debian/changelog b/debian/changelog index 28fea17a8..0292e435f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -85,6 +85,8 @@ linux-2.6 (2.6.31-1~experimental.1) UNRELEASED; urgency=low (Closes: #515982) * intel-agp: Fix cache flushing on i8xx chipsets, avoiding graphics corruption and GPU lock-ups (Closes: #541307) + * Generate architecture-qualified package relations as needed for + flavours that exist for multiple architectures (Closes: #278729) [ Martin Michlmayr ] * [armel/orion5x, armel/kirkwood] Set GPIO_SYSFS=y since these