[Asterisk-code-review] build tools/make version: Update version parsing for Git mig... (asterisk[certified/11.6])

Mark Michelson asteriskteam at digium.com
Wed Apr 22 16:14:56 CDT 2015


Mark Michelson has submitted this change and it was merged.

Change subject: build_tools/make_version: Update version parsing for Git migration
......................................................................


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
---
M build_tools/make_version
1 file changed, 5 insertions(+), 3 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, approved; Verified



diff --git a/build_tools/make_version b/build_tools/make_version
index de0b97e..4174844 100755
--- a/build_tools/make_version
+++ b/build_tools/make_version
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+MAINLINE_BRANCH=11
+
 if [ -f ${1}/.version ]; then
     cat ${1}/.version
 elif [ -d ${1}/.svn ]; then
@@ -94,16 +96,16 @@
     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

-- 
To view, visit https://gerrit.asterisk.org/209
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8090d5d548b6d19e917157ed530b914b7eaf9799
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: certified/11.6
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list