[linux-signed] 01/05: Skeleton of source package for Linux signature packages

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Mon Apr 4 18:39:11 UTC 2016


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch master
in repository linux-signed.

commit 8c7869d10647db4800cd76381d01fc24d7e07843
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Thu Oct 29 13:03:27 2015 +0000

    Skeleton of source package for Linux signature packages
---
 debian/.gitignore                            | 11 ++++
 debian/bin/gencontrol.py                     | 80 ++++++++++++++++++++++++++++
 debian/changelog                             |  6 +++
 debian/compat                                |  1 +
 debian/rules                                 | 68 +++++++++++++++++++++++
 debian/rules.defs                            |  5 ++
 debian/rules.real                            | 16 ++++++
 debian/source/format                         |  1 +
 debian/templates/control.image-signed.in     |  8 +++
 debian/templates/control.source.in           |  9 ++++
 debian/templates/image-signed.bug-presubj.in |  5 ++
 11 files changed, 210 insertions(+)

diff --git a/debian/.gitignore b/debian/.gitignore
new file mode 100644
index 0000000..08f76f2
--- /dev/null
+++ b/debian/.gitignore
@@ -0,0 +1,11 @@
+*~
+.#*
+/*.debhelper*
+/*.substvars
+/build/
+/control*
+/files
+/linux-image-*
+/rules.gen
+/source.lintian-overrides
+/stamps/
diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py
new file mode 100755
index 0000000..4093da5
--- /dev/null
+++ b/debian/bin/gencontrol.py
@@ -0,0 +1,80 @@
+#!/usr/bin/python3
+
+import sys
+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
+
+import os.path, re, codecs
+
+class Gencontrol(Base):
+    def __init__(self, config, image_version):
+        super(Gencontrol, self).__init__(ConfigCoreDump(fp = open(config, "rb")), Templates(["debian/templates"]))
+
+        config_entry = self.config['version',]
+        self.version = VersionLinux(config_entry['source'])
+        self.abiname = config_entry['abiname']
+        self.vars = {
+            'upstreamversion': self.version.linux_upstream,
+            'version': self.version.linux_version,
+            'source_upstream': self.version.upstream,
+            'abiname': self.abiname,
+            'imageversion': image_version,
+        }
+
+        changelog_version = Changelog()[0].version
+        self.package_version = '%s+%s' % (image_version, changelog_version.complete)
+
+    def do_main_setup(self, vars, makeflags, extra):
+        makeflags['GENCONTROL_ARGS'] = '-v%s' % self.package_version
+
+    def do_main_packages(self, packages, vars, makeflags, extra):
+        packages['source']['Build-Depends'].append(
+            'linux-support-%(abiname)s (= %(imageversion)s)' % vars)
+
+    def do_flavour_packages(self, packages, makefile, arch, featureset, flavour, vars, makeflags, extra):
+        if not (self.config.merge('build', arch, featureset, flavour)
+                .get('signed-modules', False)):
+            return
+
+        try:
+            vars['abiname'] = '-%s' % self.config['abi', arch]['abiname']
+        except KeyError:
+            vars['abiname'] = self.abiname
+        makeflags['ABINAME'] = vars['abiname']
+        makeflags['IMAGEVERSION'] = vars['imageversion']
+
+        packages['source']['Build-Depends'].append(
+            PackageRelationGroup(
+                'linux-image-%(abiname)s%(localversion)s (= %(imageversion)s)' % vars,
+                override_arches=(arch,)))
+
+        packages_signed = self.process_packages(
+            self.templates["control.image-signed"], vars)
+
+        for package in packages_signed:
+            name = package['Package']
+            if name in packages:
+                package = packages.get(name)
+                package['Architecture'].add(arch)
+            else:
+                package['Architecture'] = arch
+                packages.append(package)
+
+        cmds_binary_arch = []
+        for i in packages_signed:
+            cmds_binary_arch += ["$(MAKE) -f debian/rules.real install-signed PACKAGE_NAME='%s' %s" % (i['Package'], makeflags)]
+        makefile.add('binary-arch_%s_%s_%s_real' % (arch, featureset, flavour), cmds = cmds_binary_arch)
+
+        # linux-image signature packages include a bug presubj message
+        # directing reporters to the real image package.
+        bug_presubj = self.substitute(
+            self.templates["image-signed.bug-presubj"], vars)
+        codecs.open("debian/%s.bug-presubj" % packages_signed[0]['Package'], 'w', 'utf-8').write(bug_presubj)
+
+if __name__ == '__main__':
+    Gencontrol(sys.argv[1] + "/config.defines.dump", sys.argv[2])()
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..b87dc00
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,6 @@
+linux-signed (1) UNRELEASED; urgency=medium
+
+  * Initial upload
+  * Provide signatures for linux version 4.5-1~exp2
+
+ -- Ben Hutchings <ben at decadent.org.uk>  Sun, 30 Aug 2015 20:41:11 +0100
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..b2439ed
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,68 @@
+#!/usr/bin/make -f
+SHELL := sh -e
+
+include debian/rules.defs
+
+GENCONTROL = debian/bin/gencontrol.py
+
+DEB_HOST_ARCH  := $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+
+__BINNMU := $(shell dpkg-parsechangelog | sed -rne 's,^Version: .*\+b([0-9]+)$$,\1,p')
+
+build: build-arch build-indep
+build-arch:
+build-indep:
+
+$(BUILD_DIR):
+	@[ -d $@ ] || mkdir $@
+
+clean: debian/control
+	dh_testdir
+	rm -rf $(BUILD_DIR)
+	dh_clean
+
+binary: binary-arch binary-indep
+binary-arch: debian/control $(BUILD_DIR)
+	dh_testdir
+	$(MAKE) -f debian/rules.gen binary-arch_$(DEB_HOST_ARCH)
+binary-indep:
+
+CONTROL_FILES += debian/changelog $(wildcard debian/templates/control.*) 
+debian/control debian/rules.gen: $(GENCONTROL) $(CONTROL_FILES)
+ifeq ($(wildcard debian/control.md5sum),)
+	$(MAKE) -f debian/rules debian/control-real
+else ifeq ($(__BINNMU),)
+	md5sum --check debian/control.md5sum --status || \
+		$(MAKE) -f debian/rules debian/control-real
+else
+	grep -v debian/changelog debian/control.md5sum | md5sum --check - --status || \
+		$(MAKE) -f debian/rules debian/control-real
+endif
+
+debian/control-real: $(GENCONTROL) $(CONTROL_FILES)
+	$(GENCONTROL) /usr/src/linux-support-$(KERNEL_ABINAME) $(KERNEL_IMAGE_VERSION)
+	md5sum $^ > debian/control.md5sum
+	@echo
+	@echo This target is made to fail intentionally, to make sure
+	@echo that it is NEVER run during the automated build. Please
+	@echo ignore the following error, the debian/control file has
+	@echo been generated SUCCESSFULLY.
+	@echo
+	exit 1
+
+ifdef DEBIAN_KERNEL_BUILD_ANY
+binary-arch: binary-arch-all
+endif
+
+binary-arch-all: debian/control $(BUILD_DIR)
+	dh_testdir
+	$(MAKE) -f debian/rules.gen binary-arch
+
+maintainerclean: clean
+	rm -f debian/control debian/control.md5sum debian/rules.gen debian/*.bug-presubj
+# dh_clean won't deal with binary packages that no longer exist after
+# removal of a flavour.
+	rm -rf $(filter-out %.config %.postinst %.templates %.NEWS, $(wildcard debian/linux-*))
+
+.PHONY: build build-arch build-indep clean binary binary-arch binary-indep binary-arch-all maintainerclean
diff --git a/debian/rules.defs b/debian/rules.defs
new file mode 100644
index 0000000..2239bcc
--- /dev/null
+++ b/debian/rules.defs
@@ -0,0 +1,5 @@
+BUILD_DIR = debian/build
+STAMPS_DIR = debian/stamps
+TEMPLATES_DIR = debian/templates
+KERNEL_ABINAME := 4.5.0-trunk
+KERNEL_IMAGE_VERSION := 4.5-1~exp2
diff --git a/debian/rules.real b/debian/rules.real
new file mode 100644
index 0000000..339bd00
--- /dev/null
+++ b/debian/rules.real
@@ -0,0 +1,16 @@
+SHELL := bash -e
+
+build-indep:
+
+install-signed: DH_OPTIONS = -p$(PACKAGE_NAME)
+install-signed:
+	echo kernel:ImageVersion=$(KERNEL_IMAGE_VERSION) >> debian/$(PACKAGE_NAME).substvars
+	dh_install
+	dh_bugfiles
+	dh_installchangelogs
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_gencontrol -- $(GENCONTROL_ARGS)
+	dh_md5sums
+	dh_builddeb
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/debian/templates/control.image-signed.in b/debian/templates/control.image-signed.in
new file mode 100644
index 0000000..c2f36ca
--- /dev/null
+++ b/debian/templates/control.image-signed.in
@@ -0,0 +1,8 @@
+Package: linux-image- at abiname@@localversion at -signed
+Depends: linux-image- at abiname@@localversion@ (= ${kernel:ImageVersion}),
+ kmod (>= 22-1.1~), ${misc:Depends}
+Description: Signatures for Linux @abiname@@localversion@ kernel and modules
+ This package provides signatures for the kernel image and modules in
+ linux-image- at abiname@@localversion at .  If the system has Secure Boot
+ enabled or the kernel is configured to check module signatures, both
+ packages must be installed at the same time.
diff --git a/debian/templates/control.source.in b/debian/templates/control.source.in
new file mode 100644
index 0000000..755c4a9
--- /dev/null
+++ b/debian/templates/control.source.in
@@ -0,0 +1,9 @@
+Source: linux-signed
+Section: kernel
+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~)
+Vcs-Git: https://anonscm.debian.org/git/kernel/linux-signed.git
+Vcs-Browser: https://anonscm.debian.org/cgit/kernel/linux-signed.git
diff --git a/debian/templates/image-signed.bug-presubj.in b/debian/templates/image-signed.bug-presubj.in
new file mode 100644
index 0000000..5e547c7
--- /dev/null
+++ b/debian/templates/image-signed.bug-presubj.in
@@ -0,0 +1,5 @@
+You are about to report a bug in a Linux kernel signature package.
+This is probably not what you intended to do.
+
+If you want to report a bug in the Linux kernel or modules, you should use
+the package name linux-image- at abiname@@localversion@ instead.

-- 
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