Use rabbitmq-components.mk to fetch RabbitMQ components

This commit is contained in:
Jean-Sébastien Pédron 2015-09-24 11:47:26 +02:00 committed by Jean-Sébastien Pédron
parent dcfbd47319
commit 997a6d6c9c
2 changed files with 72 additions and 21 deletions

View File

@ -13,27 +13,6 @@ DEPS += $(SRCDIST_DEPS)
endif
endif
# For RabbitMQ repositories, we want to checkout branches which match
# the parent porject. For instance, if the parent project is on a
# release tag, dependencies must be on the same release tag. If the
# parent project is on a topic branch, dependencies must be on the same
# topic branch or fallback to `stable` or `master` whichever was the
# base of the topic branch.
ifeq ($(wildcard git-revisions.txt),)
ifeq ($(origin current_rmq_ref),undefined)
current_rmq_ref := $(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)
export current_rmq_ref
endif
ifeq ($(origin base_rmq_ref),undefined)
base_rmq_ref := $(shell git merge-base --is-ancestor $$(git merge-base master HEAD) stable && echo stable || echo master)
export base_rmq_ref
endif
endif
dep_rabbit_common = git https://github.com/rabbitmq/rabbitmq-common.git $(current_rmq_ref) $(base_rmq_ref)
dep_rabbitmq_shovel = git https://github.com/rabbitmq/rabbitmq-shovel.git $(current_rmq_ref) $(base_rmq_ref)
define usage_xml_to_erl
$(subst __,_,$(patsubst $(DOCS_DIR)/rabbitmq%.1.xml, src/rabbit_%_usage.erl, $(subst -,_,$(1))))
endef
@ -63,6 +42,7 @@ DEP_PLUGINS = rabbit_common/mk/rabbitmq-run.mk \
ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git
ERLANG_MK_COMMIT = rabbitmq-tmp
include rabbitmq-components.mk
include erlang.mk
# --------------------------------------------------------------------

71
rabbitmq-components.mk Normal file
View File

@ -0,0 +1,71 @@
# For RabbitMQ repositories, we want to checkout branches which match
# the parent project. For instance, if the parent project is on a
# release tag, dependencies must be on the same release tag. If the
# parent project is on a topic branch, dependencies must be on the same
# topic branch or fallback to `stable` or `master` whichever was the
# base of the topic branch.
RABBITMQ_REPO_BASE ?= https://github.com/rabbitmq
dep_amqp_client = git_rmq rabbitmq-erlang-client $(current_rmq_ref) $(base_rmq_ref)
dep_java_client = git_rmq rabbitmq-java-client $(current_rmq_ref) $(base_rmq_ref)
dep_rabbit = git_rmq rabbitmq-server $(current_rmq_ref) $(base_rmq_ref)
dep_rabbit_common = git_rmq rabbitmq-common $(current_rmq_ref) $(base_rmq_ref)
dep_rabbitmq_codegen = git_rmq rabbitmq-codegen $(current_rmq_ref) $(base_rmq_ref)
dep_rabbitmq_shovel = git_rmq rabbitmq-shovel $(current_rmq_ref) $(base_rmq_ref)
ifeq ($(origin current_rmq_ref),undefined)
ifneq ($(wildcard .git),)
current_rmq_ref := $(shell \
git describe --tags --exact-match 2>/dev/null || \
git symbolic-ref -q --short HEAD)
else
current_rmq_ref := master
endif
endif
export current_rmq_ref
ifeq ($(origin base_rmq_ref),undefined)
ifneq ($(wildcard .git),)
base_rmq_ref := $(shell \
(git rev-parse --verify -q stable >/dev/null && \
git merge-base --is-ancestor $$(git merge-base master HEAD) stable && \
echo stable) || \
echo master)
else
base_rmq_ref := master
endif
endif
export base_rmq_ref
dep_rmq_repo = $(if $(dep_$(1)), \
$(RABBITMQ_REPO_BASE)/$(word 2,$(dep_$(1))).git, \
$(pkg_$(1)_repo))
dep_rmq_commits = $(if $(dep_$(1)), \
$(wordlist 3,$(words $(dep_$(1))),$(dep_$(1))), \
$(pkg_$(1)_commit))
define dep_fetch_git_rmq
git clone -q -n -- \
$(call dep_rmq_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1)); \
cd $(DEPS_DIR)/$(call dep_name,$(1)) && ( \
$(foreach ref,$(call dep_rmq_commits,$(1)), \
git checkout -q $(ref) >/dev/null 2>&1 || \
) \
(echo "error: no valid pathspec among: $(call dep_rmq_commits,$(1))" \
1>&2 && false) )
endef
deps:: check-rabbitmq-components.mk
list-deps: check-rabbitmq-components.mk
ifneq ($(PROJECT),rabbit_common)
check-rabbitmq-components.mk:
$(verbose) cmp -s rabbitmq-components.mk \
$(DEPS_DIR)/rabbit_common/mk/rabbitmq-components.mk || \
(echo "error: rabbitmq-components.mk must be updated!" 1>&2; \
false)
else
check-rabbitmq-components.mk:
@:
endif