diff --git a/britney2/policies/policy.py b/britney2/policies/policy.py index b6c19b6..932fbe2 100644 --- a/britney2/policies/policy.py +++ b/britney2/policies/policy.py @@ -959,7 +959,7 @@ class BuildDependsPolicy(BasePolicy): # analyze the dependency fields (if present) deps = source_data_srcdist.build_deps_arch - if deps: + if deps or item.package.startswith('linux'): v = self._check_build_deps(deps, DependencyType.BUILD_DEPENDS, build_deps_info, item, source_data_tdist, source_data_srcdist, excuse, get_dependency_solvers=get_dependency_solvers) @@ -1056,6 +1056,34 @@ class BuildDependsPolicy(BasePolicy): binaries_t_a = binaries_t[arch] provides_t_a = provides_t[arch] arch_results[arch] = BuildDepResult.OK + + # make linux* wait on corresponding -meta package + if source_name.startswith('linux'): + meta = source_name.replace('linux', 'linux-meta', 1) + try: + meta_src = source_suite.sources[meta] + meta_binaries = meta_src.binaries + + # Find a binary to build-depend on + for binary in meta_binaries: + dep_pkg_name = binary.package_name + dep_pkg_version = binary.version + break + + new_dep = '%s (>= %s)' % (dep_pkg_name, dep_pkg_version) + + if not deps: + deps = new_dep + elif new_dep not in deps: + deps += ', %s' % new_dep + + self.logger.info('Synthesizing Build-Depends from %s to %s' % (source_name, new_dep)) + except KeyError: + pass + + if not deps: + return verdict + # for every dependency block (formed as conjunction of disjunction) for block_txt in deps.split(','): block = parse_src_depends(block_txt, False, arch) diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 4b0c757..96a2a11 100644 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -2072,6 +2072,59 @@ class AT(TestAutopkgtestBase): # everything from -meta self.assertEqual(exc['linux']['policy_info']['autopkgtest'], {'verdict': 'PASS'}) + def test_kernel_waits_on_meta(self): + '''linux waits on linux-meta''' + + self.data.add('dkms', False, {}) + self.data.add('dkms', True, {}) + self.data.add('fancy-dkms', False, {'Source': 'fancy', 'Depends': 'dkms (>= 1)'}, testsuite='autopkgtest-pkg-dkms') + self.data.add('fancy-dkms', True, {'Source': 'fancy', 'Depends': 'dkms (>= 1)'}, testsuite='autopkgtest-pkg-dkms') + 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-testing': { + 'testing/i386/f/fancy/20150101_090000@': (0, 'fancy 0.5', tr('passedbefore/1')), + 'testing/i386/l/linux/20150101_100000@': (0, 'linux 2', tr('linux-meta/0.2')), + 'testing/amd64/l/linux/20150101_100000@': (0, 'linux 2', tr('linux-meta/0.2')), + 'testing/i386/l/linux-firmware/20150101_100000@': (0, 'linux-firmware 2', tr('linux-firmware/2')), + 'testing/amd64/l/linux-firmware/20150101_100000@': (0, 'linux-firmware 2', tr('linux-firmware/2')), + }}) + + self.run_it( + [('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': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING'}, + 'linux/2': {'amd64': 'PASS', 'i386': 'PASS'} + }), + # no tests, but should wait on linux-meta + 'linux': (False, {}), + # this one does not have a -meta, so don't wait + 'linux-firmware': (True, {'linux-firmware/2': {'amd64': 'PASS', 'i386': 'PASS'}}), + }, + {'linux': [('excuses', 'Build-Depends(-Arch): linux linux-meta (not considered)'), + ('dependencies', {'blocked-by': ['linux-meta']})] + } + ) + + # now linux-meta is ready to go + self.swift.set_results({'autopkgtest-testing': { + 'testing/i386/f/fancy/20150101_100000@': (0, 'fancy 1', tr('linux-meta/0.2')), + 'testing/amd64/f/fancy/20150101_100000@': (0, 'fancy 1', tr('linux-meta/0.2')), + }}) + self.run_it( + [], + {'linux-meta': (True, {'fancy/1': {'amd64': 'PASS', 'i386': 'PASS'}, + 'linux/2': {'amd64': 'PASS', 'i386': 'PASS'}}), + 'linux': (True, {}), + 'linux-firmware': (True, {'linux-firmware/2': {'amd64': 'PASS', 'i386': 'PASS'}}), + }, + {'linux': [('dependencies', {'migrate-after': ['linux-meta']})] + } + ) + ################################################################ # Tests for special-cased packages ################################################################