Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbbell committed Dec 7, 2016
2 parents 25c9e33 + b098ae8 commit 500f1dc
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 27 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
/deps/
/doc/
/ebin/
/hexer*
/logs/
/PACKAGES/
/plugins/
/test/ct.cover.spec
/xrefr
Expand Down
48 changes: 30 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
PROJECT = amqp_client
VERSION ?= $(call get_app_version,src/$(PROJECT).app.src)
ifeq ($(VERSION),)
VERSION = 0.0.0
endif
PROJECT_DESCRIPTION = RabbitMQ AMQP Client
PROJECT_MOD = amqp_client
PROJECT_REGISTERED = amqp_sup

define PROJECT_ENV
[
{prefer_ipv6, false},
{ssl_options, []}
]
endef

# Release artifacts are put in $(PACKAGES_DIR).
PACKAGES_DIR ?= $(abspath PACKAGES)

LOCAL_DEPS = xmerl
DEPS = rabbit_common
TEST_DEPS = rabbitmq_ct_helpers rabbit

Expand Down Expand Up @@ -37,13 +44,13 @@ edoc: doc/overview.edoc

doc/overview.edoc: src/overview.edoc.in
mkdir -p doc
sed -e 's:%%VERSION%%:$(VERSION):g' < $< > $@
sed -e 's:%%VERSION%%:$(PROJECT_VERSION):g' < $< > $@

.PHONY: source-dist clean-source-dist

SOURCE_DIST_BASE ?= $(PROJECT)
SOURCE_DIST_SUFFIXES ?= tar.xz zip
SOURCE_DIST ?= $(PACKAGES_DIR)/$(SOURCE_DIST_BASE)-$(VERSION)-src
SOURCE_DIST ?= $(PACKAGES_DIR)/$(SOURCE_DIST_BASE)-$(PROJECT_VERSION)-src

# The first source distribution file is used by packages: if the archive
# type changes, you must update all packages' Makefile.
Expand All @@ -62,19 +69,27 @@ RSYNC_V = $(RSYNC_V_$(V))
RSYNC_FLAGS += -a $(RSYNC_V) \
--exclude '.sw?' --exclude '.*.sw?' \
--exclude '*.beam' \
--exclude '*.d' \
--exclude '*.pyc' \
--exclude '.git*' \
--exclude '.hg*' \
--exclude '.travis.yml' \
--exclude '.*.plt' \
--exclude '$(notdir $(ERLANG_MK_TMP))' \
--exclude 'ebin' \
--exclude 'erl_crash.dump' \
--exclude 'cover/' \
--exclude 'deps/' \
--exclude 'ebin/' \
--exclude 'erl_crash.dump' \
--exclude '$(notdir $(DEPS_DIR))/' \
--exclude 'doc/' \
--exclude 'hexer*' \
--exclude 'logs/' \
--exclude 'plugins/' \
--exclude '$(notdir $(DIST_DIR))/' \
--exclude 'test' \
--exclude 'xrefr' \
--exclude '/$(notdir $(PACKAGES_DIR))/' \
--exclude '/PACKAGES/' \
--delete \
--delete-excluded

Expand All @@ -99,10 +114,8 @@ ZIP_V = $(ZIP_V_$(V))
$(SOURCE_DIST): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
$(verbose) mkdir -p $(dir $@)
$(gen_verbose) $(RSYNC) $(RSYNC_FLAGS) ./ $@/
$(verbose) sed -E -i.bak \
-e 's/[{]vsn[[:blank:]]*,[^}]+}/{vsn, "$(VERSION)"}/' \
$@/src/$(PROJECT).app.src && \
rm $@/src/$(PROJECT).app.src.bak
$(verbose) echo "$(PROJECT_DESCRIPTION) $(PROJECT_VERSION)" > $@/git-revisions.txt
$(verbose) echo "$(PROJECT) $$(git rev-parse HEAD) $$(git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD)" >> $@/git-revisions.txt
$(verbose) for dep in $$(cat $(ERLANG_MK_RECURSIVE_DEPS_LIST) | grep -v '/$(PROJECT)$$' | LC_COLLATE=C sort); do \
$(RSYNC) $(RSYNC_FLAGS) \
$$dep \
Expand All @@ -115,18 +128,17 @@ $(SOURCE_DIST): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
sed -E -i.bak "s|^[[:blank:]]*include[[:blank:]]+\.\./.*erlang.mk$$|include ../../erlang.mk|" \
$@/deps/$$(basename $$dep)/Makefile && \
rm $@/deps/$$(basename $$dep)/Makefile.bak; \
(cd $$dep; echo "$$(basename "$$dep") $$(git rev-parse HEAD) $$(git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD)") >> $@/git-revisions.txt; \
done
$(verbose) for file in $$(find $@ -name '*.app.src'); do \
sed -E -i.bak -e 's/[{]vsn[[:blank:]]*,[[:blank:]]*""[[:blank:]]*}/{vsn, "$(VERSION)"}/' $$file; \
sed -E -i.bak \
-e 's/[{]vsn[[:blank:]]*,[[:blank:]]*(""|"0.0.0")[[:blank:]]*}/{vsn, "$(PROJECT_VERSION)"}/' \
$$file; \
rm $$file.bak; \
done
$(verbose) echo "$(PROJECT) $$(git rev-parse HEAD) $$(git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD)" > $@/git-revisions.txt
$(verbose) for dep in $$(cat $(ERLANG_MK_RECURSIVE_DEPS_LIST)); do \
(cd $$dep; echo "$$(basename "$$dep") $$(git rev-parse HEAD) $$(git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD)") >> $@/git-revisions.txt; \
done
$(verbose) rm $@/README.in
$(verbose) cp README.in $@/README
$(verbose) cat "$(BUILD_DOC)" >> $@/README
$(verbose) if test "$(BUILD_DOC)"; then cat "$(BUILD_DOC)" >> $@/README; fi

# TODO: Fix file timestamps to have reproducible source archives.
# $(verbose) find $@ -not -name 'git-revisions.txt' -print0 | xargs -0 touch -r $@/git-revisions.txt
Expand Down
21 changes: 21 additions & 0 deletions rabbitmq-components.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ ifeq ($(.DEFAULT_GOAL),)
.DEFAULT_GOAL = all
endif

# PROJECT_VERSION defaults to:
# 1. the version exported by rabbitmq-server-release;
# 2. the version stored in `git-revisions.txt`, if it exists;
# 3. a version based on git-describe(1), if it is a Git clone;
# 4. 0.0.0

PROJECT_VERSION = $(RABBITMQ_VERSION)

ifeq ($(PROJECT_VERSION),)
PROJECT_VERSION := $(shell \
if test -f git-revisions.txt; then \
head -n1 git-revisions.txt | \
awk '{print $$$(words $(PROJECT_DESCRIPTION) version);}'; \
else \
(git describe --dirty --abbrev=7 --tags --always --first-parent \
2>/dev/null || echo rabbitmq_v0_0_0) | \
sed -e 's/^rabbitmq_v//' -e 's/^v//' -e 's/_/./g' -e 's/-/+/' \
-e 's/-/./g'; \
fi)
endif

# --------------------------------------------------------------------
# RabbitMQ components.
# --------------------------------------------------------------------
Expand Down
9 changes: 0 additions & 9 deletions src/amqp_client.app.src

This file was deleted.

0 comments on commit 500f1dc

Please sign in to comment.