From 6f452182fd36a857a4d7cbbae32b93bb76a6a777 Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Thu, 18 Sep 2014 20:08:08 +0400 Subject: [PATCH] fix kpackages() API This function's got its argument order chosen for "aesthetical" reason of $(2) following $(1) in the macros but the logical order is exactly the opposite: we care for kernel flavour much more than for module set (which is dependent upon it). So while silent dropout of kernel-image if KFLAVOURS is set but KMODULES is empty could be fixed by testing for $(2) only, it looks like a good time to fix this discrepancy altogether. --- features.in/kernel/lib/10-kernel.mk | 4 ++-- image.in/functions.mk | 7 ++++--- sub.in/main/Makefile | 4 ++-- sub.in/stage1/Makefile | 6 +++--- sub.in/stage2/Makefile | 4 ++-- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/features.in/kernel/lib/10-kernel.mk b/features.in/kernel/lib/10-kernel.mk index 34dba6e4..436c6a68 100644 --- a/features.in/kernel/lib/10-kernel.mk +++ b/features.in/kernel/lib/10-kernel.mk @@ -2,5 +2,5 @@ # take care for kernel bits DOT_BASE += $(call kpackages, \ - $(THE_KMODULES) $(BASE_KMODULES) $(BASE_KMODULES_REGEXP), \ - $(KFLAVOURS)) + $(KFLAVOURS), \ + $(THE_KMODULES) $(BASE_KMODULES) $(BASE_KMODULES_REGEXP)) diff --git a/image.in/functions.mk b/image.in/functions.mk index 81e91f96..8148c47a 100644 --- a/image.in/functions.mk +++ b/image.in/functions.mk @@ -22,9 +22,10 @@ SPACE := $(NULL) # the officially documented way of getting a space list2re = $(subst $(SPACE),|,$(strip $(1))) -# args: KMODULES, KFLAVOURS -kpackages = $(and $(1),$(2), \ - ^kernel-(image|modules-($(call list2re,$(1))))-($(call list2re,$(2)))$$) +# args: KFLAVOURS, KMODULES +# NB: $(2) could be empty +kpackages = $(and $(1), \ + ^kernel-(image|modules-($(call list2re,$(2))))-($(call list2re,$(1)))$$) # arg: branding subpackages branding = $(and $(1),^branding-$(BRANDING)-($(call list2re,$(1)))$$) diff --git a/sub.in/main/Makefile b/sub.in/main/Makefile index 915f33ac..7b93a962 100644 --- a/sub.in/main/Makefile +++ b/sub.in/main/Makefile @@ -16,11 +16,11 @@ IMAGE_PACKAGES_REGEXP = $(THE_PACKAGES_REGEXP) \ $(BASE_PACKAGES_REGEXP) \ $(MAIN_PACKAGES_REGEXP) \ $(call kpackages, \ + $(KFLAVOURS), \ $(THE_KMODULES) \ $(BASE_KMODULES) \ $(BASE_KMODULES_REGEXP) \ - $(MAIN_KMODULES), \ - $(KFLAVOURS)) + $(MAIN_KMODULES)) IMAGE_PACKAGES = $(call map,list, \ $(THE_LISTS) $(THE_GROUPS) \ diff --git a/sub.in/stage1/Makefile b/sub.in/stage1/Makefile index 5d90cfef..a6589085 100644 --- a/sub.in/stage1/Makefile +++ b/sub.in/stage1/Makefile @@ -26,10 +26,10 @@ STAGE1_KFLAVOUR ?= $(lastword $(KFLAVOURS)) # propagator needed iff stage1 kernel installed (not for e.g. syslinux.iso) ifneq "$(STAGE1_KFLAVOUR)" "" -INFO_STAGE1_KFLAVOUR := $(STAGE1_KFLAVOUR) +GLOBAL_STAGE1_KFLAVOUR := $(STAGE1_KFLAVOUR) CHROOT_PACKAGES_REGEXP := $(call kpackages, \ - $(STAGE1_KMODULES_REGEXP),$(STAGE1_KFLAVOUR)) -ifneq "$(findstring stage2,$(SUBPROFILES))" "" + $(STAGE1_KFLAVOUR),$(STAGE1_KMODULES_REGEXP)) +ifneq "$(findstring stage2,$(SUBPROFILES))" "" ### assumes stage2 ~ propagator PROPAGATOR_VERSION = ALT Linux PROPAGATOR_MAR_MODULES = ./modules PROPAGATOR_INITFS = ./initfs diff --git a/sub.in/stage2/Makefile b/sub.in/stage2/Makefile index b5b7a92e..9fccca9e 100644 --- a/sub.in/stage2/Makefile +++ b/sub.in/stage2/Makefile @@ -34,9 +34,9 @@ endif # need kernel modules only (which require corresponding kernel-image); # these go into work chroot; NB: no vmlinuz there (unless live-install) IMAGE_PACKAGES_REGEXP += $(call kpackages, \ + $(STAGE1_KFLAVOUR), \ $(STAGE1_KMODULES) $(STAGE1_KMODULES_REGEXP) \ - $(STAGE2_KMODULES) $(STAGE2_KMODULES_REGEXP), \ - $(STAGE1_KFLAVOUR)) + $(STAGE2_KMODULES) $(STAGE2_KMODULES_REGEXP)) -include $(sort $(wildcard lib/*.mk))