tweaks to buildinfo

We wouldn't really have release branches, building will happen
from annotated tags.

Made it so building tag revision equals to a master branch.
This commit is contained in:
Sergey Sharybin
2014-03-07 18:26:34 +06:00
parent c05896eb35
commit 43b5f0af2d
3 changed files with 24 additions and 1 deletions

View File

@@ -35,8 +35,26 @@ if(EXISTS ${SOURCE_DIR}/.git)
STRING(REGEX REPLACE "^[ \t]+" "" _git_contains_check "${_git_contains_check}")
if(_git_contains_check STREQUAL "master")
set(MY_WC_BRANCH "master")
else()
execute_process(COMMAND git show-ref --tags -d
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE _git_tag_hashes
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE _git_head_hash
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(_git_tag_hashes MATCHES "${_git_head_hash}")
set(MY_WC_BRANCH "master")
endif()
unset(_git_tag_hashes)
unset(_git_head_hashs)
endif()
unset(_git_contains_check)
else()
execute_process(COMMAND git log HEAD..@{u}

View File

@@ -430,6 +430,11 @@ def buildinfo(lenv, build_type):
master_check = os.popen('git branch --list master --contains ' + build_hash).read().strip()
if master_check == 'master':
build_branch = 'master'
else:
head_hash = os.popen('git rev-parse HEAD').read().strip()
tag_hashes = os.popen('git show-ref --tags -d').read()
if tag_hashes.find(head_hash) != -1:
build_branch = 'master'
if build_hash == '':
build_hash = os.popen('git rev-parse --short HEAD').read().strip()