diff options
Diffstat (limited to 'rules/post/ptxd_make_collection.make')
-rw-r--r-- | rules/post/ptxd_make_collection.make | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/rules/post/ptxd_make_collection.make b/rules/post/ptxd_make_collection.make index 4b2a55997..c49bae88e 100644 --- a/rules/post/ptxd_make_collection.make +++ b/rules/post/ptxd_make_collection.make @@ -8,6 +8,36 @@ # see the README file. # -ptx/collection = $(PACKAGES-y) $(filter $(foreach PKG,$(call ptx/force-shell, sed -n 's/^PTXCONF_\([^_][^=]*\)=y$$/\1/p' "$(strip $(1))"),$(PTX_MAP_TO_package_$(PKG))), $(PACKAGES-m)) +# calculate a unique temporary file name +define _ptx_collection_mangle +$(PTXDIST_TEMPDIR)/.$(subst /,-,$(subst $(PTXDIST_WORKSPACE)/,,$(strip $(1)))) +endef +# generate the actual package list +define _ptx_collection_do +$(PACKAGES-y) $(filter $(foreach PKG,$(call ptx/force-shell, sed -n 's/^PTXCONF_\([^_][^=]*\)=y$$/\1/p' "$(strip $(1))"),$(PTX_MAP_TO_package_$(PKG))), $(PACKAGES-m)) +endef +# mark the collection for verification and save the package list +define _ptx_collection_write +$(eval ACTIVE_COLLECTIONS += $(1)) +$(file >$(2),_pkg := $(3)) +$(3) +endef +# load the package list if available, otherwise generate it +define _ptx_collection_once +$(if $(wildcard $(2)),$(eval include $(2))$(_pkg),$(call _ptx_collection_write,$(1),$(2),$(call _ptx_collection_do,$(1)))) +endef +define _ptx_collection +$(call _ptx_collection_once,$(1),$(call _ptx_collection_mangle,$(1))) +endef + +ptx/collection = $(strip $(call _ptx_collection,$(strip $(1)))) + +PHONY += ptx-validate-collections +$(STATEDIR)/virtual-host-tools.install: | ptx-validate-collections + +ptx-validate-collections: + @$(ptx/env) \ + ptx_collections="$(ACTIVE_COLLECTIONS)" \ + ptxd_make_validate_collection # vim: syntax=make |