You need to sign in or sign up before continuing.
Commit c83cc111 authored by Michael Shigorin's avatar Michael Shigorin

initial kernel and metadata features

This further refines the modular build by making metadata being a clearly separated feature rather than having to rely on runtime tests, and also by moving the code which cares for kernel bits of base installation (.base list) in a feature of its own. There's more to it but let's get the ball rolling first.
parent 90930184
......@@ -16,36 +16,14 @@ BOOT_ABST := $(META_ABSTRACT)
BOOT_TYPE := isolinux
# Metadata/ needed only for installers (and not for e.g. syslinux.iso)
# FIXME: installable live needs it too, don't move to install2 feature
### see also .../pkg.in/lists/Makefile
ifneq (,$(findstring install2,$(FEATURES)))
METADATA = metadata
endif
# see also ../scripts.d/01-isosort; needs mkimage-0.2.2+
MKI_SORTFILE := /tmp/isosort
all: $(GLOBAL_DEBUG) prep copy-subdirs copy-tree run-scripts pack-image \
postprocess $(GLOBAL_CLEAN_WORKDIR)
prep: $(GLOBAL_DEBUG) dot-disk $(METADATA) imagedir
metadata: dot-base
@mkdir -p files/Metadata
@rm -f files/Metadata/pkg-groups.tar
# see also alterator-pkg (backend3/pkg-install); we only tar up what's up to it
@tar -cvf files/Metadata/pkg-groups.tar -C $(PKGDIR) \
$$(echo $(call list,$(MAIN_GROUPS) .base) \
$(call group,$(MAIN_GROUPS)) \
| sed 's,$(PKGDIR)/*,,g')
dot-base:
@p="$(call kpackages,$(THE_KMODULES) $(BASE_KMODULES),$(KFLAVOURS))"; \
echo -e "\n## added by build-distro.mk\n$$p" >> $(call list,.base); \
if [ -n "$$DOT_BASE" ]; then \
echo -e "\n## DOT_BASE\n$$DOT_BASE" >> $(call list,.base); \
fi
prep: $(GLOBAL_DEBUG) dot-disk $(WHATEVER) imagedir
#prep: $(GLOBAL_DEBUG) dot-disk metadata imagedir
dot-disk:
@mkdir -p files/.disk
......
use/install2: use/stage2 sub/stage2/install2 use/cleanup/installer
use/install2: use/stage2 sub/stage2/install2 use/metadata use/cleanup/installer
@$(call add_feature)
@$(call set,INSTALL2_PACKAGES,installer-distro-$$(INSTALLER)-stage2)
@$(call add,INSTALL2_PACKAGES,branding-$$(BRANDING)-alterator)
......
###
use/kernel:
@$(call add_feature)
@$(call set,KFLAVOURS,std-def)
# step 4: build the distribution image
# take care for kernel bits
DOT_BASE += $(call kpackages,$(THE_KMODULES) $(BASE_KMODULES),$(KFLAVOURS))
Эта фича занимается метаданными в составе образов --
в первую очередь инсталяционных и пригодных к установке
"живых".
use/metadata:
@$(call add_feature)
# step 4: build the distribution image
# package lists are needed for installer and live-install images
METADIR := files/Metadata
# preparation targets of ../../build-distro/lib/build-distro.mk
WHATEVER += metadata
# args: name, suffix, command
define dump-THEM
if [ -n "$($(1)_$(2))" ]; then echo -e "\n## $(1)_$(2)"; $(3) $($(1)_$(2)); fi;
endef
dump-PACKAGES = $(call dump-THEM,$(1),PACKAGES,echo)
dump-LISTS = $(call dump-THEM,$(1),LISTS,cat)
# BASE_PACKAGES, BASE_LISTS and whatever else goes into base install;
# thus construct requisite .base packagelist for alterator-pkg
metadata-.base:
@cd $(call list,/); \
{ \
echo "## generated by features.in/metadata/lib/metadata.mk"; \
$(foreach p,SYSTEM COMMON THE BASE,$(call dump-PACKAGES,$(p))) \
$(foreach l,THE BASE,$(call dump-LISTS,$(l))) \
if [ -n "$(DOT_BASE)" ]; then \
echo -e "\n## DOT_BASE\n$(DOT_BASE)"; \
fi; \
} | sed -re '/^[^[:space:]#]/ s/[[:space:]]+/\n/g' > .base
# see also alterator-pkg (backend3/pkg-install);
# we only tar up what's up to it
metadata: metadata-.base
@mkdir -p $(METADIR); \
tar -C $(PKGDIR) -cvf - \
$(call rlist,$(MAIN_GROUPS) .base) \
$(call rgroup,$(MAIN_GROUPS)) \
> $(METADIR)/pkg-groups.tar
......@@ -5,11 +5,13 @@ PKGDIR := $(GLOBAL_BUILDDIR)/pkg
ARCH ?= $(shell arch | sed 's/i686/i586/')
DATE ?= $(shell date +%Y%m%d)
# prefix pkglist name with its directory to form a path
list = $(1:%=$(PKGDIR)/lists/%)
# prefix pkglist name with its directory to form a path (relative/absolute)
rlist = $(1:%=lists/%)
list = $(addprefix $(PKGDIR)/,$(call rlist,$(1)))
# prefix/suffix group name to form a path
group = $(1:%=$(PKGDIR)/groups/%.directory)
# prefix/suffix group name to form a path (relative/absolute)
rgroup = $(1:%=groups/%.directory)
group = $(addprefix $(PKGDIR)/,$(call rgroup,$(1)))
# map first argument (a function) onto second one (an argument list)
map = $(foreach a,$(2),$(call $(1),$(a)))
......
......@@ -23,8 +23,7 @@ distro/.init: profile/bare
# NB: the last flavour in KFLAVOURS gets to be the default one;
# the kernel packages regexp evaluation has to take place at build stage
distro/.base: distro/.init
@$(call set,KFLAVOURS,std-def)
distro/.base: distro/.init use/kernel
@$(call set,META_SYSTEM_ID,LINUX)
@$(call set,META_VOL_ID,ALT Linux $(ARCH))
@$(call set,META_VOL_SET,ALT Linux)
......
......@@ -18,13 +18,6 @@ include $(BUILDDIR)/distcfg.mk
SUFFIX := pkg/lists
TARGET := $(BUILDDIR)/$(SUFFIX)
# Metadata/ needed only for installers (and not for e.g. syslinux.iso)
# FIXME: installable live needs it too, don't move to install2 feature
### see also .../features.in/build-distro/lib/build-distro.mk
ifneq (,$(findstring install2,$(FEATURES)))
DOTBASE := dot-base
endif
all: $(TARGET) $(GLOBAL_DEBUG) $(DOTBASE) copy-lists copy-groups
@if type -t git >&/dev/null && cd $(TARGET); then \
if [ -n "`git status -s`" ]; then \
......@@ -47,23 +40,6 @@ copy-groups:
cp -at $(TARGET) -- $(THE_GROUPS) $(MAIN_GROUPS); \
fi
# args: name, suffix, command
define dump-THEM
if [ -n "$($(1)_$(2))" ]; then echo -e "\n## $(1)_$(2)"; $(3) $($(1)_$(2)); fi;
endef
dump-PACKAGES = $(call dump-THEM,$(1),PACKAGES,echo)
dump-LISTS = $(call dump-THEM,$(1),LISTS,cat)
# BASE_PACKAGES, BASE_LISTS and whatever else goes into base install
dot-base:
@# construct .base packagelist for alterator-pkg
@{ \
echo "## generated by pkg.in/lists/Makefile"; \
$(foreach p,SYSTEM COMMON THE BASE,$(call dump-PACKAGES,$(p))) \
$(foreach l,THE BASE,$(call dump-LISTS,$(l))) \
} | sed -re '/^[^[:space:]#]/ s/[[:space:]]+/\n/g' >$(TARGET)/.base
# do beforehand as foreach gets expanded before recipe execution
$(TARGET):
@mkdir -p $(TARGET)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment