From patchwork Fri Sep 16 11:46:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 1678647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=FinRFYFN; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MTXkF065Yz1ynm for ; Fri, 16 Sep 2022 22:02:13 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oZA2n-0005Wn-RO; Fri, 16 Sep 2022 12:02:05 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oZA2l-0005VJ-Gp for kernel-team@lists.ubuntu.com; Fri, 16 Sep 2022 12:02:03 +0000 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 372823F337 for ; Fri, 16 Sep 2022 12:02:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1663329723; bh=aiLBdEViKGeT+E/WNv1ynTNKVXfOVEd1brUbo8Zc6ME=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FinRFYFNVg0A15r/UOgiuexpDJT98KTyIhyGxNOL//KRi21h7tdsQnZCkq8Nq4Sx4 zjkYl8/yAWgpitkduE1J3sn+wpNkWyJfr78mE4jP50fnR9GtR5whV1h0PFsQL3Crk0 a162NvBJ0kgn1pGJ6Wrtf9FcDcFOZdortfmaxwIgkIfVggTdh1ALvxI5pd6t1nIoEO uvZka3204ZIa1AD0yxoXXlmLGw4UxKzjLhGmfWIa2o1nKhBSTvj0FanvLgxEf7V8Rf rTX1pxtYbbUIWytdhT+xCpyu+ghsKwiNgXvh9LHYBjLRCSIxU6F4DcmeKb8kXMkpAM FR5qlMOhLxBOg== Received: by mail-ej1-f69.google.com with SMTP id xj11-20020a170906db0b00b0077b6ecb23fcso7064860ejb.5 for ; Fri, 16 Sep 2022 05:02:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=aiLBdEViKGeT+E/WNv1ynTNKVXfOVEd1brUbo8Zc6ME=; b=ki+llijECxQSD0JynwQWtcuCi0vM/2wOCQPg/mCUl4nFxHbgeqkzSGYy/bDb6oSTK8 /6tBOqmsTvZ+8YsKvqWmYxNxmzoqGBkhNQE2NQQ06eFS/wb2Q433wO7ftjTOFYWYgYhE aXF1H+a91YDu/EUUkO3NfZeJw8Xnj/189YT3JK9lny2Aruvfi++6vLq5CcKN4gDgnyEj 5IVlR8h/NgF02385BOScNdtoY6xfyYZOCLP4C23hMWQ6S/InWfT7qObSwZXbEaO7EVdE M+WLw1578oFTKS7QaeK4nfumDv9DomSYn9HM/P+NKLukm13vs+MMhsELZDbmcW/oBv72 S3ww== X-Gm-Message-State: ACrzQf1L1A8qr4+1vTf3V5/O4tg7053YSSeVmn4/ZJFa13TveKqjaUS0 C3pUg1qcPal8FzI+/FQV9asTDHQn1oVfwQ3uKBy0N6JbQGRVKVUGurJvKeCjC0H/DNA/R+SReBm RBm+DY8R1TF+k7c5NGgrOIrAP3iwaqjGdpw38zDRlJA== X-Received: by 2002:a05:6402:42d0:b0:448:29dc:6344 with SMTP id i16-20020a05640242d000b0044829dc6344mr3756524edc.221.1663329722632; Fri, 16 Sep 2022 05:02:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7VMUZiDr/VgKk5EqT3q5xPyOOqWWJXt7okq5j0vxaxmHWS5ehAUM3uyK5WCaD1lYNkoyi7bw== X-Received: by 2002:a05:6402:42d0:b0:448:29dc:6344 with SMTP id i16-20020a05640242d000b0044829dc6344mr3756502edc.221.1663329722398; Fri, 16 Sep 2022 05:02:02 -0700 (PDT) Received: from localhost (host5-81-229-118.range5-81.btcentralplus.com. [5.81.229.118]) by smtp.gmail.com with ESMTPSA id p24-20020a056402075800b0045081dc93dfsm13186838edy.78.2022.09.16.05.02.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 05:02:01 -0700 (PDT) From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [PATCH 06/13] UBUNTU: [Packaging] generate: add -di package support Date: Fri, 16 Sep 2022 12:46:35 +0100 Message-Id: <20220916114642.2953019-7-apw@canonical.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220916114642.2953019-1-apw@canonical.com> References: <20220916114642.2953019-1-apw@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andy Whitcroft Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" Signed-off-by: Andy Whitcroft --- debian/scripts/config.py | 21 ++++++++++++++++----- debian/scripts/generate-control | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/debian/scripts/config.py b/debian/scripts/config.py index e964e64..34bd08d 100644 --- a/debian/scripts/config.py +++ b/debian/scripts/config.py @@ -2,22 +2,30 @@ class Signing: def __init__(self): self._flavour_to_arch = {} + self._package_to_flavour_to_arch = {} self._arch_flavour_data = {} - def add(self, arch, stype, binary, flavours): + def add(self, arch, stype, binary, flavours, options): for flavour in flavours: - self._flavour_to_arch.setdefault(flavour, []).append(arch) self._arch_flavour_data[(arch, flavour)] = (stype, binary) + self._flavour_to_arch.setdefault(flavour, set()).add(arch) + self._package_to_flavour_to_arch.setdefault("image", {}).setdefault(flavour, set()).add(arch) + if "di" in options: + self._package_to_flavour_to_arch.setdefault("di", {}).setdefault(flavour, set()).add(arch) @property def flavour_archs(self): - return sorted(self._flavour_to_arch.items()) + for flavour, archs in sorted(self._flavour_to_arch.items()): + yield flavour, sorted(list(archs)) + + def package_flavour_archs(self, package): + for flavour, archs in sorted(self._package_to_flavour_to_arch.get(package, {}).items()): + yield flavour, sorted(list(archs)) @property def arch_flavour_data(self): return sorted(self._arch_flavour_data.items()) - @classmethod def load(cls, config): signing = Signing() @@ -26,5 +34,8 @@ class Signing: cmd, *args = line.strip().split() if cmd == "sign": arch, stype, binary, *flavours = args - signing.add(arch, stype, binary, flavours) + options = [] + while flavours[-1].startswith("--"): + options.append(flavours.pop()[2:]) + signing.add(arch, stype, binary, flavours, options) return signing diff --git a/debian/scripts/generate-control b/debian/scripts/generate-control index 6fd68f6..b9b2f48 100755 --- a/debian/scripts/generate-control +++ b/debian/scripts/generate-control @@ -20,7 +20,7 @@ with open("debian/control.stub") as tfd, open("debian/control", "w") as cfd: else: print(line, end='', file=cfd) - for flavour, archs in signing.flavour_archs: + for flavour, archs in signing.package_flavour_archs("image"): print(dedent(f"""\ Package: linux-image-{abi_version}-{flavour} @@ -35,10 +35,24 @@ with open("debian/control.stub") as tfd, open("debian/control", "w") as cfd: A kernel image for {flavour}. This version of it is signed with Canonical's signing key. """).rstrip(), file=cfd) + for flavour, archs in signing.package_flavour_archs("di"): + print(dedent(f"""\ + Package: kernel-signed-image-{abi_version}-{flavour}-di + Package-Type: udeb + Section: debian-installer + Priority: extra + Provides: kernel-signed-image + Architecture: {" ".join(archs)} + Built-Using: {unsigned_name} (= {unsigned_version}) + Description: Signed kernel image generic for the Debian installer + A kernel image for {flavour}. This version of it is signed with + Canonical's UEFI signing key. It is intended for the Debian installer, + it does _not_ provide a usable kernel for your full Debian system. + """).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: + for flavour, archs in signing.package_flavour_archs("image"): print(dedent(f"""\ Package: linux-image-{abi_version}-{flavour}-dbgsym