[PATCH 2/2][FOCAL kernel-snaps-uc20] pc-lowlatency: snapcraft.yaml use pure snapcraft syntax

Dimitri John Ledkov dimitri.ledkov at canonical.com
Wed Jul 28 14:18:24 UTC 2021


Use pure snapcraft syntax to package debs into a snap, with
declarative syntax for additional PPA repositories, packages to stage,
and reorg inside the kernel snap.

This removes dependency on the Makefiles, and makes the snap always
buildable as ABI version is automatically selected. This makes it
possible to build this snapcraft.yaml in ESM and embargoed PPAs ahead
of public releases without cranking, simply by doing requestbuilds()
via API or launchpad WebUI. Once can still do empty git commit and
push to trigger builds with a code change. One can also build it
locally with multipass or lxd providers, remotely with remote-build,
or push to launchpad and create snap build there.

Sample build at
https://launchpad.net/~xnox/+snap/xnox-lowlatency/+build/1478574

Differences versus current snap:
- different locations of the copyright and license files
- lack of lib/{modules|firmware} ../{modules|firmware} symlinks, which
  are unused (?!)

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
---
 snapcraft.yaml | 43 +++++++++++++++++++++++++++++++------------
 1 file changed, 31 insertions(+), 12 deletions(-)

diff --git a/snapcraft.yaml b/snapcraft.yaml
index acf96d8636..283ef172e6 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -1,23 +1,42 @@
 name: pc-lowlatency-kernel
-version: 5.4.0-80.90.1
+adopt-info: kernel
 summary: lowlatency linux kernel
 description: The lowlatency Ubuntu kernel package as a snap
 type: kernel
+grade: stable
 confinement: strict
 build-base: core20
+# In addition to these repositories, the /+snap/ page on launchpad may
+# also build with ESM repositories enabled, or built in a particular
+# PPA, which will also be used.
+package-repositories:
+  - type: apt
+    ppa: canonical-kernel-team/uc20-release
+  - type: apt
+    ppa: canonical-kernel-team/uc20-staging
+  - type: apt
+    ppa: canonical-kernel-team/proposed
 
 parts:
   kernel:
-    source: git://git.launchpad.net/~canonical-kernel-snaps/+git/kernel-snaps-uc20
-    source-type: git
-    source-branch: master
-    plugin: make
-    make-parameters:
-      - KERNEL_SOURCE=focal:linux-uc20-efi
-      - KERNEL=linux-image-uc20-efi-lowlatency
-      - KERNEL_IMAGE_FORMAT=efi
-      - PROPOSED=true
+    plugin: nil
+    override-pull: |
+      snapcraftctl pull
+      snapcraftctl set-version "$(apt show linux-image-uc20-efi-lowlatency 2>/dev/null | sed -n 's/^Version: //p')"
     build-packages:
-      - gnupg
       - kmod
-      - lsb-release
+    stage-packages:
+      - linux-image-uc20-efi-lowlatency
+    override-build: |
+      snapcraftctl build
+      depmod -b $SNAPCRAFT_PART_INSTALL $(ls $SNAPCRAFT_PART_INSTALL/lib/modules)
+      mv $SNAPCRAFT_PART_INSTALL/boot/kernel.efi* $SNAPCRAFT_PART_INSTALL/boot/kernel.efi
+    organize:
+      boot/: /
+      lib/modules: modules
+      lib/firmware: firmware
+    stage:
+      - -usr/share/man
+      - -usr/lib/linux
+      - -lib/crda
+      - -lib/modprobe.d
-- 
2.30.2




More information about the kernel-team mailing list