Merge branch 'gencontrol-improvements' into 'buster'

Cherry-pick debian/bin/gencontrol.py improvements

See merge request kernel-team/linux!267
This commit is contained in:
Salvatore Bonaccorso 2020-09-05 07:55:30 +00:00
commit a4a0f217d7
3 changed files with 35 additions and 28 deletions

View File

@ -58,6 +58,12 @@ class Gencontrol(Base):
}
}
env_flags = [
('DEBIAN_KERNEL_DISABLE_DEBUG', 'disable_debug', 'debug infos'),
('DEBIAN_KERNEL_DISABLE_INSTALLER', 'disable_installer', 'installer modules'),
('DEBIAN_KERNEL_DISABLE_SIGNED', 'disable_signed', 'signed code'),
]
def __init__(self, config_dirs=["debian/config"],
template_dirs=["debian/templates"]):
super(Gencontrol, self).__init__(
@ -67,6 +73,17 @@ class Gencontrol(Base):
self.process_changelog()
self.config_dirs = config_dirs
for env, attr, desc in self.env_flags:
setattr(self, attr, False)
if os.getenv(env):
if self.changelog[0].distribution == 'UNRELEASED':
import warnings
warnings.warn(f'Disable {desc} on request ({env} set)')
setattr(self, attr, True)
else:
raise RuntimeError(
'Unable to disable {desc} in release build ({env} set)')
def _setup_makeflags(self, names, makeflags, data):
for src, dst, optional in names:
if src in data or not optional:
@ -93,16 +110,7 @@ class Gencontrol(Base):
self.installer_packages = {}
if os.getenv('DEBIAN_KERNEL_DISABLE_INSTALLER'):
if self.changelog[0].distribution == 'UNRELEASED':
import warnings
warnings.warn('Disable installer modules on request '
'(DEBIAN_KERNEL_DISABLE_INSTALLER set)')
else:
raise RuntimeError(
'Unable to disable installer modules in release build '
'(DEBIAN_KERNEL_DISABLE_INSTALLER set)')
elif self.config.merge('packages').get('installer', True):
if not self.disable_installer and self.config.merge('packages').get('installer', True):
# Add udebs using kernel-wedge
kw_env = os.environ.copy()
kw_env['KW_DEFCONFIG_DIR'] = 'debian/installer'
@ -132,8 +140,11 @@ class Gencontrol(Base):
# configuration errors before building linux-signed.
build_signed = {}
for arch in arches:
build_signed[arch] = self.config.merge('build', arch) \
.get('signed-code', False)
if not self.disable_signed:
build_signed[arch] = self.config.merge('build', arch) \
.get('signed-code', False)
else:
build_signed[arch] = False
for package in udeb_packages:
# kernel-wedge currently chokes on Build-Profiles so add it now
@ -246,8 +257,11 @@ class Gencontrol(Base):
makeflags['ABINAME'] = vars['abiname'] = \
self.abiname_version + abiname_part
build_signed = self.config.merge('build', arch) \
.get('signed-code', False)
if not self.disable_signed:
build_signed = self.config.merge('build', arch) \
.get('signed-code', False)
else:
build_signed = False
# Some userland architectures require kernels from another
# (Debian) architecture, e.g. x32/amd64.
@ -457,7 +471,10 @@ class Gencontrol(Base):
packages_own = []
build_signed = config_entry_build.get('signed-code')
if not self.disable_signed:
build_signed = config_entry_build.get('signed-code')
else:
build_signed = False
image = self.templates[build_signed and "control.image-unsigned"
or "control.image"]
@ -481,18 +498,7 @@ class Gencontrol(Base):
build_debug = config_entry_build.get('debug-info')
if os.getenv('DEBIAN_KERNEL_DISABLE_DEBUG'):
if self.changelog[0].distribution == 'UNRELEASED':
import warnings
warnings.warn('Disable debug infos on request '
'(DEBIAN_KERNEL_DISABLE_DEBUG set)')
build_debug = False
else:
raise RuntimeError(
'Unable to disable debug infos in release build '
'(DEBIAN_KERNEL_DISABLE_DEBUG set)')
if build_debug:
if not self.disable_debug:
makeflags['DEBUG'] = True
packages_own.extend(self.process_packages(
self.templates['control.image-dbg'], vars))

1
debian/changelog vendored
View File

@ -733,6 +733,7 @@ linux (4.19.143-1) UNRELEASED; urgency=medium
(CVE-2020-15780)
* [rt] Update to 4.19.142-rt63
* net/packet: fix overflow in tpacket_rcv (CVE-2020-14386)
* debian/tests/python: pycodestyle: Increase max-line-length to 100.
-- Salvatore Bonaccorso <carnil@debian.org> Tue, 04 Aug 2020 16:33:40 +0200

2
debian/tests/python vendored
View File

@ -22,7 +22,7 @@ sources="$AUTOPKGTEST_TMP/sources"
echo "I: Running pycodestyle..."
# Ignore E126,E226,W503 (ignored by default) and also E127,W291 which
# give false positives.
if ! xargs pycodestyle --ignore E126,E127,E226,W291,W503 < "$sources"; then
if ! xargs pycodestyle --max-line-length=100 --ignore E126,E127,E226,W291,W503 < "$sources"; then
# pycodestyle only writes to stdout
echo >&2 "E: pycodestyle detected problems"
fi