introduced add_feature function

The features might get copy-pasted (or even copied-and-pruned)
when initialized; there's an unneccessary duplication of the
function name in the line adding it to FEATURES list, thus
prone to being forgotten and causing some havoc later on.

It was wrong in the first place but tackling this with some
double-colon rules ran into terminality issues, and further
tortures were considered unneccessary.

The current solution isn't perfect (no completely transparent
function name registration upon corresponding target being called)
but at least it is an improvement...
This commit is contained in:
Michael Shigorin 2011-11-16 17:58:42 +02:00
parent 781c98bb3d
commit 9cedefdba9
21 changed files with 24 additions and 21 deletions

3
README
View File

@ -47,8 +47,7 @@ Most docs are in Russian, welcome to learn it or ask for English.
+ законченные блоки функциональности (или наборы таковых) + законченные блоки функциональности (или наборы таковых)
+ описываются в индивидуальных features.in/*/config.mk + описываются в индивидуальных features.in/*/config.mk
+ могут требовать другие фичи, а также субпрофили + могут требовать другие фичи, а также субпрофили
+ при сборке $(BUILDDIR) содержимое указанных в $(FEATURES) фич + при сборке $(BUILDDIR) содержимое фич добавляется в профиль
добавляется в профиль с постобработкой (generate.*)
- списки пакетов (*_LISTS): - списки пакетов (*_LISTS):
+ просьба по возможности избегать дублирования + просьба по возможности избегать дублирования
- индивидуальные пакеты (*_PACKAGES): см. тж. conf.d/README - индивидуальные пакеты (*_PACKAGES): см. тж. conf.d/README

View File

@ -9,5 +9,5 @@
# for somewhat more involved example, see syslinux feature # for somewhat more involved example, see syslinux feature
use/00example: sub/main use/anotherfeature use/00example: sub/main use/anotherfeature
@$(call add,FEATURES,00example) @$(call add_feature)
@$(call add,MAIN_PACKAGES,hello) @$(call add,MAIN_PACKAGES,hello)

View File

@ -7,7 +7,8 @@
в ../Makefile; он может описывать одну или более целей в ../Makefile; он может описывать одну или более целей
вида use/*, дополняющих конфигурацию, и при наличии вида use/*, дополняющих конфигурацию, и при наличии
дополнительных хуков для копирования или generate.* дополнительных хуков для копирования или generate.*
должен добавить имя фичи в $(FEATURES). обязан добавить имя фичи в $(FEATURES), для чего
создана функция add_feature без аргументов.
На этапе генерации сборочного профиля фичи рассматриваются На этапе генерации сборочного профиля фичи рассматриваются
после инициализации профиля (см. ../image.in/) и копирования после инициализации профиля (см. ../image.in/) и копирования

View File

@ -1,2 +1,2 @@
use/build-distro: boot/isolinux use/build-distro: boot/isolinux
@$(call add,FEATURES,build-distro) @$(call add_feature)

View File

@ -1,2 +1,2 @@
use/build-ve: use/build-ve:
@$(call add,FEATURES,build-ve) @$(call add_feature)

View File

@ -1,5 +1,5 @@
use/cleanup: use/cleanup:
@$(call add,FEATURES,cleanup) @$(call add_feature)
use/cleanup/installer: use/cleanup use/cleanup/installer: use/cleanup
@$(call add,CLEANUP_PACKAGES,'installer-*') @$(call add,CLEANUP_PACKAGES,'installer-*')

View File

@ -1,5 +1,5 @@
use/dev: use/dev:
@$(call add,FEATURES,dev) @$(call add_feature)
@$(call add,COMMON_PACKAGES,git-core hasher gear) @$(call add,COMMON_PACKAGES,git-core hasher gear)
use/dev/mkimage: use/dev use/dev/mkimage: use/dev

View File

@ -1,5 +1,5 @@
use/dos: use/syslinux use/dos: use/syslinux
@$(call add,FEATURES,dos) @$(call add_feature)
@$(call add,SYSLINUX_CFG,dos) @$(call add,SYSLINUX_CFG,dos)
@$(call add,SYSLINUX_FILES,/usr/lib/syslinux/memdisk) @$(call add,SYSLINUX_FILES,/usr/lib/syslinux/memdisk)
@$(call add,STAGE1_PACKAGES,make-freedos-floppy glibc-gconv-modules) @$(call add,STAGE1_PACKAGES,make-freedos-floppy glibc-gconv-modules)

View File

@ -1,4 +1,4 @@
use/hdt: use/syslinux use/memtest use/hdt: use/syslinux use/memtest
@$(call add,FEATURES,hdt) @$(call add_feature)
@$(call add,STAGE1_PACKAGES,pciids) @$(call add,STAGE1_PACKAGES,pciids)
@$(call add,SYSLINUX_MODULES,hdt) @$(call add,SYSLINUX_MODULES,hdt)

View File

@ -1,5 +1,5 @@
use/install2: use/stage2 sub/stage2/install2 use/cleanup/installer use/install2: use/stage2 sub/stage2/install2 use/cleanup/installer
@$(call add,FEATURES,install2) @$(call add_feature)
@$(call set,INSTALL2_PACKAGES,installer-distro-$$(INSTALLER)-stage2) @$(call set,INSTALL2_PACKAGES,installer-distro-$$(INSTALLER)-stage2)
@$(call add,INSTALL2_PACKAGES,branding-$$(BRANDING)-alterator) @$(call add,INSTALL2_PACKAGES,branding-$$(BRANDING)-alterator)
@$(call add,MAIN_PACKAGES,branding-$$(BRANDING)-release) @$(call add,MAIN_PACKAGES,branding-$$(BRANDING)-release)

View File

@ -1,3 +1,3 @@
use/isomd5sum: use/isomd5sum:
@$(call add,FEATURES,isomd5sum) @$(call add_feature)
@$(call add,POSTPROCESS_TARGETS,isomd5sum) @$(call add,POSTPROCESS_TARGETS,isomd5sum)

View File

@ -1,5 +1,5 @@
use/live: use/stage2 sub/stage2/live use/live: use/stage2 sub/stage2/live
@$(call add,FEATURES,live) @$(call add_feature)
use/live/base: use/live use/syslinux/ui-menu use/live/base: use/live use/syslinux/ui-menu
@$(call add,LIVE_LISTS,$(call tags,base && (live || network))) @$(call add,LIVE_LISTS,$(call tags,base && (live || network)))

View File

@ -1,4 +1,4 @@
use/lowmem: use/install2 use/lowmem: use/install2
@$(call add,FEATURES,lowmem) @$(call add_feature)
# TODO: http://www.altlinux.org/Branding/slideshow => disable? # TODO: http://www.altlinux.org/Branding/slideshow => disable?
# also installer-feature-rm-slideshow # also installer-feature-rm-slideshow

View File

@ -1,4 +1,4 @@
use/memtest: use/syslinux use/memtest: use/syslinux
@$(call add,FEATURES,memtest) @$(call add_feature)
@$(call add,SYSTEM_PACKAGES,memtest86+) @$(call add,SYSTEM_PACKAGES,memtest86+)
@$(call add,SYSLINUX_CFG,memtest) @$(call add,SYSLINUX_CFG,memtest)

View File

@ -2,7 +2,7 @@ DISTRO_EXTS := .iso
VE_EXTS := .tar .tgz VE_EXTS := .tar .tgz
use/pack: use/pack:
@$(call add,FEATURES,pack) @$(call add_feature)
use/pack/iso: use/pack boot/isolinux use/pack/iso: use/pack boot/isolinux
ifeq (distro,$(IMAGE_CLASS)) ifeq (distro,$(IMAGE_CLASS))

View File

@ -1,4 +1,4 @@
use/repo: use/repo:
@$(call add,FEATURES,repo) @$(call add_feature)
use/repo/main: sub/main use/repo use/repo/main: sub/main use/repo

View File

@ -1,4 +1,4 @@
use/rescue: use/stage2 sub/stage2/rescue use/rescue: use/stage2 sub/stage2/rescue
@$(call add,FEATURES,rescue) @$(call add_feature)
@$(call add,RESCUE_LISTS,$(call tags,base && (rescue || network))) @$(call add,RESCUE_LISTS,$(call tags,base && (rescue || network)))
@$(call add,RESCUE_LISTS,$(call tags,extra network)) @$(call add,RESCUE_LISTS,$(call tags,extra network))

View File

@ -1,6 +1,6 @@
# "1" is not a typo # "1" is not a typo
use/stage2: sub/stage1 use/stage2: sub/stage1
@$(call add,FEATURES,stage2) @$(call add_feature)
@$(call add,STAGE1_PACKAGES,file make-initrd make-initrd-propagator) @$(call add,STAGE1_PACKAGES,file make-initrd make-initrd-propagator)
# NB: sub/stage2 isn't used standalone but rather # NB: sub/stage2 isn't used standalone but rather

View File

@ -1,6 +1,6 @@
# default is plain text prompt # default is plain text prompt
use/syslinux: sub/stage1 use/syslinux: sub/stage1
@$(call add,FEATURES,syslinux) @$(call add_feature)
@$(call add,STAGE1_PACKAGES,syslinux) @$(call add,STAGE1_PACKAGES,syslinux)
# UI is overwritten # UI is overwritten

View File

@ -1,4 +1,4 @@
use/systemd: use/systemd:
@$(call add,FEATURES,systemd) @$(call add_feature)
@$(call add,COMMON_PACKAGES,systemd systemd-units systemd-sysvinit) @$(call add,COMMON_PACKAGES,systemd systemd-units systemd-sysvinit)
@$(call add,COMMON_PACKAGES,installer-feature-systemd-stage3) @$(call add,COMMON_PACKAGES,installer-feature-systemd-stage3)

View File

@ -42,6 +42,9 @@ define log_body
grep -q '^# $@$$' "$(CONFIG)" || printf '# %s\n' '$@' >> "$(CONFIG)"; } grep -q '^# $@$$' "$(CONFIG)" || printf '# %s\n' '$@' >> "$(CONFIG)"; }
endef endef
# in a use/feature/particularly target, we need a "feature" bit
add_feature = $(call add,FEATURES,$(word 2,$(subst /, ,$@)))
# convert tag list into a list of relative package list paths # convert tag list into a list of relative package list paths
# NB: tags can do boolean expressions: (tag1 && !(tag2 || tag3)) # NB: tags can do boolean expressions: (tag1 && !(tag2 || tag3))
tags = $(and $(strip $(1)),$(addprefix tagged/,$(shell echo "$(1)" | bin/tags2lists pkg.in/lists/tagged))) tags = $(and $(strip $(1)),$(addprefix tagged/,$(shell echo "$(1)" | bin/tags2lists pkg.in/lists/tagged)))