diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-11-15 15:11:59 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-11-15 16:05:27 +0400 |
commit | 927dea436ee47e4dcabcde8eb4b167f0c32a08f2 (patch) | |
tree | 9e35618a41b1eb372ec9bb59d7d316909df9bb5c /build_files | |
parent | 825b0e8bc422174965ed8c0376d3d25b4f923394 (diff) |
Further tweaks to buildinfo
Summary:
Old idea with changes since previous release tag
didn't work good enough. In most of the cases tag
was done in a branch hence not actually reachable
from the master branch.
Now change since release is gone, and date of
the latest commit is used instead.
The date is displayed in format YYYY-MM-DD HH:mm
in the splash.
New bpy.app fields:
- build_commit_timestamp is an unix timestamp of
the commit blender was build from.
- build_commit_date is a date of that commit.
- build_commit_time is a time of that commit.
Reviewers: campbellbarton
Differential Revision: http://developer.blender.org/D5
Diffstat (limited to 'build_files')
-rw-r--r-- | build_files/cmake/buildinfo.cmake | 38 | ||||
-rw-r--r-- | build_files/scons/tools/Blender.py | 13 |
2 files changed, 8 insertions, 43 deletions
diff --git a/build_files/cmake/buildinfo.cmake b/build_files/cmake/buildinfo.cmake index ae2f87b49be..2db03d3efe9 100644 --- a/build_files/cmake/buildinfo.cmake +++ b/build_files/cmake/buildinfo.cmake @@ -5,7 +5,7 @@ # with a default in case anything fails, for examble when using git-svn set(MY_WC_HASH "") set(MY_WC_BRANCH "") -set(MY_WC_CHANGE "unknown") +set(MY_WC_COMMIT_TIMESTAMP 0) # Guess if this is a SVN working copy and then look up the revision if(EXISTS ${SOURCE_DIR}/.git/) @@ -29,19 +29,10 @@ if(EXISTS ${SOURCE_DIR}/.git/) OUTPUT_VARIABLE _git_latest_version_tag OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT _git_latest_version_tag STREQUAL "") - execute_process(COMMAND git rev-list HEAD ^${_git_latest_version_tag} --count - WORKING_DIRECTORY ${SOURCE_DIR} - OUTPUT_VARIABLE MY_WC_CHANGE - OUTPUT_STRIP_TRAILING_WHITESPACE) - else() - # For the time being we don't have annotated release tags, - # count all the revisions in branch. - execute_process(COMMAND git rev-list HEAD --count - WORKING_DIRECTORY ${SOURCE_DIR} - OUTPUT_VARIABLE MY_WC_CHANGE - OUTPUT_STRIP_TRAILING_WHITESPACE) - endif() + execute_process(COMMAND git log -1 --format=%ct + WORKING_DIRECTORY ${SOURCE_DIR} + OUTPUT_VARIABLE MY_WC_COMMIT_TIMESTAMP + OUTPUT_STRIP_TRAILING_WHITESPACE) # Update GIT index before getting dirty files execute_process(COMMAND git update-index -q --refresh @@ -61,23 +52,6 @@ if(EXISTS ${SOURCE_DIR}/.git/) unset(_git_latest_version_tag) endif() endif() -else() - # Some crazy folks like me could have hacked git-svn chekout in a way - # so svnversion gives proper svn revision for themm which required having - # empty .svn folder. - # - # For such a crazy blokes put svn check into an else branch. - # - # (sergey) - if(EXISTS ${SOURCE_DIR}/.svn/) - # The FindSubversion.cmake module is part of the standard distribution - include(FindSubversion) - - if(Subversion_FOUND) - Subversion_WC_INFO(${SOURCE_DIR} MY) - set(MY_WC_CHANGE "${MY_WC_REVISION}") - endif() - endif() endif() # BUILD_PLATFORM and BUILD_PLATFORM are taken from CMake @@ -94,7 +68,7 @@ endif() # Write a file with the SVNVERSION define file(WRITE buildinfo.h.txt "#define BUILD_HASH \"${MY_WC_HASH}\"\n" - "#define BUILD_CHANGE \"${MY_WC_CHANGE}\"\n" + "#define BUILD_COMMIT_TIMESTAMP ${MY_WC_COMMIT_TIMESTAMP}\n" "#define BUILD_BRANCH \"${MY_WC_BRANCH}\"\n" "#define BUILD_DATE \"${BUILD_DATE}\"\n" "#define BUILD_TIME \"${BUILD_TIME}\"\n" diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index 06cc6b7f00a..8715c2367e4 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -411,18 +411,9 @@ def buildinfo(lenv, build_type): build_date = time.strftime ("%Y-%m-%d") build_time = time.strftime ("%H:%M:%S") if os.path.isdir(os.path.abspath('.git')): - latest_version_tag = os.popen('git describe --match "v[0-9]*" --abbrev=0').read().strip() - if latest_version_tag: - build_change = os.popen('git rev-list HEAD ' + latest_version_tag + ' --count').read().strip() - else: - build_change = os.popen('git rev-list HEAD --count').read().strip() - + build_commit_timestamp = os.popen('git log -1 --format=%ct').read().strip() build_hash = os.popen('git rev-parse --short HEAD').read().strip() build_branch = os.popen('git rev-parse --abbrev-ref HEAD').read().strip() - elif os.path.isdir(os.path.abspath('.svn')): - build_hash = '' - build_change = os.popen('svnversion').read()[:-1] # remove \n - build_branch = '' else: build_hash = '' build_change = 'unknown' @@ -445,7 +436,7 @@ def buildinfo(lenv, build_type): 'BUILD_DATE=\\"%s\\"'%(build_date), 'BUILD_TYPE=\\"%s\\"'%(build_type), 'BUILD_HASH=\\"%s\\"'%(build_hash), - 'BUILD_CHANGE=\\"%s\\"'%(build_change), + 'BUILD_COMMIT_TIMESTAMP=%s'%(build_commit_timestamp), 'BUILD_BRANCH=\\"%s\\"'%(build_branch), 'WITH_BUILDINFO', 'BUILD_PLATFORM=\\"%s:%s\\"'%(platform.system(), platform.architecture()[0]), |