From 14dfe034265fb8bc13d2c2b9935f4cf15394ded4 Mon Sep 17 00:00:00 2001 From: spring2maz Date: Fri, 30 Nov 2018 10:22:18 +0100 Subject: [PATCH 1/2] Use git tag for app vsn --- Makefile | 1 - erlang.mk | 2 +- src/emqx.app.src | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e815e0756..695cc6871 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,6 @@ PROJECT = emqx PROJECT_DESCRIPTION = EMQ X Broker -PROJECT_VERSION = 3.0.0 DEPS = jsx gproc gen_rpc ekka esockd cowboy clique diff --git a/erlang.mk b/erlang.mk index f38d22653..c5d4b4f7f 100644 --- a/erlang.mk +++ b/erlang.mk @@ -1186,7 +1186,7 @@ else fi $(appsrc_verbose) cat src/$(PROJECT).app.src \ | sed "s/{[[:space:]]*modules[[:space:]]*,[[:space:]]*\[\]}/{modules, \[$(call comma_list,$(MODULES))\]}/" \ - | sed "s/{id,[[:space:]]*\"git\"}/{id, \"$(subst /,\/,$(GITDESCRIBE))\"}/" \ + | sed "s/{vsn,[[:space:]]*\"git\"}/{vsn, \"$(subst /,\/,$(GITDESCRIBE))\"}/" \ > ebin/$(PROJECT).app endif diff --git a/src/emqx.app.src b/src/emqx.app.src index 1bca0118b..ce643634e 100644 --- a/src/emqx.app.src +++ b/src/emqx.app.src @@ -1,6 +1,6 @@ {application,emqx, [{description,"EMQ X Broker"}, - {vsn,"3.0.0"}, + {vsn,"git"}, {modules,[]}, {registered,[emqx_sup]}, {applications,[kernel,stdlib,jsx,gproc,gen_rpc,esockd, From b87e72861a73476614cc6c9181cb64e0bd2ed823 Mon Sep 17 00:00:00 2001 From: spring2maz Date: Fri, 30 Nov 2018 11:02:02 +0100 Subject: [PATCH 2/2] Fallback to git clone -n then checkout if git version is older than 1.8 --- Makefile | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 695cc6871..16435bdab 100644 --- a/Makefile +++ b/Makefile @@ -47,17 +47,19 @@ PLT_APPS = sasl asn1 ssl syntax_tools runtime_tools crypto xmerl os_mon inets pu DIALYZER_DIRS := ebin/ DIALYZER_OPTS := --verbose --statistics -Werror_handling -Wrace_conditions #-Wunmatched_returns -GIT_VSN = $(shell git --version | grep -oE "[0-9]{1,2}\.[0-9]{1,2}") -GIT_VSN_17_COMP = $(shell echo -e "$(GIT_VSN)\n1.7" | sort -V | tail -1) -ifeq ($(GIT_VSN_17_COMP),1.7) - MAYBE_SHALLOW = -else - MAYBE_SHALLOW = -c advice.detachedHead=false --depth 1 -endif +GIT_VSN := $(shell git --version | grep -oE "[0-9]{1,2}\.[0-9]{1,2}") +GIT_VSN_17_COMP := $(shell echo -e "$(GIT_VSN)\n1.7" | sort -V | tail -1) +ifeq ($(GIT_VSN_17_COMP),1.7) define dep_fetch_git-emqx - git clone $(MAYBE_SHALLOW) -q -b $(call dep_commit,$(1)) -- $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1)) > /dev/null 2>&1 + git clone -q -n -- $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1)); \ + cd $(DEPS_DIR)/$(call dep_name,$(1)) && git checkout -q $(call dep_commit,$(1)) endef +else +define dep_fetch_git-emqx + git clone -q -c advice.detachedHead=false --depth 1 -b $(call dep_commit,$(1)) -- $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1)) +endef +endif core_http_get-emqx = curl -Lf$(if $(filter-out 0,$(V)),,s)o $(call core_native_path,$1) $2