From 9cedefdba9ad33ef69349acfa96b5266841b1953 Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Wed, 16 Nov 2011 17:58:42 +0200 Subject: [PATCH] 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... --- README | 3 +-- features.in/00example/config.mk | 2 +- features.in/README | 3 ++- features.in/build-distro/config.mk | 2 +- features.in/build-ve/config.mk | 2 +- features.in/cleanup/config.mk | 2 +- features.in/dev/config.mk | 2 +- features.in/dos/config.mk | 2 +- features.in/hdt/config.mk | 2 +- features.in/install2/config.mk | 2 +- features.in/isomd5sum/config.mk | 2 +- features.in/live/config.mk | 2 +- features.in/lowmem/config.mk | 2 +- features.in/memtest/config.mk | 2 +- features.in/pack/config.mk | 2 +- features.in/repo/config.mk | 2 +- features.in/rescue/config.mk | 2 +- features.in/stage2/config.mk | 2 +- features.in/syslinux/config.mk | 2 +- features.in/systemd/config.mk | 2 +- lib/functions.mk | 3 +++ 21 files changed, 24 insertions(+), 21 deletions(-) diff --git a/README b/README index 2667eb66..242e9453 100644 --- a/README +++ b/README @@ -47,8 +47,7 @@ Most docs are in Russian, welcome to learn it or ask for English. + законченные блоки функциональности (или наборы таковых) + описываются в индивидуальных features.in/*/config.mk + могут требовать другие фичи, а также субпрофили - + при сборке $(BUILDDIR) содержимое указанных в $(FEATURES) фич - добавляется в профиль с постобработкой (generate.*) + + при сборке $(BUILDDIR) содержимое фич добавляется в профиль - списки пакетов (*_LISTS): + просьба по возможности избегать дублирования - индивидуальные пакеты (*_PACKAGES): см. тж. conf.d/README diff --git a/features.in/00example/config.mk b/features.in/00example/config.mk index 5c478e3c..24e408cb 100644 --- a/features.in/00example/config.mk +++ b/features.in/00example/config.mk @@ -9,5 +9,5 @@ # for somewhat more involved example, see syslinux feature use/00example: sub/main use/anotherfeature - @$(call add,FEATURES,00example) + @$(call add_feature) @$(call add,MAIN_PACKAGES,hello) diff --git a/features.in/README b/features.in/README index 75174e28..afc6f74f 100644 --- a/features.in/README +++ b/features.in/README @@ -7,7 +7,8 @@ в ../Makefile; он может описывать одну или более целей вида use/*, дополняющих конфигурацию, и при наличии дополнительных хуков для копирования или generate.* -должен добавить имя фичи в $(FEATURES). +обязан добавить имя фичи в $(FEATURES), для чего +создана функция add_feature без аргументов. На этапе генерации сборочного профиля фичи рассматриваются после инициализации профиля (см. ../image.in/) и копирования diff --git a/features.in/build-distro/config.mk b/features.in/build-distro/config.mk index e5ba1721..e2cba6d5 100644 --- a/features.in/build-distro/config.mk +++ b/features.in/build-distro/config.mk @@ -1,2 +1,2 @@ use/build-distro: boot/isolinux - @$(call add,FEATURES,build-distro) + @$(call add_feature) diff --git a/features.in/build-ve/config.mk b/features.in/build-ve/config.mk index 1279ca90..72652e2d 100644 --- a/features.in/build-ve/config.mk +++ b/features.in/build-ve/config.mk @@ -1,2 +1,2 @@ use/build-ve: - @$(call add,FEATURES,build-ve) + @$(call add_feature) diff --git a/features.in/cleanup/config.mk b/features.in/cleanup/config.mk index 52a3870d..3ef209b4 100644 --- a/features.in/cleanup/config.mk +++ b/features.in/cleanup/config.mk @@ -1,5 +1,5 @@ use/cleanup: - @$(call add,FEATURES,cleanup) + @$(call add_feature) use/cleanup/installer: use/cleanup @$(call add,CLEANUP_PACKAGES,'installer-*') diff --git a/features.in/dev/config.mk b/features.in/dev/config.mk index 6a154f7b..17f964a0 100644 --- a/features.in/dev/config.mk +++ b/features.in/dev/config.mk @@ -1,5 +1,5 @@ use/dev: - @$(call add,FEATURES,dev) + @$(call add_feature) @$(call add,COMMON_PACKAGES,git-core hasher gear) use/dev/mkimage: use/dev diff --git a/features.in/dos/config.mk b/features.in/dos/config.mk index f6e05b3c..e63c5e24 100644 --- a/features.in/dos/config.mk +++ b/features.in/dos/config.mk @@ -1,5 +1,5 @@ use/dos: use/syslinux - @$(call add,FEATURES,dos) + @$(call add_feature) @$(call add,SYSLINUX_CFG,dos) @$(call add,SYSLINUX_FILES,/usr/lib/syslinux/memdisk) @$(call add,STAGE1_PACKAGES,make-freedos-floppy glibc-gconv-modules) diff --git a/features.in/hdt/config.mk b/features.in/hdt/config.mk index acb9f4d7..616a22d0 100644 --- a/features.in/hdt/config.mk +++ b/features.in/hdt/config.mk @@ -1,4 +1,4 @@ use/hdt: use/syslinux use/memtest - @$(call add,FEATURES,hdt) + @$(call add_feature) @$(call add,STAGE1_PACKAGES,pciids) @$(call add,SYSLINUX_MODULES,hdt) diff --git a/features.in/install2/config.mk b/features.in/install2/config.mk index 435b5f75..411b9e3c 100644 --- a/features.in/install2/config.mk +++ b/features.in/install2/config.mk @@ -1,5 +1,5 @@ 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 add,INSTALL2_PACKAGES,branding-$$(BRANDING)-alterator) @$(call add,MAIN_PACKAGES,branding-$$(BRANDING)-release) diff --git a/features.in/isomd5sum/config.mk b/features.in/isomd5sum/config.mk index f0999e5a..be87053c 100644 --- a/features.in/isomd5sum/config.mk +++ b/features.in/isomd5sum/config.mk @@ -1,3 +1,3 @@ use/isomd5sum: - @$(call add,FEATURES,isomd5sum) + @$(call add_feature) @$(call add,POSTPROCESS_TARGETS,isomd5sum) diff --git a/features.in/live/config.mk b/features.in/live/config.mk index 3bf5016f..c237a551 100644 --- a/features.in/live/config.mk +++ b/features.in/live/config.mk @@ -1,5 +1,5 @@ use/live: use/stage2 sub/stage2/live - @$(call add,FEATURES,live) + @$(call add_feature) use/live/base: use/live use/syslinux/ui-menu @$(call add,LIVE_LISTS,$(call tags,base && (live || network))) diff --git a/features.in/lowmem/config.mk b/features.in/lowmem/config.mk index 32802420..b59199c2 100644 --- a/features.in/lowmem/config.mk +++ b/features.in/lowmem/config.mk @@ -1,4 +1,4 @@ use/lowmem: use/install2 - @$(call add,FEATURES,lowmem) + @$(call add_feature) # TODO: http://www.altlinux.org/Branding/slideshow => disable? # also installer-feature-rm-slideshow diff --git a/features.in/memtest/config.mk b/features.in/memtest/config.mk index 7f11524e..0fa16281 100644 --- a/features.in/memtest/config.mk +++ b/features.in/memtest/config.mk @@ -1,4 +1,4 @@ use/memtest: use/syslinux - @$(call add,FEATURES,memtest) + @$(call add_feature) @$(call add,SYSTEM_PACKAGES,memtest86+) @$(call add,SYSLINUX_CFG,memtest) diff --git a/features.in/pack/config.mk b/features.in/pack/config.mk index ac9cb31c..09047afe 100644 --- a/features.in/pack/config.mk +++ b/features.in/pack/config.mk @@ -2,7 +2,7 @@ DISTRO_EXTS := .iso VE_EXTS := .tar .tgz use/pack: - @$(call add,FEATURES,pack) + @$(call add_feature) use/pack/iso: use/pack boot/isolinux ifeq (distro,$(IMAGE_CLASS)) diff --git a/features.in/repo/config.mk b/features.in/repo/config.mk index e62a1043..8172dc72 100644 --- a/features.in/repo/config.mk +++ b/features.in/repo/config.mk @@ -1,4 +1,4 @@ use/repo: - @$(call add,FEATURES,repo) + @$(call add_feature) use/repo/main: sub/main use/repo diff --git a/features.in/rescue/config.mk b/features.in/rescue/config.mk index 4fc56b9c..78244a2f 100644 --- a/features.in/rescue/config.mk +++ b/features.in/rescue/config.mk @@ -1,4 +1,4 @@ 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,extra network)) diff --git a/features.in/stage2/config.mk b/features.in/stage2/config.mk index b6262175..e931b64d 100644 --- a/features.in/stage2/config.mk +++ b/features.in/stage2/config.mk @@ -1,6 +1,6 @@ # "1" is not a typo use/stage2: sub/stage1 - @$(call add,FEATURES,stage2) + @$(call add_feature) @$(call add,STAGE1_PACKAGES,file make-initrd make-initrd-propagator) # NB: sub/stage2 isn't used standalone but rather diff --git a/features.in/syslinux/config.mk b/features.in/syslinux/config.mk index 29da69b8..31c0c253 100644 --- a/features.in/syslinux/config.mk +++ b/features.in/syslinux/config.mk @@ -1,6 +1,6 @@ # default is plain text prompt use/syslinux: sub/stage1 - @$(call add,FEATURES,syslinux) + @$(call add_feature) @$(call add,STAGE1_PACKAGES,syslinux) # UI is overwritten diff --git a/features.in/systemd/config.mk b/features.in/systemd/config.mk index c4bef76a..3e0888d6 100644 --- a/features.in/systemd/config.mk +++ b/features.in/systemd/config.mk @@ -1,4 +1,4 @@ use/systemd: - @$(call add,FEATURES,systemd) + @$(call add_feature) @$(call add,COMMON_PACKAGES,systemd systemd-units systemd-sysvinit) @$(call add,COMMON_PACKAGES,installer-feature-systemd-stage3) diff --git a/lib/functions.mk b/lib/functions.mk index a7b14124..007f09ba 100644 --- a/lib/functions.mk +++ b/lib/functions.mk @@ -42,6 +42,9 @@ define log_body grep -q '^# $@$$' "$(CONFIG)" || printf '# %s\n' '$@' >> "$(CONFIG)"; } 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 # NB: tags can do boolean expressions: (tag1 && !(tag2 || tag3)) tags = $(and $(strip $(1)),$(addprefix tagged/,$(shell echo "$(1)" | bin/tags2lists pkg.in/lists/tagged)))