[PATCH v2] deb to snap: use apt-pinning to install just the kernel from -proposed

Paolo Pisati paolo.pisati at canonical.com
Fri Oct 6 15:54:07 UTC 2017


In the target kernel branch (e.g. pc-kernel), enable the proposed
repository and point the kernel version to the one present
in proposed:

--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -1,5 +1,5 @@
 name: pc-kernel
-version: 4.4.0.96.101
+version: 4.4.0.97.102
 summary: generic linux kernel
 description: The generic Ubuntu kernel package as a snap
 type: kernel
@@ -13,6 +13,7 @@ parts:
     plugin: make
     make-parameters:
       - KERNEL=linux-pc-image
+      - PROPOSED=true
     build-packages:
       - debootstrap
       - lsb-release

Signed-off-by: Paolo Pisati <paolo.pisati at canonical.com>
---
 Makefile | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/Makefile b/Makefile
index 98c5a48..2dc47ca 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,24 @@ $(error linux-pc-image is a meta package only used in i386 or amd64, abort)
 endif
 endif
 
+define APTPREF
+Package: *
+Pin: release a=$(RELEASE);
+Pin-Priority: 700
+
+Package: *
+Pin: release a=$(RELEASE)-updates
+Pin-Priority: 700
+
+Package: *
+Pin: release a=$(RELEASE)-security
+Pin-Priority: 700
+
+Package: *
+Pin: release a=$(RELEASE)-proposed
+Pin-Priority: 650
+endef
+export APTPREF
 
 install : KVERS = $(shell ls -1 chroot/boot/vmlinuz-*| tail -1 |sed 's/^.*vmlinuz-//;s/.efi.signed$$//')
 
@@ -35,6 +53,7 @@ all:
 	if [ "$(PROPOSED)" = "true" ]; then \
 	  echo "deb http://$(MIRROR) $(RELEASE)-proposed main restricted" >> chroot/etc/apt/sources.list; \
 	  echo "deb http://$(MIRROR) $(RELEASE)-proposed universe" >> chroot/etc/apt/sources.list; \
+	  echo "$${APTPREF}" > chroot/etc/apt/preferences.d/01proposedkernel; \
 	fi
 	mkdir -p chroot/etc/initramfs-tools/conf.d
 	echo "COMPRESS=lzma" >chroot/etc/initramfs-tools/conf.d/ubuntu-core.conf
-- 
2.7.4





More information about the kernel-team mailing list