summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Cottlehuber <dch@apache.org>2018-12-03 15:35:37 +0000
committerJoan Touzet <joant@atypical.net>2020-01-17 14:52:00 -0500
commit38050b3f6a741bcf8bf757027187ce4da0dcea8a (patch)
tree62f91fc9d242bb359f79977fff635c1108f71698
parent39c2b976afb2bec1ea9e818e5aa5d3d571bf7305 (diff)
downloadcouchdb-38050b3f6a741bcf8bf757027187ce4da0dcea8a.tar.gz
build: stop propagating RC tags into erlang apps
This ensures that the only place an RC tag is visible is in the final tarball. To ensure we can identify CouchDB versions in the wild, each OTP app has the original git sha placed in the `{id, :hash}` field.
-rw-r--r--Makefile28
-rw-r--r--Makefile.win28
-rwxr-xr-xbuild-aux/couchdb-build-release.sh32
-rw-r--r--src/couch/src/couch.app.src2
-rw-r--r--src/couch_event/src/couch_event.app.src2
-rw-r--r--src/couch_log/src/couch_log.app.src2
-rw-r--r--src/couch_peruser/src/couch_peruser.app.src2
-rw-r--r--src/couch_plugins/src/couch_plugins.app.src2
-rw-r--r--src/couch_pse_tests/src/couch_pse_tests.app.src2
-rw-r--r--src/couch_replicator/src/couch_replicator.app.src2
-rw-r--r--src/couch_stats/src/couch_stats.app.src2
-rw-r--r--src/couch_tests/src/couch_tests.app.src2
-rw-r--r--src/ddoc_cache/src/ddoc_cache.app.src2
-rw-r--r--src/global_changes/src/global_changes.app.src2
-rw-r--r--src/mango/src/mango.app.src2
15 files changed, 69 insertions, 43 deletions
diff --git a/Makefile b/Makefile
index 8ffdba384..31f17759e 100644
--- a/Makefile
+++ b/Makefile
@@ -45,13 +45,13 @@ IN_RC = $(shell git describe --tags --always --first-parent \
# 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 \
+# REL_TAG contains the #.#.# from git describe, which might be used
+REL_TAG = $(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)
+COUCHDB_GIT_SHA=$(shell git rev-parse --short=7 --verify HEAD)
ifeq ($(ON_TAG),)
# 4. Not on a tag.
@@ -59,7 +59,7 @@ COUCHDB_VERSION_SUFFIX = $(COUCHDB_GIT_SHA)$(DIRTY)
COUCHDB_VERSION = $(vsn_major).$(vsn_minor).$(vsn_patch)-$(COUCHDB_VERSION_SUFFIX)
else
# 2 and 3. On a tag.
-COUCHDB_VERSION = $(RELTAG)$(DIRTY)
+COUCHDB_VERSION = $(REL_TAG)$(DIRTY)
endif
endif
@@ -67,6 +67,8 @@ endif
comma:= ,
empty:=
space:= $(empty) $(empty)
+# the version string that will be replaced in all OTP apps later on
+SUB_VSN={vsn, \"${COUCHDB_VERSION}\"},{id, \"${COUCHDB_GIT_SHA}${DIRTY}\"}
DESTDIR=
@@ -104,6 +106,17 @@ TEST_OPTS="-c 'startup_jitter=0' -c 'default_security=admin_local'"
# target: all - Build everything
all: couch fauxton docs
+# target: derived - display all derived parameters used during build
+derived:
+ @echo "COUCHDB_GIT_SHA: $(COUCHDB_GIT_SHA)"
+ @echo "COUCHDB_VERSION: $(COUCHDB_VERSION)"
+ @echo "COUCHDB_VERSION_SUFFIX: $(COUCHDB_VERSION_SUFFIX)"
+ @echo "DIRTY: $(DIRTY)"
+ @echo "IN_RC: $(IN_RC)"
+ @echo "IN_RELEASE: $(IN_RELEASE)"
+ @echo "ON_TAG: $(ON_TAG)"
+ @echo "REL_TAG: $(REL_TAG)"
+ @echo "SUB_VSN: $(SUB_VSN)"
.PHONY: help
# target: help - Print this help
@@ -121,10 +134,13 @@ help:
.PHONY: couch
# target: couch - Build CouchDB core, use ERL_OPTS to provide custom compiler's options
-couch: config.erl
+couch: config.erl derived set_otp_vsn
@COUCHDB_VERSION=$(COUCHDB_VERSION) COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) $(REBAR) compile $(COMPILE_OPTS)
@cp src/couch/priv/couchjs bin/
+# target: set_otp_vsn - ensure that vsn field in OTP app is set appropriately
+set_otp_vsn:
+ @sed -i '' -e "s/{vsn, git}/${SUB_VSN}/" $(shell find ./src -type f -name \*.app.src)
.PHONY: docs
# target: docs - Build documentation
@@ -384,7 +400,7 @@ introspect:
.PHONY: dist
# target: dist - Make release tarball
dist: all
- @./build-aux/couchdb-build-release.sh $(COUCHDB_VERSION)
+ ./build-aux/couchdb-build-release.sh $(COUCHDB_VERSION)
@cp -r share/www apache-couchdb-$(COUCHDB_VERSION)/share/
@mkdir -p apache-couchdb-$(COUCHDB_VERSION)/share/docs/html
diff --git a/Makefile.win b/Makefile.win
index ee314059d..f1b1226e2 100644
--- a/Makefile.win
+++ b/Makefile.win
@@ -48,8 +48,8 @@ IN_RC = $(shell git describe --tags --always --first-parent \
# 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>nul)
-# RELTAG contains the #.#.# from git describe, which might be used
-RELTAG = $(shell git describe --tags --always --first-parent \
+# REL_TAG contains the #.#.# from git describe, which might be used
+REL_TAG = $(shell git describe --tags --always --first-parent \
| grep -Eo -- '^[0-9]+\.[0-9]\.[0-9]+' 2>nul)
# DIRTY identifies if we're not on a commit
DIRTY = $(shell git describe --dirty | grep -Eo -- '-dirty' 2>nul)
@@ -60,7 +60,7 @@ COUCHDB_VERSION_SUFFIX = $(COUCHDB_GIT_SHA)$(DIRTY)
COUCHDB_VERSION = $(vsn_major).$(vsn_minor).$(vsn_patch)-$(COUCHDB_VERSION_SUFFIX)
else
# 2 and 3. On a tag.
-COUCHDB_VERSION = $(RELTAG)$(DIRTY)
+COUCHDB_VERSION = $(REL_TAG)$(DIRTY)
endif
endif
@@ -68,6 +68,8 @@ endif
comma:= ,
empty:=
space:= $(empty) $(empty)
+# the version string that will be replaced in all OTP apps later on
+SUB_VSN={vsn, \"${COUCHDB_VERSION}\"},{id, \"${COUCHDB_GIT_SHA}${DIRTY}\"}
DESTDIR=
@@ -92,6 +94,17 @@ EXUNIT_OPTS=$(subst $(comma),$(space),$(tests))
# target: all - Build everything
all: couch fauxton docs
+# target: derived - display all derived parameters used during build
+derived:
+ @echo "COUCHDB_GIT_SHA: ${COUCHDB_GIT_SHA}"
+ @echo "COUCHDB_VERSION: ${COUCHDB_VERSION}"
+ @echo "COUCHDB_VERSION_SUFFIX: ${COUCHDB_VERSION_SUFFIX}"
+ @echo "DIRTY: ${DIRTY}"
+ @echo "IN_RC: ${IN_RC}"
+ @echo "IN_RELEASE: ${IN_RELEASE}"
+ @echo "ON_TAG: ${ON_TAG}"
+ @echo "REL_TAG: ${REL_TAG}"
+ @echo "SUB_VSN: ${SUB_VSN}"
################################################################################
# Building
@@ -100,10 +113,13 @@ all: couch fauxton docs
.PHONY: couch
# target: couch - Build CouchDB core
-couch: config.erl
+couch: config.erl derived set_otp_vsn
@set COUCHDB_VERSION=$(COUCHDB_VERSION) && set COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) && $(REBAR) compile
@copy src\couch\priv\couchjs.exe bin
+# target: set_otp_vsn - ensure that vsn field in OTP app is set appropriately
+set_otp_vsn:
+ @sed -i '' -e "s/{vsn, git}/${SUB_VSN}/" $(shell find ./src -type f -name \*.app.src)
.PHONY: docs
# target: docs - Build documentation
@@ -332,8 +348,8 @@ dist: all
@mkdir apache-couchdb-$(COUCHDB_VERSION)\share\docs\man
@copy 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
diff --git a/build-aux/couchdb-build-release.sh b/build-aux/couchdb-build-release.sh
index 2d219e5e4..109fe0982 100755
--- a/build-aux/couchdb-build-release.sh
+++ b/build-aux/couchdb-build-release.sh
@@ -9,27 +9,21 @@ fi
echo "Building Apache CouchDB $VERSION"
-RELDIR=apache-couchdb-$VERSION
+REL_DIR=apache-couchdb-$VERSION
# make release dir
-rm -rf $RELDIR
-mkdir $RELDIR
-
-CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
+rm -rf $REL_DIR
+mkdir $REL_DIR
# copy sources over
-git archive $CURRENT_BRANCH | tar -xC $RELDIR/ -f -
+git archive HEAD | tar -xC $REL_DIR/ -f -
cd src/
for repo in *; do
cd $repo
if [ -d ".git" ]; then
- mkdir -p ../../$RELDIR/src/$repo
- git_ish=`git rev-parse --short HEAD`
- git archive $git_ish | tar --exclude '*do_not_compile.erl' -xC ../../$RELDIR/src/$repo/ -f -
+ mkdir -p ../../$REL_DIR/src/$repo
+ git archive HEAD | tar --exclude '*do_not_compile.erl' -xC ../../$REL_DIR/src/$repo/ -f -
fi
- set +e
- grep -rl '{vsn, git}' ../../$RELDIR/src/$repo/ | xargs sed -ie "s/{vsn, git}/{vsn, \"`git describe --always --tags`\"}/" 2> /dev/null
- set -e
cd ..
done
@@ -38,8 +32,8 @@ cd ..
if test -e .git; then
# save git sha in version.mk
- git_sha=`git rev-parse --short HEAD`
- echo "git_sha=$git_sha" >> $RELDIR/version.mk
+ git_sha=`git rev-parse --short=7 HEAD`
+ echo "git_sha=$git_sha" >> $REL_DIR/version.mk
# create CONTRIBUTORS file
OS=`uname -s`
case "$OS" in
@@ -51,14 +45,14 @@ if test -e .git; then
;;
esac
- sed -e "/^#.*/d" CONTRIBUTORS.in > $RELDIR/CONTRIBUTORS
+ sed -e "/^#.*/d" CONTRIBUTORS.in > $REL_DIR/CONTRIBUTORS
CONTRIB_EMAIL_SED_COMMAND="s/^[[:blank:]]{5}[[:digit:]]+[[:blank:]]/ * /"
git shortlog -se 6c976bd..HEAD \
| grep -v @apache.org \
- | sed $SED_ERE_FLAG -e "$CONTRIB_EMAIL_SED_COMMAND" >> $RELDIR/CONTRIBUTORS
- echo "" >> $RELDIR/CONTRIBUTORS # simplest portable newline
- echo "For a list of authors see the \`AUTHORS\` file." >> $RELDIR/CONTRIBUTORS
+ | sed $SED_ERE_FLAG -e "$CONTRIB_EMAIL_SED_COMMAND" >> $REL_DIR/CONTRIBUTORS
+ echo "" >> $REL_DIR/CONTRIBUTORS # simplest portable newline
+ echo "For a list of authors see the \`AUTHORS\` file." >> $REL_DIR/CONTRIBUTORS
fi
# copy our rebar
-cp bin/rebar $RELDIR/bin/rebar
+cp bin/rebar $REL_DIR/bin/rebar
diff --git a/src/couch/src/couch.app.src b/src/couch/src/couch.app.src
index 12ec29e12..837106a75 100644
--- a/src/couch/src/couch.app.src
+++ b/src/couch/src/couch.app.src
@@ -12,7 +12,7 @@
{application, couch, [
{description, "Apache CouchDB"},
- {vsn, git},
+ {vsn, "2.3.0-f18d602"},{id, "f18d602"},
{registered, [
couch_db_update,
couch_db_update_notifier_sup,
diff --git a/src/couch_event/src/couch_event.app.src b/src/couch_event/src/couch_event.app.src
index b2ac917b9..b5a9c00f6 100644
--- a/src/couch_event/src/couch_event.app.src
+++ b/src/couch_event/src/couch_event.app.src
@@ -12,7 +12,7 @@
{application, couch_event, [
{description, "Event notification system for Apache CouchDB"},
- {vsn, git},
+ {vsn, "2.3.0-f18d602"},{id, "f18d602"},
{registered, [
couch_event_sup,
couch_event_server
diff --git a/src/couch_log/src/couch_log.app.src b/src/couch_log/src/couch_log.app.src
index 50adfe646..eb0a913ae 100644
--- a/src/couch_log/src/couch_log.app.src
+++ b/src/couch_log/src/couch_log.app.src
@@ -12,7 +12,7 @@
{application, couch_log, [
{description, "CouchDB Log API"},
- {vsn, git},
+ {vsn, "2.3.0-f18d602"},{id, "f18d602"},
{registered, [couch_log_sup]},
{applications, [kernel, stdlib, config]},
{mod, {couch_log_app, []}}
diff --git a/src/couch_peruser/src/couch_peruser.app.src b/src/couch_peruser/src/couch_peruser.app.src
index 6cfaf4421..f20b2b5cf 100644
--- a/src/couch_peruser/src/couch_peruser.app.src
+++ b/src/couch_peruser/src/couch_peruser.app.src
@@ -12,7 +12,7 @@
{application, couch_peruser, [
{description, "couch_peruser - maintains per-user databases in CouchDB"},
- {vsn, git},
+ {vsn, "2.3.0-f18d602"},{id, "f18d602"},
{registered, [couch_peruser, couch_peruser_sup]},
{applications, [kernel, stdlib, config, couch, fabric, mem3]},
{mod, {couch_peruser_app, []}},
diff --git a/src/couch_plugins/src/couch_plugins.app.src b/src/couch_plugins/src/couch_plugins.app.src
index 07d6b14d6..de544544a 100644
--- a/src/couch_plugins/src/couch_plugins.app.src
+++ b/src/couch_plugins/src/couch_plugins.app.src
@@ -12,7 +12,7 @@
{application, couch_plugins,
[
{description, "A CouchDB Plugin Installer"},
- {vsn, git},
+ {vsn, "2.3.0-f18d602"},{id, "f18d602"},
{registered, []},
{applications, [
kernel,
diff --git a/src/couch_pse_tests/src/couch_pse_tests.app.src b/src/couch_pse_tests/src/couch_pse_tests.app.src
index 83f3875a0..9b128ef82 100644
--- a/src/couch_pse_tests/src/couch_pse_tests.app.src
+++ b/src/couch_pse_tests/src/couch_pse_tests.app.src
@@ -12,7 +12,7 @@
{application, couch_pse_tests, [
{description, "Apache CouchDB Pluggable Storage Engine Test Suite"},
- {vsn, git},
+ {vsn, "2.3.0-f18d602"},{id, "f18d602"},
{applications, [
kernel,
stdlib
diff --git a/src/couch_replicator/src/couch_replicator.app.src b/src/couch_replicator/src/couch_replicator.app.src
index 2e0e191d3..11861c6b7 100644
--- a/src/couch_replicator/src/couch_replicator.app.src
+++ b/src/couch_replicator/src/couch_replicator.app.src
@@ -12,7 +12,7 @@
{application, couch_replicator, [
{description, "CouchDB replicator"},
- {vsn, git},
+ {vsn, "2.3.0-f18d602"},{id, "f18d602"},
{mod, {couch_replicator_app, []}},
{registered, [
couch_replicator_sup,
diff --git a/src/couch_stats/src/couch_stats.app.src b/src/couch_stats/src/couch_stats.app.src
index 990f8de62..d8f91a80f 100644
--- a/src/couch_stats/src/couch_stats.app.src
+++ b/src/couch_stats/src/couch_stats.app.src
@@ -12,7 +12,7 @@
{application, couch_stats, [
{description, "Simple statistics collection"},
- {vsn, git},
+ {vsn, "2.3.0-f18d602"},{id, "f18d602"},
{registered, [couch_stats_aggregator, couch_stats_process_tracker]},
{applications, [kernel, stdlib, folsom]},
{mod, {couch_stats_app, []}},
diff --git a/src/couch_tests/src/couch_tests.app.src b/src/couch_tests/src/couch_tests.app.src
index ea243eba0..3eb5c47d0 100644
--- a/src/couch_tests/src/couch_tests.app.src
+++ b/src/couch_tests/src/couch_tests.app.src
@@ -12,7 +12,7 @@
{application, couch_tests, [
{description, "Testing infrastructure for Apache CouchDB"},
- {vsn, git},
+ {vsn, "2.3.0-f18d602"},{id, "f18d602"},
{registered, []},
{applications, [kernel, stdlib]}
]}.
diff --git a/src/ddoc_cache/src/ddoc_cache.app.src b/src/ddoc_cache/src/ddoc_cache.app.src
index faacdf570..3f1d03393 100644
--- a/src/ddoc_cache/src/ddoc_cache.app.src
+++ b/src/ddoc_cache/src/ddoc_cache.app.src
@@ -12,7 +12,7 @@
{application, ddoc_cache, [
{description, "Design Document Cache"},
- {vsn, git},
+ {vsn, "2.3.0-f18d602"},{id, "f18d602"},
{registered, [
ddoc_cache_lru,
ddoc_cache_opener
diff --git a/src/global_changes/src/global_changes.app.src b/src/global_changes/src/global_changes.app.src
index a1dc2f38b..252d15477 100644
--- a/src/global_changes/src/global_changes.app.src
+++ b/src/global_changes/src/global_changes.app.src
@@ -12,7 +12,7 @@
{application, global_changes, [
{description, "_changes-like feeds for multiple DBs"},
- {vsn, git},
+ {vsn, "2.3.0-f18d602"},{id, "f18d602"},
{registered, [global_changes_config_listener, global_changes_server]},
{applications, [
kernel,
diff --git a/src/mango/src/mango.app.src b/src/mango/src/mango.app.src
index a63f036e0..de77181fe 100644
--- a/src/mango/src/mango.app.src
+++ b/src/mango/src/mango.app.src
@@ -12,7 +12,7 @@
{application, mango, [
{description, "MongoDB API compatibility layer for CouchDB"},
- {vsn, git},
+ {vsn, "2.3.0-f18d602"},{id, "f18d602"},
{registered, []},
{applications, [
kernel,