diff options
| author | Jan Lehnardt <jan@apache.org> | 2018-09-20 12:15:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-20 12:15:03 +0200 |
| commit | 7bca962fd98e87a532e6be29a1f4f6caded5beb2 (patch) | |
| tree | 5aacc876d81095379db38e6d1ed349c7e41cf8e0 /Makefile | |
| parent | de0ea9a75216b9cd3d21e05d4eaca548ec17bcf7 (diff) | |
| parent | 52ed7fbf48b953c3cd0dd5c058186a6af01dbc64 (diff) | |
| download | couchdb-7bca962fd98e87a532e6be29a1f4f6caded5beb2.tar.gz | |
Merge branch 'master' into elixir-suite
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 51 |
1 files changed, 42 insertions, 9 deletions
@@ -13,16 +13,49 @@ include version.mk REBAR?=$(shell echo `pwd`/bin/rebar) + +# Handle the following scenarios: +# 1. When building from a tarball, use version.mk. +# 2. When building from a clean release tag (#.#.#), use that tag. +# 3. When building from a clean RC tag (#.#.#-RC#), use JUST the version +# number inside the tarball, but use the full name for the name of the +# tarball itself. +# 4. When not on a clean tag, use version.mk + git sha + dirty status. + +COUCHDB_GIT_SHA=$(git_sha) + IN_RELEASE = $(shell if [ ! -d .git ]; then echo true; fi) ifeq ($(IN_RELEASE), true) + +# 1. Building from tarball, use version.mk. COUCHDB_VERSION = $(vsn_major).$(vsn_minor).$(vsn_patch) + else -RELTAG = $(shell git describe | grep -E '^[0-9]+\.[0-9]\.[0-9]+(-RC[0-9]+)?$$') -ifeq ($(RELTAG),) -COUCHDB_VERSION_SUFFIX = $(shell git rev-parse --short --verify HEAD) + +# Gather some additional information. +# We do it this way so we don't bake shell-isms into Makefile +# to make it easier to port to Windows. I know, I know. -jst +# IN_RC contains the -RCx suffix in the name if present +IN_RC = $(shell git describe --tags --always --first-parent \ + | grep -Eo -- '-RC[0-9]+' 2>/dev/null) +# ON_TAG matches *ONLY* if we are on a release or RC tag +ON_TAG = $(shell git describe --tags --always --first-parent \ + | grep -Eo -- '^[0-9]+\.[0-9]\.[0-9]+(-RC[0-9]+)?$$' 2>/dev/null) +# RELTAG contains the #.#.# from git describe, which might be used +RELTAG = $(shell git describe --tags --always --first-parent \ + | grep -Eo -- '^[0-9]+\.[0-9]\.[0-9]+' 2>/dev/null) +# DIRTY identifies if we're not on a commit +DIRTY = $(shell git describe --dirty | grep -Eo -- '-dirty' 2>/dev/null) +# COUCHDB_GIT_SHA is our current git hash. +COUCHDB_GIT_SHA=$(shell git rev-parse --short --verify HEAD) + +ifeq ($(ON_TAG),) +# 4. Not on a tag. +COUCHDB_VERSION_SUFFIX = $(COUCHDB_GIT_SHA)$(DIRTY) COUCHDB_VERSION = $(vsn_major).$(vsn_minor).$(vsn_patch)-$(COUCHDB_VERSION_SUFFIX) else -COUCHDB_VERSION = $(RELTAG) +# 2 and 3. On a tag. +COUCHDB_VERSION = $(RELTAG)$(DIRTY) endif endif @@ -78,7 +111,7 @@ help: .PHONY: couch # target: couch - Build CouchDB core, use ERL_OPTS to provide custom compiler's options couch: config.erl - @COUCHDB_VERSION=$(COUCHDB_VERSION) $(REBAR) compile $(COMPILE_OPTS) + @COUCHDB_VERSION=$(COUCHDB_VERSION) COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) $(REBAR) compile $(COMPILE_OPTS) @cp src/couch/priv/couchjs bin/ @@ -226,7 +259,7 @@ list-eunit-apps: .PHONY: list-eunit-suites # target: list-eunit-suites - List EUnit target test suites list-eunit-suites: - @find ./src/ -type f -name *_test.erl -o -name *_tests.erl -printf "%f\n" \ + @find ./src/ -type f -name *_test.erl -o -name *_tests.erl -exec basename {} \; \ | cut -d '.' -f -1 \ | sort @@ -234,7 +267,7 @@ list-eunit-suites: .PHONY: list-js-suites # target: list-js-suites - List JavaScript test suites list-js-suites: - @find ./test/javascript/tests/ -type f -name *.js -printf "%f\n" \ + @find ./test/javascript/tests/ -type f -name *.js -exec basename {} \; \ | cut -d '.' -f -1 \ | sort @@ -297,8 +330,8 @@ dist: all @mkdir -p apache-couchdb-$(COUCHDB_VERSION)/share/docs/man @cp src/docs/build/man/apachecouchdb.1 apache-couchdb-$(COUCHDB_VERSION)/share/docs/man/ - @tar czf apache-couchdb-$(COUCHDB_VERSION).tar.gz apache-couchdb-$(COUCHDB_VERSION) - @echo "Done: apache-couchdb-$(COUCHDB_VERSION).tar.gz" + @tar czf apache-couchdb-$(COUCHDB_VERSION)$(IN_RC).tar.gz apache-couchdb-$(COUCHDB_VERSION) + @echo "Done: apache-couchdb-$(COUCHDB_VERSION)$(IN_RC).tar.gz" .PHONY: release |
