2015-12-01 22:46:32 +08:00
|
|
|
READY_DEPS = $(foreach DEP,\
|
|
|
|
|
$(filter $(RABBITMQ_COMPONENTS),$(DEPS) $(BUILD_DEPS) $(TEST_DEPS)), \
|
|
|
|
|
$(if $(wildcard $(DEPS_DIR)/$(DEP)),$(DEP),))
|
|
|
|
|
|
2018-01-08 18:39:16 +08:00
|
|
|
RELEASED_RMQ_DEPS = $(filter $(RABBITMQ_COMPONENTS),$(DEPS) $(BUILD_DEPS))
|
|
|
|
|
|
2015-12-01 22:46:32 +08:00
|
|
|
.PHONY: update-erlang-mk update-rabbitmq-components.mk
|
|
|
|
|
|
|
|
|
|
update-erlang-mk: erlang-mk
|
|
|
|
|
$(verbose) if test "$(DO_COMMIT)" = 'yes'; then \
|
|
|
|
|
git diff --quiet -- erlang.mk \
|
|
|
|
|
|| git commit -m 'Update erlang.mk' -- erlang.mk; \
|
|
|
|
|
fi
|
|
|
|
|
$(verbose) for repo in $(READY_DEPS:%=$(DEPS_DIR)/%); do \
|
|
|
|
|
! test -f $$repo/erlang.mk \
|
|
|
|
|
|| $(MAKE) -C $$repo erlang-mk; \
|
|
|
|
|
if test "$(DO_COMMIT)" = 'yes'; then \
|
|
|
|
|
(cd $$repo; \
|
|
|
|
|
git diff --quiet -- erlang.mk \
|
|
|
|
|
|| git commit -m 'Update erlang.mk' -- erlang.mk); \
|
|
|
|
|
fi; \
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
update-rabbitmq-components-mk: rabbitmq-components-mk
|
|
|
|
|
$(verbose) for repo in $(READY_DEPS:%=$(DEPS_DIR)/%); do \
|
|
|
|
|
! test -f $$repo/rabbitmq-components.mk \
|
|
|
|
|
|| $(MAKE) -C $$repo rabbitmq-components-mk; \
|
|
|
|
|
done
|
|
|
|
|
|
2016-05-28 19:26:54 +08:00
|
|
|
update-contributor-code-of-conduct:
|
|
|
|
|
$(verbose) for repo in $(READY_DEPS:%=$(DEPS_DIR)/%); do \
|
|
|
|
|
cp $(DEPS_DIR)/rabbit_common/CODE_OF_CONDUCT.md $$repo/CODE_OF_CONDUCT.md; \
|
|
|
|
|
cp $(DEPS_DIR)/rabbit_common/CONTRIBUTING.md $$repo/CONTRIBUTING.md; \
|
|
|
|
|
done
|
|
|
|
|
|
2017-11-07 02:19:09 +08:00
|
|
|
ifdef CREDS
|
|
|
|
|
define replace_aws_creds
|
2017-11-08 17:07:15 +08:00
|
|
|
set -e; \
|
2017-11-07 02:19:09 +08:00
|
|
|
if test -f "$(CREDS)"; then \
|
|
|
|
|
key_id=$(shell travis encrypt --no-interactive \
|
|
|
|
|
"AWS_ACCESS_KEY_ID=$$(awk '/^rabbitmq-s3-access-key-id/ { print $$2; }' < "$(CREDS)")"); \
|
|
|
|
|
access_key=$(shell travis encrypt --no-interactive \
|
|
|
|
|
"AWS_SECRET_ACCESS_KEY=$$(awk '/^rabbitmq-s3-secret-access-key/ { print $$2; }' < "$(CREDS)")"); \
|
|
|
|
|
mv .travis.yml .travis.yml.orig; \
|
|
|
|
|
awk "\
|
|
|
|
|
/^ global:/ { \
|
|
|
|
|
print; \
|
|
|
|
|
print \" - secure: $$key_id\"; \
|
|
|
|
|
print \" - secure: $$access_key\"; \
|
|
|
|
|
next; \
|
|
|
|
|
} \
|
2017-11-07 02:53:07 +08:00
|
|
|
/- secure:/ { next; } \
|
2017-11-07 02:19:09 +08:00
|
|
|
{ print; }" < .travis.yml.orig > .travis.yml; \
|
|
|
|
|
rm -f .travis.yml.orig; \
|
|
|
|
|
else \
|
|
|
|
|
echo " INFO: CREDS file missing; not setting/updating AWS credentials"; \
|
|
|
|
|
fi
|
|
|
|
|
endef
|
|
|
|
|
else
|
|
|
|
|
define replace_aws_creds
|
|
|
|
|
echo " INFO: CREDS not set; not setting/updating AWS credentials"
|
|
|
|
|
endef
|
|
|
|
|
endif
|
|
|
|
|
|
2017-11-04 00:37:05 +08:00
|
|
|
ifeq ($(PROJECT),rabbit_common)
|
|
|
|
|
travis-yml:
|
2017-11-07 02:19:09 +08:00
|
|
|
$(gen_verbose) $(replace_aws_creds)
|
2017-11-04 00:37:05 +08:00
|
|
|
else
|
|
|
|
|
travis-yml:
|
2017-11-07 02:53:07 +08:00
|
|
|
$(gen_verbose) ! test -f .travis.yml || \
|
2017-11-07 19:37:08 +08:00
|
|
|
(grep -E -- '- secure:' .travis.yml || :) > .travis.yml.creds
|
2017-11-07 02:53:07 +08:00
|
|
|
$(verbose) cp -a $(DEPS_DIR)/rabbit_common/.travis.yml .travis.yml.orig
|
|
|
|
|
$(verbose) awk ' \
|
|
|
|
|
/^ global:/ { \
|
|
|
|
|
print; \
|
|
|
|
|
system("test -f .travis.yml.creds && cat .travis.yml.creds"); \
|
|
|
|
|
next; \
|
|
|
|
|
} \
|
|
|
|
|
/- secure:/ { next; } \
|
|
|
|
|
{ print; } \
|
|
|
|
|
' < .travis.yml.orig > .travis.yml
|
|
|
|
|
$(verbose) rm -f .travis.yml.orig .travis.yml.creds
|
2017-11-04 00:37:05 +08:00
|
|
|
$(verbose) set -e; \
|
|
|
|
|
if test -f .travis.yml.patch; then \
|
|
|
|
|
patch -p0 < .travis.yml.patch; \
|
|
|
|
|
rm -f .travis.yml.orig; \
|
|
|
|
|
fi
|
2017-11-07 02:19:09 +08:00
|
|
|
$(verbose) $(replace_aws_creds)
|
2017-11-04 00:37:05 +08:00
|
|
|
ifeq ($(DO_COMMIT),yes)
|
|
|
|
|
$(verbose) git diff --quiet .travis.yml \
|
|
|
|
|
|| git commit -m 'Travis CI: Update config from rabbitmq-common' .travis.yml
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
update-travis-yml: travis-yml
|
|
|
|
|
$(verbose) for repo in $(READY_DEPS:%=$(DEPS_DIR)/%); do \
|
|
|
|
|
! test -f $$repo/rabbitmq-components.mk \
|
|
|
|
|
|| $(MAKE) -C $$repo travis-yml; \
|
|
|
|
|
done
|
|
|
|
|
|
2015-12-01 22:46:32 +08:00
|
|
|
ifneq ($(wildcard .git),)
|
|
|
|
|
|
|
|
|
|
.PHONY: sync-gitremote sync-gituser
|
|
|
|
|
|
|
|
|
|
sync-gitremote: $(READY_DEPS:%=$(DEPS_DIR)/%+sync-gitremote)
|
|
|
|
|
@:
|
|
|
|
|
|
|
|
|
|
%+sync-gitremote:
|
|
|
|
|
$(exec_verbose) cd $* && \
|
|
|
|
|
git remote set-url origin \
|
|
|
|
|
'$(call dep_rmq_repo,$(RABBITMQ_CURRENT_FETCH_URL),$(notdir $*))'
|
|
|
|
|
$(verbose) cd $* && \
|
|
|
|
|
git remote set-url --push origin \
|
|
|
|
|
'$(call dep_rmq_repo,$(RABBITMQ_CURRENT_PUSH_URL),$(notdir $*))'
|
|
|
|
|
|
|
|
|
|
RMQ_GIT_GLOBAL_USER_NAME := $(shell git config --global user.name)
|
|
|
|
|
RMQ_GIT_GLOBAL_USER_EMAIL := $(shell git config --global user.email)
|
|
|
|
|
RMQ_GIT_USER_NAME := $(shell git config user.name)
|
|
|
|
|
RMQ_GIT_USER_EMAIL := $(shell git config user.email)
|
|
|
|
|
|
|
|
|
|
sync-gituser: $(READY_DEPS:%=$(DEPS_DIR)/%+sync-gituser)
|
|
|
|
|
@:
|
|
|
|
|
|
|
|
|
|
%+sync-gituser:
|
|
|
|
|
ifeq ($(RMQ_GIT_USER_NAME),$(RMQ_GIT_GLOBAL_USER_NAME))
|
|
|
|
|
$(exec_verbose) cd $* && git config --unset user.name || :
|
|
|
|
|
else
|
|
|
|
|
$(exec_verbose) cd $* && git config user.name "$(RMQ_GIT_USER_NAME)"
|
|
|
|
|
endif
|
|
|
|
|
ifeq ($(RMQ_GIT_USER_EMAIL),$(RMQ_GIT_GLOBAL_USER_EMAIL))
|
|
|
|
|
$(verbose) cd $* && git config --unset user.email || :
|
|
|
|
|
else
|
|
|
|
|
$(verbose) cd $* && git config user.email "$(RMQ_GIT_USER_EMAIL)"
|
|
|
|
|
endif
|
|
|
|
|
|
2018-01-08 18:39:16 +08:00
|
|
|
.PHONY: show-branch
|
|
|
|
|
|
2016-09-27 20:46:16 +08:00
|
|
|
show-branch: $(READY_DEPS:%=$(DEPS_DIR)/%+show-branch)
|
|
|
|
|
$(verbose) printf '%-34s %s\n' $(PROJECT): "$$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match)"
|
|
|
|
|
|
|
|
|
|
%+show-branch:
|
|
|
|
|
$(verbose) printf '%-34s %s\n' $(notdir $*): "$$(cd $* && (git symbolic-ref -q --short HEAD || git describe --tags --exact-match))"
|
|
|
|
|
|
2018-01-08 18:39:16 +08:00
|
|
|
SINCE_TAG ?= last-release
|
|
|
|
|
COMMITS_LOG_OPTS ?= --oneline --decorate --no-merges
|
|
|
|
|
MARKDOWN ?= no
|
|
|
|
|
|
|
|
|
|
define show_commits_since_tag
|
|
|
|
|
set -e; \
|
|
|
|
|
if test "$1"; then \
|
|
|
|
|
erlang_app=$(notdir $1); \
|
|
|
|
|
repository=$(call rmq_cmp_repo_name,$(notdir $1)); \
|
|
|
|
|
git_dir=-C\ "$1"; \
|
|
|
|
|
else \
|
|
|
|
|
erlang_app=$(PROJECT); \
|
|
|
|
|
repository=$(call rmq_cmp_repo_name,$(PROJECT)); \
|
|
|
|
|
fi; \
|
|
|
|
|
case "$(SINCE_TAG)" in \
|
|
|
|
|
last-release) \
|
|
|
|
|
ref=$$(git $$git_dir describe --abbrev=0 --tags \
|
|
|
|
|
--exclude "*-beta*" \
|
|
|
|
|
--exclude "*_milestone*" \
|
|
|
|
|
--exclude "*[-_]rc*"); \
|
|
|
|
|
;; \
|
|
|
|
|
last-prerelease) \
|
|
|
|
|
ref=$$(git $$git_dir describe --abbrev=0 --tags); \
|
|
|
|
|
;; \
|
|
|
|
|
*) \
|
|
|
|
|
git $$git_dir rev-parse "$(SINCE_TAG)" -- >/dev/null; \
|
|
|
|
|
ref=$(SINCE_TAG); \
|
|
|
|
|
;; \
|
|
|
|
|
esac; \
|
|
|
|
|
commits_count=$$(git $$git_dir log --oneline "$$ref.." | wc -l); \
|
|
|
|
|
if test "$$commits_count" -gt 0; then \
|
|
|
|
|
if test "$(MARKDOWN)" = yes; then \
|
|
|
|
|
printf "\n## [\`$$repository\`](https://github.com/rabbitmq/$$repository)\n\nCommits since \`$$ref\`:\n\n"; \
|
|
|
|
|
git $$git_dir --no-pager log $(COMMITS_LOG_OPTS) \
|
|
|
|
|
--format="format:* %s ([\`%h\`](https://github.com/rabbitmq/$$repository/commit/%H))" \
|
|
|
|
|
"$$ref.."; \
|
|
|
|
|
echo; \
|
|
|
|
|
else \
|
|
|
|
|
echo; \
|
|
|
|
|
echo "# $$repository - Commits since $$ref"; \
|
|
|
|
|
git $$git_dir log $(COMMITS_LOG_OPTS) "$$ref.."; \
|
|
|
|
|
fi; \
|
|
|
|
|
fi
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
.PHONY: commits-since-release
|
|
|
|
|
|
|
|
|
|
commits-since-release: commits-since-release-title \
|
|
|
|
|
$(RELEASED_RMQ_DEPS:%=$(DEPS_DIR)/%+commits-since-release)
|
|
|
|
|
$(verbose) $(call show_commits_since_tag)
|
|
|
|
|
|
|
|
|
|
commits-since-release-title:
|
|
|
|
|
$(verbose) set -e; \
|
|
|
|
|
case "$(SINCE_TAG)" in \
|
|
|
|
|
last-release) \
|
|
|
|
|
ref=$$(git $$git_dir describe --abbrev=0 --tags \
|
|
|
|
|
--exclude "*-beta*" \
|
|
|
|
|
--exclude "*_milestone*" \
|
|
|
|
|
--exclude "*[-_]rc*"); \
|
|
|
|
|
;; \
|
|
|
|
|
last-prerelease) \
|
|
|
|
|
ref=$$(git $$git_dir describe --abbrev=0 --tags); \
|
|
|
|
|
;; \
|
|
|
|
|
*) \
|
|
|
|
|
ref=$(SINCE_TAG); \
|
|
|
|
|
;; \
|
|
|
|
|
esac; \
|
|
|
|
|
version=$$(echo "$$ref" | sed -E \
|
|
|
|
|
-e 's/rabbitmq_v([0-9]+)_([0-9]+)_([0-9]+)/v\1.\2.\3/' \
|
|
|
|
|
-e 's/_milestone/-beta./' \
|
|
|
|
|
-e 's/_rc/-rc./' \
|
|
|
|
|
-e 's/^v//'); \
|
|
|
|
|
echo "# Changes since RabbitMQ $$version"; \
|
|
|
|
|
|
|
|
|
|
%+commits-since-release:
|
|
|
|
|
$(verbose) $(call show_commits_since_tag,$*)
|
|
|
|
|
|
2015-12-01 22:46:32 +08:00
|
|
|
endif # ($(wildcard .git),)
|