metadata: fix THE_PACKAGES processing

Actually the issue was worse in general: *_PACKAGES
weren't quoted when put into .base thus resulting
in a potentially broken echo command (silent one).

The macro scheme used was overgeneralized; stuffing
quoting differentiation into it was doable but ugly
(unless one is able to pass an unquoted quote sign
as a function's parameter in some elegant manner),
let's just make it straightforward.
This commit is contained in:
Michael Shigorin 2013-11-25 09:21:26 +04:00
parent f6f7caec30
commit 3c40bb0d46

View File

@ -9,22 +9,25 @@ WHATEVER += metadata
# handle these too
DOT_BASE += $(BASE_PACKAGES_REGEXP)
# args: name, suffix, command
define dump-THEM
if [ -n "$($(1)_$(2))" ]; then echo -e "\n## $(1)_$(2)"; $(3) $($(1)_$(2)); fi;
# args: type, name
define dump
if [ -n "$($(2)_$(1))" ]; then \
echo -e "\n## $(2)_$(1)"; \
case "$(1)" in \
PACKAGES) echo "$($(2)_$(1))";; \
LISTS) cat $($(2)_$(1));; \
esac; \
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/50-metadata.mk"; \
$(foreach p,SYSTEM COMMON THE BASE,$(call dump-PACKAGES,$(p))) \
$(foreach l,THE BASE,$(call dump-LISTS,$(l))) \
echo "## generated by features.in/metadata/lib/50-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; \