depot: allow to inject version command

Issue #2991
This commit is contained in:
Roman Iten 2018-08-22 11:32:34 +02:00 committed by Christian Helmuth
parent 018aebc0c8
commit f65a7650c5
2 changed files with 10 additions and 5 deletions

View File

@ -39,9 +39,14 @@ define HELP_MESSAGE
UPDATE_VERSIONS=1 Automatically increase the version of recipe UPDATE_VERSIONS=1 Automatically increase the version of recipe
hash files whenever their respective archive hash files whenever their respective archive
content has changed. The versions are named content has changed. The versions are named
after the current date, suffixed with a single after the output of the VERSION_CMD, suffixed
letter to differentiate multiple versions with a single letter in case VERSION_CMD would
created on the same day. return the same version the archive already
has.
VERSION_CMD= The script whose output is used in case the
archive version needs to be updated. The default
is to use the current date.
endef endef

View File

@ -138,7 +138,7 @@ suffixed_version = $1$(if $(call suffix_from_list,$2),-$(call suffix_from_list,$
_string_higher_than = $(filter-out $(firstword $(sort $1 $2)),$1) _string_higher_than = $(filter-out $(firstword $(sort $1 $2)),$1)
_higher_string = $(if $(call _string_higher_than,$1,$2),$1,$2) _higher_string = $(if $(call _string_higher_than,$1,$2),$1,$2)
CURRENT_DATE = $(strip $(shell date --iso-8601)) VERSION_CMD ?= $(strip $(shell date --iso-8601))
_version_higher_than_recipe = $(call _string_higher_than,\ _version_higher_than_recipe = $(call _string_higher_than,\
$(call suffixed_version,$1,$2),$(RECIPE_VERSION)) $(call suffixed_version,$1,$2),$(RECIPE_VERSION))
@ -151,7 +151,7 @@ _next_version = $(eval FOUND := $(if $(call _version_higher_than_recipe,$1,$2),\
$(eval FOUND := $(call suffixed_version,$1,$2 $C)))))\ $(eval FOUND := $(call suffixed_version,$1,$2 $C)))))\
$(if $(FOUND),$(FOUND),$(addsuffix -x,$(RECIPE_VERSION))) $(if $(FOUND),$(FOUND),$(addsuffix -x,$(RECIPE_VERSION)))
next_version = $(strip $(call _next_version,$(CURRENT_DATE))) next_version = $(strip $(call _next_version,$(VERSION_CMD)))
# #
# Message presented to the user whenever a recipe hash is out of date # Message presented to the user whenever a recipe hash is out of date