diff options
author | Matt Jordan <mjordan@digium.com> | 2015-04-13 09:54:18 -0500 |
---|---|---|
committer | Matt Jordan <mjordan@digium.com> | 2015-04-13 10:33:30 -0500 |
commit | 3f9aa29945d0eb2fd91f1c0f03b6c9409d86e0d1 (patch) | |
tree | a9011fc6d9c273c60238c6b4bb39561db8896548 /build_tools | |
parent | 1174ef588dafe864fe3f2c1f8297690def8f85d1 (diff) |
build_tools/make_version: Update version parsing for Git migration
External systems - such as the Asterisk Test Suite - require knowledge of the
upstream branch. Unfortunately, after moving to Git, the Asterisk version
currently consists of only a 'GIT" prefix followed by an object blob,
e.g., GIT-as08d7. This makes it difficult for such systems to know what
features are available in a particular check out of Asterisk.
This patch fixes this by hardcoding the branch in a variable in the
make_version script. Since the mainline branches are not changed often -
typically only once a year - this is a reasonable approach to solving
the problem, and is more reliable than parsing the output of 'git branch
-vv'. Branches that track off of an upstream primary branch will then get the
benefit of knowing which mainline branch they are currently based off
of.
ASTERISK-24954 #close
Change-Id: I8090d5d548b6d19e917157ed530b914b7eaf9799
Diffstat (limited to 'build_tools')
-rwxr-xr-x | build_tools/make_version | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/build_tools/make_version b/build_tools/make_version index d11c096eb..fd14a550a 100755 --- a/build_tools/make_version +++ b/build_tools/make_version @@ -3,6 +3,7 @@ AWK=${AWK:-awk} GIT=${GIT:-git} GREP=${GREP:-grep} +MAINLINE_BRANCH=master if [ -f ${1}/.version ]; then cat ${1}/.version @@ -98,16 +99,16 @@ elif [ -d ${1}/.git ]; then MODIFIED="" SVN_REV=`${GIT} log --pretty=full -1 | ${GREP} -F "git-svn-id:" | sed -e "s/.*\@\([^\s]*\)\s.*/\1/g"` if [ -z "$SVN_REV" ]; then - VERSION=GIT-`${GIT} describe --long --always --tags --dirty=M 2> /dev/null` + VERSION=`${GIT} describe --long --always --tags --dirty=M 2> /dev/null` if [ $? -ne 0 ]; then if [ "`${GIT} ls-files -m | wc -l`" != "0" ]; then MODIFIED="M" fi # Some older versions of git do not support all the above # options. - VERSION=GIT-`${GIT} rev-parse --short --verify HEAD`${MODIFIED} + VERSION=`${GIT} rev-parse --short --verify HEAD`${MODIFIED} fi - echo ${VERSION} + echo GIT-${MAINLINE_BRANCH}-${VERSION} else PARTS=`LANG=C ${GIT} log --pretty=full | ${GREP} -F "git-svn-id:" | head -1 | ${AWK} '{print $2;}' | sed -e s:^.*/svn/$2/:: | sed -e 's:/: :g' | sed -e 's/@.*$//g'` BRANCH=0 |