deleted file mode 100644
@@ -1,52 +0,0 @@
-Source: SRCPKGNAME
-Section: kernel
-Priority: optional
-Maintainer: Canonical Kernel Team <kernel-team@lists.ubuntu.com>
-Build-Depends:
- debhelper (>= 9),
- lsb-release,
- python3,
- python3-apt,
-Build-Depends-Arch:
- sbsigntool [amd64 arm64],
- HEADERS_COMMON (>= UNSIGNED_SRC_VERSION),
- HEADERS_ARCH (>= UNSIGNED_SRC_VERSION),
-Standards-Version: 3.9.4
-
-Package: linux-image-ABI-generic
-Architecture: amd64 arm64 ppc64el s390x
-Depends: ${unsigned:Depends}
-Recommends: ${unsigned:Recommends}
-Suggests: ${unsigned:Suggests}
-Conflicts: ${unsigned:Conflicts}
-Provides: ${unsigned:Provides}
-Built-Using: UNSIGNED_SRC_PACKAGE (= UNSIGNED_SRC_VERSION)
-Description: Signed kernel image generic
- A kernel image for generic. This version of it is signed with
- Canonical's UEFI/Opal signing key.
-
-Package: linux-image-ABI-generic-64k
-Architecture: arm64
-Depends: ${unsigned:Depends}
-Recommends: ${unsigned:Recommends}
-Suggests: ${unsigned:Suggests}
-Conflicts: ${unsigned:Conflicts}
-Provides: ${unsigned:Provides}
-Built-Using: UNSIGNED_SRC_PACKAGE (= UNSIGNED_SRC_VERSION)
-Description: Signed kernel image generic-64k
- A kernel image for generic-64k. This version of it is signed with
- Canonical's UEFI/Opal signing key.
-
-Package: linux-image-ABI-generic-dbgsym
-Section: devel
-Architecture: amd64 arm64 ppc64el s390x
-Depends: linux-image-unsigned-ABI-generic-dbgsym
-Description: Signed kernel image generic
- A link to the debugging symbols for the generic signed kernel.
-
-Package: linux-image-ABI-generic-64k-dbgsym
-Section: devel
-Architecture: arm64
-Depends: linux-image-unsigned-ABI-generic-64k-dbgsym
-Description: Signed kernel image generic-64k
- A link to the debugging symbols for the generic-64k signed kernel.
@@ -7,6 +7,7 @@ DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
src = $(shell dpkg-parsechangelog -S Source)
ver = $(shell dpkg-parsechangelog -S Version)
abi = $(shell echo "$(ver)" | sed -ne 's/\([0-9]*\.[0-9]*\.[0-9]*\-[0-9]*\)\..*/\1/p')
+series = $(shell dpkg-parsechangelog -SDistribution | sed -e 's/-\(security\|updates\|proposed\)$$//')
# Work out the source package name and version of the unsigned package
# By convention, it is the name of this package with -signed stripped.
@@ -14,8 +15,6 @@ abi = $(shell echo "$(ver)" | sed -ne 's/\([0-9]*\.[0-9]*\.[0-9]*\-[0-9]*\)\..*/
unsigned_src = $(shell echo $(src) | sed -e 's/-signed//')
unsigned_ver = $(shell echo $(ver) | sed -e 's/+[0-9][0-9]*$$//')
-# Work out header packges for build deps. Depend on the common header
-# package and the per-arch generic headers package (assumes all arches
# have a generic flavour, which is currently true).
src_headers = $(unsigned_src)-headers-$(abi)
src_headers_arch = linux-headers-$(abi)-generic
@@ -23,13 +22,8 @@ src_headers_arch = linux-headers-$(abi)-generic
# We build our control file. This has to be done before dh runs otherwise
# we have no binary files and we will not run the appropriate targets.
pre-clean:
- sed <debian/control.stub >debian/control \
- -e "s/ABI/$(abi)/g" \
- -e "s/UNSIGNED_SRC_PACKAGE/$(unsigned_src)/g" \
- -e "s/UNSIGNED_SRC_VERSION/$(unsigned_ver)/g" \
- -e 's/SRCPKGNAME/$(src)/g' \
- -e 's/HEADERS_COMMON/$(src_headers)/g' \
- -e 's/HEADERS_ARCH/$(src_headers_arch)/g'
+ rm -f debian/control
+ ./debian/scripts/generate-control $(series) $(src) $(ver) $(unsigned_src) $(unsigned_ver) $(abi)
rm -rf ./$(unsigned_ver) UNSIGNED SIGNED
rm -f debian/linux-image-*.install \
debian/linux-image-*.preinst \
new file mode 100755
@@ -0,0 +1,76 @@
+#!/usr/bin/python3 -B
+
+import json
+import sys
+from textwrap import dedent
+
+
+class Signing:
+
+ def __init__(self):
+ self._flavour_to_arch = {}
+ self._arch_flavour_data = {}
+
+ def add(self, arch, stype, binary, flavours):
+ for flavour in flavours:
+ self._flavour_to_arch.setdefault(flavour, []).append(arch)
+ self._arch_flavour_data[(arch, flavour)] = (stype, binary)
+
+ @property
+ def flavour_archs(self):
+ return sorted(self._flavour_to_arch.items())
+
+ @property
+ def arch_flavour_data(self):
+ return sorted(self._arch_flavour_data.items())
+
+
+(series, source_name, source_version, unsigned_name, unsigned_version, abi_version) = sys.argv[1:]
+
+signing = Signing()
+
+with open("debian/package.config") as cfd:
+ for line in cfd:
+ cmd, *args = line.strip().split()
+ if cmd == "sign":
+ arch, stype, binary, *flavours = args
+ signing.add(arch, stype, binary, flavours)
+
+with open("debian/control.stub") as tfd, open("debian/control", "w") as cfd:
+ for line in tfd:
+ line = line.replace("@SRCPKGNAME@", source_name)
+ line = line.replace("@SERIES@", series)
+ if "@DEPENDS@" in line:
+ for flavour, archs in signing.flavour_archs:
+ print(f' linux-image-unsigned-{abi_version}-{flavour} [{" ".join(archs)}],', file=cfd)
+ else:
+ print(line, end='', file=cfd)
+
+ for flavour, archs in signing.flavour_archs:
+ print(dedent(f"""\
+
+ Package: linux-image-{abi_version}-{flavour}
+ Architecture: {" ".join(archs)}
+ Depends: ${{unsigned:Depends}}
+ Recommends: ${{unsigned:Recommends}}
+ Suggests: ${{unsigned:Suggests}}
+ Conflicts: ${{unsigned:Conflicts}}
+ Provides: ${{unsigned:Provides}}
+ Built-Using: {unsigned_name} (= {unsigned_version})
+ Description: Signed kernel image {flavour}
+ A kernel image for {flavour}. This version of it is signed with
+ Canonical's signing key.
+ """).rstrip(), file=cfd)
+
+ # XXX: all dbgsym packages _must_ be at the end of debian/control else the
+ # build will hang forever on the builder.
+ for flavour, archs in signing.flavour_archs:
+ print(dedent(f"""\
+
+ Package: linux-image-{abi_version}-{flavour}-dbgsym
+ Section: devel
+ Architecture: {" ".join(archs)}
+ Depends: linux-image-unsigned-{abi_version}-{flavour}-dbgsym
+ Description: Signed kernel image {flavour}
+ A link to the debugging symbols for the {flavour} signed kernel.
+ """).rstrip(), file=cfd)
Start generating debian/control from debian/package.config. Signed-off-by: Andy Whitcroft <apw@canonical.com> --- debian/control.stub | 52 ---------------------- debian/rules | 12 ++---- debian/scripts/generate-control | 76 +++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 61 deletions(-) delete mode 100644 debian/control.stub create mode 100755 debian/scripts/generate-control