diff mbox

[master,branch] deb to snap build script: Enforce kernel version, and several

Message ID 1501084166-15636-2-git-send-email-paolo.pisati@canonical.com
State New
Headers show

Commit Message

Paolo Pisati July 26, 2017, 3:49 p.m. UTC
This series of patches apply to our 'deb to snap' packaging scripts located
here:

git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux-snap/+git/xenial

Every patch applies to a different branch in that tree (see the subject), and
specifically they go to:

"deb to snap build script: Enforce kernel version, and several
other changes"			-> master branch
"UBUNTU-Ubuntu-4.4.0.87.93"	-> pc branch
"UBUNTU: Ubuntu-4.4.0.1065.66"	-> raspi2 branch
"UBUNTU: Ubuntu-4.4.0.1067.60"	-> snapdragon branch
"UBUNTU: Ubuntu-4.4.0.1026.29"	-> aws branch
"UBUNTU: Ubuntu-4.4.0.1022.24"	-> gke branch

The main reason for this pull is to fix the kernel version used to build the
snap, by passing the exact requested version from the consumer snapcraft's yaml
to master/Makefile.

Among the changes in this pull, we have:

-split the PACKAGE argument in KERNEL and PKGS, and made KERNEL a mandatory
 parameter
-introduced a linux-pc-kernel meta pkg for i386 and amd64 pc-kernel variants,
 internally it will be rewritten as linux-signed-image-generic or
 linux-image-generic depending on the target arch
-made the child branches (pc, raspi2, snapdragon, aws and gke) ask for a specific kernel
 version via master/Makefile - that stops us from repackaging the latest kernel
 version available in the archive, no matter the version we really wanted
-stop using the -proposed pocket for the arm kernels
-adjust the kernel version to follow the linux-image packages

There are two fallouts of this change:

1) from now, snapcraft.yaml version field will follow the linux package version:

$ rmadison -s xenial-updates linux-snapdragon
 linux-snapdragon | 4.4.0-1067.72 | xenial-updates/universe | source
 linux-snapdragon | 4.4.0.1067.60 | xenial-updates/universe | arm64

the secondo onei (4.4.0.1067.60), instead of the first one (4.4.0-1067.72)

2) the kernel snap will reflect the change:

$ snap list
...
dragonboard-kernel  4.4.0.1067.60              x1               kernel

Tested by rebuilding all the kernel snaps several times (see the -test snap
packages equivalent in lp), and by rebuilding an -edge pc/raspi2/snapdragon
image, booting it out and competing the initialization.

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
---
 Makefile | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/Makefile b/Makefile
index d21fff1..98c5a48 100644
--- a/Makefile
+++ b/Makefile
@@ -4,15 +4,27 @@  ENV := DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C
 
 MIRROR := ftpmaster.internal/ubuntu
 
+ifeq "$(strip $(KERNEL))" ""
+$(error KERNEL package name is missing, abort)
+endif
+
+# rewriting variables passed from the outside environment doesn't work in LP,
+# so use KERNELDEB as a temporary local variable to hold the kernel pkg name
+KERNELDEB := $(KERNEL)=$(SNAPCRAFT_PROJECT_VERSION)
+
+# linux-pc-image is a meta package used to indicate either
+# linux-signed-image-generic or linux-image-generic, depending on the building
+# architecture (amd64 or i386), it's invalid kernel name for any other arch
+ifneq (,$(findstring linux-pc-image,$(KERNELDEB)))
 ifneq (,$(findstring amd64,$(DPKG_ARCH)))
-PACKAGE ?= linux-signed-generic
+KERNELDEB := $(subst linux-pc-image,linux-signed-image-generic,$(KERNELDEB))
 else ifneq (,$(findstring i386,$(DPKG_ARCH)))
-PACKAGE ?= linux-generic
-else ifneq (,$(findstring armhf,$(DPKG_ARCH)))
-PACKAGE ?= linux-image-raspi2 raspberrypi-wireless-firmware bluez-firmware
-else ifneq (,$(findstring arm64,$(DPKG_ARCH)))
-PACKAGE ?= linux-image-snapdragon linux-firmware-snapdragon
+KERNELDEB := $(subst linux-pc-image,linux-image-generic,$(KERNELDEB))
+else
+$(error linux-pc-image is a meta package only used in i386 or amd64, abort)
 endif
+endif
+
 
 install : KVERS = $(shell ls -1 chroot/boot/vmlinuz-*| tail -1 |sed 's/^.*vmlinuz-//;s/.efi.signed$$//')
 
@@ -30,7 +42,7 @@  all:
 	$(ENV) chroot chroot apt-get -y --allow-unauthenticated install initramfs-tools-ubuntu-core linux-firmware xz-utils
 	mount --bind /proc chroot/proc
 	mount --bind /sys chroot/sys
-	$(ENV) chroot chroot apt-get -y --allow-unauthenticated install $(PACKAGE)
+	$(ENV) chroot chroot apt-get -y --allow-unauthenticated install $(KERNELDEB) $(PKGS)
 	umount chroot/sys
 	umount chroot/proc