From 8571d54a8b7a2cebdba0a317a813f8b7c3ed2bc6 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 19 Dec 2015 16:54:59 +0000 Subject: [PATCH] Add config parameter to disable linux-headers-all packages The linux-grsec source package needs a way to explicitly disable these binary packages which are already built by the linux source package. We already do that when there are no actual kernels for the target architecture. Rename the FOREIGN_KERNEL make variable and combine the two conditions. Based on work by Yves-Alexis Perez. --- debian/bin/gencontrol.py | 21 ++++++++++++--------- debian/rules.real | 3 ++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py index e5ab76d64..9c0070f1e 100755 --- a/debian/bin/gencontrol.py +++ b/debian/bin/gencontrol.py @@ -44,6 +44,7 @@ class Gencontrol(Base): }, 'packages': { 'docs': config.SchemaItemBoolean(), + 'headers-all': config.SchemaItemBoolean(), 'installer': config.SchemaItemBoolean(), 'libc-dev': config.SchemaItemBoolean(), @@ -134,10 +135,6 @@ class Gencontrol(Base): self._setup_makeflags(self.arch_makeflags, makeflags, config_base) def do_arch_packages(self, packages, makefile, arch, vars, makeflags, extra): - # Some userland architectures require kernels from another - # (Debian) architecture, e.g. x32/amd64. - foreign_kernel = not self.config['base', arch].get('featuresets') - if self.version.linux_modifier is None: try: abiname_part = '-%s' % self.config['abi', arch]['abiname'] @@ -146,14 +143,19 @@ class Gencontrol(Base): makeflags['ABINAME'] = vars['abiname'] = \ self.abiname_version + abiname_part - if foreign_kernel: - packages_headers_arch = [] - makeflags['FOREIGN_KERNEL'] = True - else: + # Some userland architectures require kernels from another + # (Debian) architecture, e.g. x32/amd64. + # And some derivatives don't need the headers-all packages + # for other reasons. + if (self.config['base', arch].get('featuresets') and + self.config.merge('packages').get('headers-all', True)): headers_arch = self.templates["control.headers.arch"] packages_headers_arch = self.process_packages(headers_arch, vars) packages_headers_arch[-1]['Depends'].extend(PackageRelation()) extra['headers_arch_depends'] = packages_headers_arch[-1]['Depends'] + else: + packages_headers_arch = [] + makeflags['DO_HEADERS_ALL'] = False if self.config.merge('packages').get('libc-dev', True): libc_dev = self.templates["control.libc-dev"] @@ -364,7 +366,8 @@ class Gencontrol(Base): package_headers = self.process_package(headers[0], vars) package_headers['Depends'].extend(relations_compiler_headers) packages_own.append(package_headers) - extra['headers_arch_depends'].append('%s (= ${binary:Version})' % packages_own[-1]['Package']) + if extra.get('headers_arch_depends'): + extra['headers_arch_depends'].append('%s (= ${binary:Version})' % packages_own[-1]['Package']) build_debug = config_entry_build.get('debug-info') diff --git a/debian/rules.real b/debian/rules.real index 403bfe0b8..4861fce35 100644 --- a/debian/rules.real +++ b/debian/rules.real @@ -50,7 +50,8 @@ MAKEOVERRIDES = # # Targets # -ifneq ($(FOREIGN_KERNEL),True) +binary-arch-arch: +ifneq ($(DO_HEADERS_ALL),False) binary-arch-arch: install-headers_$(ARCH) endif ifneq ($(DO_LIBC),False)