From f65a7650c54b4c0fed17877bc47f7bff937291db Mon Sep 17 00:00:00 2001 From: Roman Iten Date: Wed, 22 Aug 2018 11:32:34 +0200 Subject: [PATCH] depot: allow to inject version command Issue #2991 --- tool/depot/extract | 11 ++++++++--- tool/depot/mk/extract.inc | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tool/depot/extract b/tool/depot/extract index f0fc8cec0..eaeba0402 100755 --- a/tool/depot/extract +++ b/tool/depot/extract @@ -39,9 +39,14 @@ define HELP_MESSAGE UPDATE_VERSIONS=1 Automatically increase the version of recipe hash files whenever their respective archive content has changed. The versions are named - after the current date, suffixed with a single - letter to differentiate multiple versions - created on the same day. + after the output of the VERSION_CMD, suffixed + with a single letter in case VERSION_CMD would + 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 diff --git a/tool/depot/mk/extract.inc b/tool/depot/mk/extract.inc index e46b3b270..07f502230 100644 --- a/tool/depot/mk/extract.inc +++ b/tool/depot/mk/extract.inc @@ -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) _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,\ $(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)))))\ $(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