[linux-signed] 03/03: Build signed udebs using configuration from linux-support
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Wed Jun 8 21:35:41 UTC 2016
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch benh/udebsig
in repository linux-signed.
commit f3f0fde785407f8ec5341f898bd71fbb7a134b5d
Author: Ben Hutchings <ben at decadent.org.uk>
Date: Tue Jun 7 00:29:33 2016 +0100
Build signed udebs using configuration from linux-support
---
debian/.gitignore | 1 +
debian/bin/gencontrol.py | 48 +++++++++++++++++++++++++++++++++++---
debian/rules.real | 19 +++++++++++++++
debian/templates/control.source.in | 2 +-
4 files changed, 66 insertions(+), 4 deletions(-)
diff --git a/debian/.gitignore b/debian/.gitignore
index 5eeee81..57e286a 100644
--- a/debian/.gitignore
+++ b/debian/.gitignore
@@ -1,5 +1,6 @@
*~
.#*
+*-di
/*.debhelper*
/*.substvars
/build/
diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py
index 7f768a0..31be69c 100755
--- a/debian/bin/gencontrol.py
+++ b/debian/bin/gencontrol.py
@@ -6,10 +6,10 @@ sys.path.append(sys.argv[1] + "/lib/python")
from debian_linux.config import ConfigCoreDump
from debian_linux.debian import Changelog, PackageDescription, VersionLinux, \
Package, PackageRelationGroup
-from debian_linux.gencontrol import Gencontrol as Base
-from debian_linux.utils import Templates
+from debian_linux.gencontrol import Gencontrol as Base, merge_packages
+from debian_linux.utils import Templates, read_control
-import os.path, re, codecs
+import os.path, re, codecs, io, subprocess
class Gencontrol(Base):
def __init__(self, config, image_version, signed_version_suffix):
@@ -45,6 +45,48 @@ class Gencontrol(Base):
makeflags['ABINAME'] = vars['abiname'] = \
self.config['version', ]['abiname_base'] + abiname_part
+ 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) and
+ self.config.merge('build', arch).get('signed-modules', False)):
+ # Add udebs using kernel-wedge
+ installer_def_dir = ('/usr/share/linux-support-%s/installer' %
+ self.abiname)
+ installer_arch_dir = os.path.join(installer_def_dir, arch)
+ if os.path.isdir(installer_arch_dir):
+ kw_env = os.environ.copy()
+ kw_env['KW_DEFCONFIG_DIR'] = installer_def_dir
+ kw_env['KW_CONFIG_DIR'] = installer_arch_dir
+ kw_proc = subprocess.Popen(
+ ['kernel-wedge', 'gen-control', vars['abiname']],
+ stdout=subprocess.PIPE,
+ env=kw_env)
+ if not isinstance(kw_proc.stdout, io.IOBase):
+ udeb_packages = read_control(io.open(kw_proc.stdout.fileno(), encoding='utf-8', closefd=False))
+ else:
+ udeb_packages = read_control(io.TextIOWrapper(kw_proc.stdout, 'utf-8'))
+ kw_proc.wait()
+ if kw_proc.returncode != 0:
+ raise RuntimeError('kernel-wedge exited with code %d' %
+ kw_proc.returncode)
+
+ merge_packages(packages, udeb_packages, arch)
+
+ # These packages must be built after the per-flavour/
+ # per-featureset packages. Also, this won't work
+ # correctly with an empty package list.
+ if udeb_packages:
+ makefile.add(
+ 'binary-arch_%s' % arch,
+ cmds=["$(MAKE) -f debian/rules.real install-udeb_%s %s "
+ "PACKAGE_NAMES='%s'" %
+ (arch, makeflags,
+ ' '.join(p['Package'] for p in udeb_packages))])
+
def do_flavour_setup(self, vars, makeflags, arch, featureset, flavour, extra):
super(Gencontrol, self).do_flavour_setup(vars, makeflags, arch, featureset, flavour, extra)
diff --git a/debian/rules.real b/debian/rules.real
index 35d20c0..a917f2e 100644
--- a/debian/rules.real
+++ b/debian/rules.real
@@ -55,3 +55,22 @@ install-signed:
dh_gencontrol -- $(GENCONTROL_ARGS)
dh_md5sums
dh_builddeb
+
+install-udeb_$(ARCH): export KW_DEFCONFIG_DIR=/usr/share/linux-support-$(ABINAME)/installer
+install-udeb_$(ARCH): export KW_CONFIG_DIR=/usr/share/linux-support-$(ABINAME)/installer/$(ARCH)
+install-udeb_$(ARCH): DH_OPTIONS=$(PACKAGE_NAMES:%=-p%)
+install-udeb_$(ARCH):
+# kernel-wedge doesn't expect a -signed suffix; work around that until we
+# decide whether the signed or unsigned packages get the suffix
+ while read flavour; do \
+ rm -f debian/linux-image-$(ABINAME)-$$flavour; \
+ ln -s linux-image-$(ABINAME)-$$flavour-signed \
+ debian/linux-image-$(ABINAME)-$$flavour; \
+ done < <(awk '!/^#/ { print $$3 }' $(KW_CONFIG_DIR)/kernel-versions)
+ dh_testdir
+ dh_prep
+ kernel-wedge install-files $(ABINAME)
+ kernel-wedge check $(PACKAGE_NAMES)
+ dh_fixperms
+ dh_gencontrol -- $(GENCONTROL_ARGS)
+ dh_builddeb
diff --git a/debian/templates/control.source.in b/debian/templates/control.source.in
index 6b7ee7a..1f252ae 100644
--- a/debian/templates/control.source.in
+++ b/debian/templates/control.source.in
@@ -4,7 +4,7 @@ Priority: optional
Maintainer: Debian Kernel Team <debian-kernel at lists.debian.org>
Uploaders: Ben Hutchings <ben at decadent.org.uk>
Standards-Version: 3.9.6
-Build-Depends: debhelper (>= 9~), rsync, sbsigntool [amd64 i386]
+Build-Depends: debhelper (>= 9~), rsync, sbsigntool [amd64 i386], kernel-wedge (>= 2.94~)
Vcs-Git: https://anonscm.debian.org/git/kernel/linux-signed.git
Vcs-Browser: https://anonscm.debian.org/cgit/kernel/linux-signed.git
Homepage: https://www.kernel.org/
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux-signed.git
More information about the Kernel-svn-changes
mailing list