diff options
author | Andris Mednis <Andris.Mednis@zabbix.com> | 2019-05-20 17:09:12 +0300 |
---|---|---|
committer | Andris Mednis <Andris.Mednis@zabbix.com> | 2019-05-20 17:58:58 +0300 |
commit | a18680803d1ccb31848fda704139aed240ca1128 (patch) | |
tree | 265bd8037c147ce9a71940643c39baf62d8fb02b /Makefile.am | |
parent | 40122aa3d2616297a013386cd27e1c45ed64659d (diff) |
....I..... [ZBX-16074] added file revision number generation for compilation on MS Windows
Diffstat (limited to 'Makefile.am')
-rw-r--r-- | Makefile.am | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index 096c01ca85f..e0090fee46e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,8 +18,30 @@ EXTRA_DIST = \ ## "dist-hook" run after the distribution directory is filled, but before the actual tar (or shar) file is created. dist-hook: - @zabbix_revision=`git -C $(top_srcdir) rev-parse --short HEAD`; \ - cat $(top_distdir)/include/version.h|sed "s/{ZABBIX_REVISION}/$$zabbix_revision/g" > $(top_distdir)/include/version.h.new; \ +# File revision number must be numeric (Git commit hash cannot be used). +# Therefore to make it numeric and meaningful it is artificially composed from: +# - branch (development or release), +# - type (alpha, beta, rc or release), +# - number of alpha, beta or rc. +# 'branch' expression tries to find out is it a development branch or release branch. +# Result is encoded as: 1 - dev branch, release branch or error occurred, 2 - tag. +# 'type_name' expression tries to find out what type of release it is. +# Expected result is: "alpha", "beta", "rc" or "" (empty string). +# 'type_num' expression encodes 'type_name' as numeric value: +# 1 - alpha, 2 - beta, 3 - rc, 4 - release, 0 - unknown. +# 'type_count' expression tries to find out number of "alpha", "beta" or "rc" (e.g. 1 from "rc1"). + @branch=`(git symbolic-ref -q HEAD > /dev/null && echo 1) || (git tag -l --points-at HEAD| grep "."| grep -q -v "-" && echo 2) || echo 1`; \ + type_name=`cat $(top_distdir)/include/version.h| sed -n -e '/ZABBIX_VERSION_RC/s/.*"\([a-z]*\)[0-9]*"/\1/p'`; \ + type_num=`(test "x$$type_name" = "xalpha" && echo "1") || echo ""`; \ + type_num=`(test -z $$type_num && test "x$$type_name" = "xbeta" && echo "2") || echo "$$type_num"`; \ + type_num=`(test -z $$type_num && test "x$$type_name" = "xrc" && echo "3") || echo "$$type_num"`; \ + type_num=`(test -z $$type_num && test -z $$type_name && echo "4") || echo "$$type_num"`; \ + type_num=`(test -z $$type_num && echo "0") || echo "$$type_num"`; \ + type_count=`cat $(top_distdir)/include/version.h|sed -n -e '/ZABBIX_VERSION_RC/s/.*"[a-z]*\([0-9]*\)"/\1/p'`; \ + type_count=`printf '%02d' $$type_count`; \ + zabbix_revision=`git rev-parse --short HEAD`; \ + cat $(top_distdir)/include/version.h|sed "s/{ZABBIX_RC_NUM}/$$branch$$type_num$$type_count/g"| \ + sed "s/{ZABBIX_REVISION}/$$zabbix_revision/g" > $(top_distdir)/include/version.h.new; \ mv $(top_distdir)/include/version.h.new $(top_distdir)/include/version.h; \ cat $(top_distdir)/src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java|sed "s/{ZABBIX_REVISION}/$$zabbix_revision/g" > \ $(top_distdir)/src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java.new; \ |