diff mbox

deb to snap build script: Enforce kernel version, and several other changes

Message ID 1500387611-17438-1-git-send-email-paolo.pisati@canonical.com
State New
Headers show

Commit Message

Paolo Pisati July 18, 2017, 2:20 p.m. UTC
Among which:

-split the PACKAGE argument in KERNEL and PKGS
-make KERNEL a mandatory parameter
-introduce a linux-pc-kernel meta pkg for i386 and amd64 pc-kernel variants

After this patch is applied to master/Makefile, all the child branches (pc, rpi2
and snapdragon) will break - i'm sending a subsequent patch for each of these to
take care of the necessary changes.

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

Comments

Stefan Bader July 21, 2017, 7:56 a.m. UTC | #1
On 18.07.2017 16:20, Paolo Pisati wrote:
> Among which:
> 
> -split the PACKAGE argument in KERNEL and PKGS
> -make KERNEL a mandatory parameter
> -introduce a linux-pc-kernel meta pkg for i386 and amd64 pc-kernel variants
> 
> After this patch is applied to master/Makefile, all the child branches (pc, rpi2
> and snapdragon) will break - i'm sending a subsequent patch for each of these to
> take care of the necessary changes.
> 
> Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
> ---

I have a vague feeling where this should go to but with all the trees we are now
juggling around I suspect it would help you to get some attention if there was a
bit more explanation...

-Stefan

>  Makefile | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
> 
> 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
>  
>
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