image.in: added groups2lists()

NB: PKGDIR might be overridden now so that these functions
can be used within both metaprofile and generated profile
contexts; this isn't clean but I couldn't come up with
anything better so far.
This commit is contained in:
Michael Shigorin 2016-04-07 17:04:49 +03:00
parent 85c1a0f2ea
commit cbbc23edfb

View File

@ -1,5 +1,5 @@
# globals
PKGDIR := $(GLOBAL_BUILDDIR)/pkg
PKGDIR ?= $(GLOBAL_BUILDDIR)/pkg
# duplicated from metaprofile makefiles for the sake of "local" builds
ARCH ?= $(shell arch | sed 's/i686/i586/; s/armv.*/arm/; s/ppc.*/ppc/')
@ -20,6 +20,15 @@ profile = $(addprefix $(PKGDIR)/,$(call rprofile,$(1)))
# map first argument (a function) onto second one (an argument list)
map = $(foreach a,$(2),$(call $(1),$(a)))
# happens at least twice, and variables are the same by design
groups2lists = $(shell $(groups2lists_body))
define groups2lists_body
{ if [ -n "$(THE_GROUPS)$(MAIN_GROUPS)" ]; then \
sed -rn 's,^X-Alterator-PackageList=(.*)$$,\1,p' \
$(call map,group,$(THE_GROUPS) $(MAIN_GROUPS)); \
fi; }
endef
# kernel package list generation; see also #24669
NULL :=
SPACE := $(NULL) # the officially documented way of getting a space