From dac3bb3044807db013b76ce272d8606dcfbf0511 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 24 Oct 2016 11:28:27 +0200 Subject: [PATCH] Store Testsuite-Triggers: list in sources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compute an inverse trigger → sources map, as that's usually the direction that britney is interested in. --- britney.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/britney.py b/britney.py index b248050..e5d4160 100755 --- a/britney.py +++ b/britney.py @@ -236,16 +236,17 @@ check_fields = sorted(check_field_name) class SourcePackage(object): __slots__ = ['version', 'section', 'binaries', 'maintainer', 'is_fakesrc', - 'testsuite'] + 'testsuite', 'testsuite_triggers'] def __init__(self, version, section, binaries, maintainer, is_fakesrc, - testsuite): + testsuite, testsuite_triggers): self.version = version self.section = section self.binaries = binaries self.maintainer = maintainer self.is_fakesrc = is_fakesrc self.testsuite = testsuite + self.testsuite_triggers = testsuite_triggers def __getitem__(self, item): return getattr(self, self.__slots__[item]) @@ -336,6 +337,14 @@ class Britney(object): self.binaries['tpu'] = {} self.binaries['pu'] = {} + # compute inverse Testsuite-Triggers: map, unifying all series + self.log('Building inverse testsuite_triggers map') + self.testsuite_triggers = {} + for suitemap in self.sources.values(): + for src, data in suitemap.items(): + for trigger in data.testsuite_triggers: + self.testsuite_triggers.setdefault(trigger, set()).add(src) + self.binaries['unstable'] = self.read_binaries(self.options.unstable, "unstable", self.options.architectures) for suite in ('tpu', 'pu'): if hasattr(self.options, suite): @@ -587,6 +596,7 @@ class Britney(object): None, True, [], + [], ) self.sources['testing'][pkg_name] = src_data @@ -662,6 +672,7 @@ class Britney(object): None, True, [], + [], ) self.sources['testing'][pkg_name] = src_data self.sources['unstable'][pkg_name] = src_data @@ -844,6 +855,7 @@ class Britney(object): maint, False, get_field('Testsuite', '').split(), + get_field('Testsuite-Triggers', '').replace(',', '').split(), ) return sources @@ -993,7 +1005,7 @@ class Britney(object): srcdist[source].binaries.append(pkg_id) # if the source package doesn't exist, create a fake one else: - srcdist[source] = SourcePackage(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 packages[pkg] = dpkg