diff mbox series

[unstable,linux-signed,v2,4/9] UBUNTU: [Packaging] generate-control: reformat using black

Message ID 20241030132153.482139-5-agathe.porte@canonical.com
State New
Headers show
Series Refactor and test generate-control | expand

Commit Message

Agathe Porte Oct. 30, 2024, 1:19 p.m. UTC
Signed-off-by: Agathe Porte <agathe.porte@canonical.com>
---
 debian/scripts/generate-control | 86 +++++++++++++++++++++++++--------
 1 file changed, 65 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/debian/scripts/generate-control b/debian/scripts/generate-control
index fe4998b..2e3e2d7 100755
--- a/debian/scripts/generate-control
+++ b/debian/scripts/generate-control
@@ -5,7 +5,15 @@  from textwrap import dedent
 
 from config import Signing
 
-(series, source_name, generate_name, source_version, unsigned_name, unsigned_version, abi_version) = sys.argv[1:]
+(
+    series,
+    source_name,
+    generate_name,
+    source_version,
+    unsigned_name,
+    unsigned_version,
+    abi_version,
+) = sys.argv[1:]
 
 signing = Signing.load("debian/package.config")
 
@@ -14,8 +22,12 @@  for line in sys.stdin.readlines():
     line = line.replace("@SERIES@", series)
     if "@DEPENDS@" in line:
         for flavour, archs in signing.flavour_archs:
-            print(f' linux-image-unsigned-{abi_version}-{flavour} (= {unsigned_version}) [{" ".join(archs)}],')
-            print(f' linux-buildinfo-{abi_version}-{flavour} (= {unsigned_version}) [{" ".join(archs)}],')
+            print(
+                f' linux-image-unsigned-{abi_version}-{flavour} (= {unsigned_version}) [{" ".join(archs)}],'
+            )
+            print(
+                f' linux-buildinfo-{abi_version}-{flavour} (= {unsigned_version}) [{" ".join(archs)}],'
+            )
         # generate-only build-depends with a profile (activated by parameterise-ancillaries)
         uci_archs = set()
         for _, archs in signing.package_flavour_archs("cvm"):
@@ -23,24 +35,30 @@  for line in sys.stdin.readlines():
         for _, archs in signing.package_flavour_archs("uc"):
             uci_archs.update(archs)
         if uci_archs:
-            print(f' ubuntu-core-initramfs [{" ".join(sorted(uci_archs))}] <pkg.linux-generate>,')
+            print(
+                f' ubuntu-core-initramfs [{" ".join(sorted(uci_archs))}] <pkg.linux-generate>,'
+            )
         print(f" {generate_name} (= {source_version}) <!pkg.linux-generate>,")
         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(sorted(archs))}]  <pkg.linux-generate>,')
+            print(
+                f' linux-modules-extra-{abi_version}-{flavour} (= {unsigned_version}) [{" ".join(sorted(archs))}]  <pkg.linux-generate>,'
+            )
         efi_archs = set()
         for (arch, flavour), (stype, binary) in signing.arch_flavour_data:
-            if stype == 'efi':
+            if stype == "efi":
                 efi_archs.update([arch])
         if efi_archs:
             print(f' sbsigntool [{" ".join(sorted(efi_archs))}],')
         # For HMACs
         print(f" openssl,")
     else:
-        print(line, end='')
+        print(line, end="")
 
 for flavour, archs in signing.package_flavour_archs("image"):
-    print(dedent(f"""\
+    print(
+        dedent(
+            f"""\
 
         Package: linux-image-{abi_version}-{flavour}
         Architecture: {" ".join(archs)}
@@ -53,9 +71,13 @@  for flavour, archs in signing.package_flavour_archs("image"):
         Description: Signed kernel image {flavour}
          A kernel image for {flavour}.  This version of it is signed with
          Canonical's signing key.
-        """).rstrip())
+        """
+        ).rstrip()
+    )
 for flavour, archs in signing.package_flavour_archs("di"):
-    print(dedent(f"""\
+    print(
+        dedent(
+            f"""\
 
         Package: kernel-signed-image-{abi_version}-{flavour}-di
         Package-Type: udeb
@@ -68,9 +90,13 @@  for flavour, archs in signing.package_flavour_archs("di"):
          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())
+    """
+        ).rstrip()
+    )
 for flavour, archs in signing.package_flavour_archs("hmac"):
-    print(dedent(f"""\
+    print(
+        dedent(
+            f"""\
 
         Package: linux-image-hmac-{abi_version}-{flavour}
         Build-Profiles: <!stage1>
@@ -82,10 +108,14 @@  for flavour, archs in signing.package_flavour_archs("hmac"):
         Description: HMAC file for linux kernel image {abi_version}-{flavour}
          This package contains the HMAC file for Linux kernel image for version
          {abi_version}-{flavour}
-        """).rstrip())
+        """
+        ).rstrip()
+    )
 for flavour, archs in signing.package_flavour_archs("cvm"):
     # Mostly similar to image, but we don't have recommands nor conflicts
-    print(dedent(f"""\
+    print(
+        dedent(
+            f"""\
 
         Package: linux-image-{abi_version}-{flavour}-fde
         Architecture: {" ".join(archs)}
@@ -98,14 +128,18 @@  for flavour, archs in signing.package_flavour_archs("cvm"):
         Description: Signed kernel image {flavour} for CVM
          A kernel image for {flavour}.  This version of it is signed with
          Canonical's signing key.
-        """).rstrip())
+        """
+        ).rstrip()
+    )
 for flavour, archs in signing.package_flavour_archs("uc"):
     depends = f"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(sorted(extra_archs))}]"
     # Mostly similar to image, but we don't have recommands nor conflicts
-    print(dedent(f"""\
+    print(
+        dedent(
+            f"""\
 
         Package: linux-image-uc-{abi_version}-{flavour}
         Architecture: {" ".join(archs)}
@@ -114,11 +148,15 @@  for flavour, archs in signing.package_flavour_archs("uc"):
         Description: Signed kernel image {flavour} for Ubuntu Core
          A kernel image for {flavour}.  This version of it is signed with
          Canonical's signing key.
-        """).rstrip())
+        """
+        ).rstrip()
+    )
 # 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.package_flavour_archs("image"):
-    print(dedent(f"""\
+    print(
+        dedent(
+            f"""\
 
         Package: linux-image-{abi_version}-{flavour}-dbgsym
         Section: devel
@@ -126,9 +164,13 @@  for flavour, archs in signing.package_flavour_archs("image"):
         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())
+        """
+        ).rstrip()
+    )
 for flavour, archs in signing.package_flavour_archs("cvm"):
-    print(dedent(f"""\
+    print(
+        dedent(
+            f"""\
 
         Package: linux-image-{abi_version}-{flavour}-fde-dbgsym
         Section: devel
@@ -136,4 +178,6 @@  for flavour, archs in signing.package_flavour_archs("cvm"):
         Depends: linux-image-unsigned-{abi_version}-{flavour}-dbgsym
         Description: Signed kernel image {flavour} for CVM (debug)
          A link to the debugging symbols for the {flavour} signed kernel.
-        """).rstrip())
+        """
+        ).rstrip()
+    )