From 1ab16725df69ff631839f05989844737ee488697 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 8 Oct 2015 08:26:59 +0200 Subject: [PATCH] Make linux* wait on corresponding -meta package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want to treat linux-$flavor and linux-meta-$flavor as one set in britney which goes in together or not at all. We never want to promote linux-$flavor without the accompanying linux-meta-$flavor. Introduce a synthetic linux* → linux-meta* dependency to enforce this grouping. --- britney.py | 21 +++++++++++++++++ tests/test_autopkgtest.py | 48 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/britney.py b/britney.py index 185c363..b8200b9 100755 --- a/britney.py +++ b/britney.py @@ -1152,6 +1152,27 @@ class Britney(object): parse_depends = apt_pkg.parse_depends get_dependency_solvers = self.get_dependency_solvers + # make linux* wait on corresponding -meta package + if src.startswith('linux'): + meta = src.replace('linux', 'linux-meta', 1) + if meta in self.sources[suite]: + # copy binary_u here, don't modify self.binaries! + if binary_u[DEPENDS]: + binary_u[DEPENDS] = binary_u[DEPENDS] + ', ' + else: + binary_u[DEPENDS] = '' + # find binary of our architecture + binpkg = None + for b in self.sources[suite][meta][BINARIES]: + pkg, a = b.split('/') + if a == arch: + binpkg = pkg + break + if binpkg: + binver = self.binaries[suite][arch][0][binpkg][SOURCEVER] + binary_u[DEPENDS] += '%s (>= %s)' % (binpkg, binver) + self.__log('Synthesizing dependency %s to %s: %s' % (meta, src, binary_u[DEPENDS])) + # analyze the dependency fields (if present) if not binary_u[DEPENDS]: return True diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index d653993..a71b6c2 100755 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -1448,6 +1448,54 @@ fancy 1 i386 linux-meta-lts-grumpy 1 'debci-series-amd64:lxc {"triggers": ["linux-meta/1"]}', 'debci-series-amd64:lxc {"triggers": ["linux-meta-64only/1"]}'])) + def test_kernel_waits_on_meta(self): + '''linux waits on linux-meta''' + + self.data.add('dkms', False, {}) + self.data.add('fancy-dkms', False, {'Source': 'fancy', 'Depends': 'dkms (>= 1)'}) + self.data.add('linux-image-generic', False, {'Version': '0.1', 'Source': 'linux-meta', 'Depends': 'linux-image-1'}) + self.data.add('linux-image-1', False, {'Source': 'linux'}, testsuite='autopkgtest') + self.data.add('linux-firmware', False, {'Source': 'linux-firmware'}, testsuite='autopkgtest') + + self.swift.set_results({'autopkgtest-series': { + 'series/i386/l/linux/20150101_100000@': (0, 'linux 2', {'custom_environment': ['ADT_TEST_TRIGGERS=linux/2']}), + 'series/amd64/l/linux/20150101_100000@': (0, 'linux 2', {'custom_environment': ['ADT_TEST_TRIGGERS=linux/2']}), + 'series/i386/l/linux-firmware/20150101_100000@': (0, 'linux-firmware 2', {'custom_environment': ['ADT_TEST_TRIGGERS=linux-firmware/2']}), + 'series/amd64/l/linux-firmware/20150101_100000@': (0, 'linux-firmware 2', {'custom_environment': ['ADT_TEST_TRIGGERS=linux-firmware/2']}), + }}) + + self.do_test( + [('linux-image-generic', {'Version': '0.2', 'Source': 'linux-meta', 'Depends': 'linux-image-2'}, None), + ('linux-image-2', {'Version': '2', 'Source': 'linux'}, 'autopkgtest'), + ('linux-firmware', {'Version': '2', 'Source': 'linux-firmware'}, 'autopkgtest'), + ], + {'linux-meta': (False, {'fancy 1': {'amd64': 'RUNNING', 'i386': 'RUNNING'}}), + # tests pass, but should wait on linux-meta + 'linux': (False, {'linux 2': {'amd64': 'PASS', 'i386': 'PASS'}}), + # this one does not have a -meta, so don't wait + 'linux-firmware': (True, {'linux-firmware 2': {'amd64': 'PASS', 'i386': 'PASS'}}), + }, + {'linux': [('reason', 'depends'), + ('excuses', 'Depends: linux linux-meta (not considered)')] + } + ) + + # now linux-meta is ready to go + self.swift.set_results({'autopkgtest-series': { + 'series/i386/f/fancy/20150101_100000@': (0, 'fancy 1', {'custom_environment': ['ADT_TEST_TRIGGERS=linux-meta/0.2']}), + 'series/amd64/f/fancy/20150101_100000@': (0, 'fancy 1', {'custom_environment': ['ADT_TEST_TRIGGERS=linux-meta/0.2']}), + }}) + self.do_test( + [], + {'linux-meta': (True, {'fancy 1': {'amd64': 'PASS', 'i386': 'PASS'}}), + 'linux': (True, {'linux 2': {'amd64': 'PASS', 'i386': 'PASS'}}), + 'linux-firmware': (True, {'linux-firmware 2': {'amd64': 'PASS', 'i386': 'PASS'}}), + }, + {'linux': [('excuses', 'Depends: linux linux-meta')] + } + ) + + ################################################################ # Tests for special-cased packages ################################################################