[PATCH 1/2] UBUNTU: [Packaging] Add support to build-depend on modules-extra

Dimitri John Ledkov dimitri.ledkov at canonical.com
Thu Aug 24 14:30:59 UTC 2023


linux-generate for kernel.efi builds may require modules-extra for
some flavours and arches. Add support to request such build-depends
for linux-generate.

BugLink: https://launchpad.net/bugs/2032760

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
---
 debian/scripts/config.py        | 6 +++++-
 debian/scripts/generate-control | 9 ++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/debian/scripts/config.py b/debian/scripts/config.py
index 0fc94c1676..9ef880c773 100644
--- a/debian/scripts/config.py
+++ b/debian/scripts/config.py
@@ -9,10 +9,14 @@ class Signing:
         for flavour in flavours:
             self._arch_flavour_data.setdefault((arch, flavour), set()).add((stype, binary))
             self._flavour_to_arch.setdefault(flavour, set()).add(arch)
-            # cvm is an exclusive option: no image paragraph, no further option flags
+            if "extra" in options:
+                # cvm & uc sometimes need modules-extra
+                self._package_to_flavour_to_arch.setdefault("extra", {}).setdefault(flavour, set()).add(arch)
+            # cvm is an exclusive option: no image paragraph
             if "cvm" in options:
                 self._package_to_flavour_to_arch.setdefault("cvm", {}).setdefault(flavour, set()).add(arch)
                 continue
+            # uc is an exclusive option: no image paragraph
             if "uc" in options:
                 self._package_to_flavour_to_arch.setdefault("uc", {}).setdefault(flavour, set()).add(arch)
                 continue
diff --git a/debian/scripts/generate-control b/debian/scripts/generate-control
index 5945d9c965..0661b61e34 100755
--- a/debian/scripts/generate-control
+++ b/debian/scripts/generate-control
@@ -26,6 +26,9 @@ with open("debian/control.stub") as tfd, open("debian/control", "w") as cfd:
                 uci_archs.update(archs)
             if uci_archs:
                 print(f' ubuntu-core-initramfs [{" ".join(uci_archs)}] <generate>,', file=cfd)
+            for flavour, archs in signing.package_flavour_archs("extra"):
+                # ubuntu-core-initramfs sometime needs extra modules https://bugs.launchpad.net/bugs/2032760
+                print(f' linux-modules-extra-{abi_version}-{flavour} (= {unsigned_version}) [{" ".join(archs)}]  <generate>,', file=cfd)
             print(f" {generate_name} (= {source_version}),", file=cfd)
             efi_archs = set()
             for (arch, flavour), (stype, binary) in signing.arch_flavour_data:
@@ -99,12 +102,16 @@ with open("debian/control.stub") as tfd, open("debian/control", "w") as cfd:
              Canonical's signing key.
             """).rstrip(), file=cfd)
     for flavour, archs in signing.package_flavour_archs("uc"):
+        depends = "linux-modules-{abi_version}-{flavour}"
+        for extra_flavour, extra_archs in signing.package_flavour_archs("extra"):
+            if extra_flavour == flavour:
+                depends += f", linux-modules-extra-{abi_version}-{flavour} [{' '.join(extra_archs)}]"
         # Mostly similar to image, but we don't have recommands nor conflicts
         print(dedent(f"""\
 
             Package: linux-image-uc-{abi_version}-{flavour}
             Architecture: {" ".join(archs)}
-            Depends: linux-modules-{abi_version}-{flavour}
+            Depends: {depends}
             Built-Using: {unsigned_name} (= {unsigned_version})
             Description: Signed kernel image {flavour} for Ubuntu Core
              A kernel image for {flavour}.  This version of it is signed with
-- 
2.34.1




More information about the kernel-team mailing list