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 /source/creator | |
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 'source/creator')
-rw-r--r-- | source/creator/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/creator/buildinfo.c | 4 | ||||
-rw-r--r-- | source/creator/creator.c | 36 |
3 files changed, 26 insertions, 18 deletions
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index b386312bb55..0ef32f4dc02 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -131,7 +131,9 @@ if(WITH_BUILDINFO) # # define in header now, else these get out of date on rebuilds. # -DBUILD_DATE="${BUILD_DATE}" # -DBUILD_TIME="${BUILD_TIME}" - # -DBUILD_CHANGE="${BUILD_CHANGE}" + # -DBUILD_COMMIT_TIMESTAMP="${BUILD_COMMIT_TIMESTAMP}" + # -DBUILD_COMMIT_TIME="${BUILD_COMMIT_TIME}" + # -DBUILD_COMMIT_DATE="${BUILD_COMMIT_DATE}" # -DBUILD_HASH="${BUILD_HASH}" # -DBUILD_BRANCH="${BUILD_BRANCH}" -DWITH_BUILDINFO_HEADER # alternative to lines above diff --git a/source/creator/buildinfo.c b/source/creator/buildinfo.c index d51249980a8..795eec0df40 100644 --- a/source/creator/buildinfo.c +++ b/source/creator/buildinfo.c @@ -40,7 +40,9 @@ char build_date[] = BUILD_DATE; char build_time[] = BUILD_TIME; char build_hash[] = BUILD_HASH; -char build_change[] = BUILD_CHANGE; +unsigned long build_commit_timestamp = BUILD_COMMIT_TIMESTAMP; +char build_commit_date[16] = "\0"; +char build_commit_time[16] = "\0"; char build_branch[] = BUILD_BRANCH; char build_platform[] = BUILD_PLATFORM; diff --git a/source/creator/creator.c b/source/creator/creator.c index 8221552a1d7..508847af5e3 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -154,7 +154,12 @@ extern char build_date[]; extern char build_time[]; extern char build_hash[]; -extern char build_change[]; +extern unsigned long build_commit_timestamp; + +/* TODO(sergey): ideally size need to be in sync with buildinfo.c */ +extern char build_commit_date[16]; +extern char build_commit_time[16]; + extern char build_branch[]; extern char build_platform[]; extern char build_type[]; @@ -221,14 +226,9 @@ static int print_version(int UNUSED(argc), const char **UNUSED(argv), void *UNUS #ifdef BUILD_DATE printf("\tbuild date: %s\n", build_date); printf("\tbuild time: %s\n", build_time); - /* TODO(sergey): As soon as we fully switched to GIT, no need to check build_hash. */ - if (build_hash[0] != '\0') { - printf("\tbuild revision: %s\n", build_change); - } - else { - printf("\tbuild change: %s\n", build_change); - printf("\tbuild hash: %s\n", build_hash); - } + printf("\tbuild commit date: %s\n", build_commit_date); + printf("\tbuild commit time: %s\n", build_commit_time); + printf("\tbuild hash: %s\n", build_hash); printf("\tbuild platform: %s\n", build_platform); printf("\tbuild type: %s\n", build_type); printf("\tbuild c flags: %s\n", build_cflags); @@ -602,13 +602,8 @@ static void blender_crash_handler(int signum) #ifndef BUILD_DATE BLI_snprintf(header, sizeof(header), "# " BLEND_VERSION_FMT ", Unknown revision\n", BLEND_VERSION_ARG); #else - /* TODO(sergey): As soon as we fully switched to GIT, no need to check build_hash. */ - if (build_hash[0] != '\0') { - BLI_snprintf(header, sizeof(header), "# " BLEND_VERSION_FMT ", Change: %s, Hash %s\n", BLEND_VERSION_ARG, build_change, build_hash); - } - else { - BLI_snprintf(header, sizeof(header), "# " BLEND_VERSION_FMT ", Revision: %s\n", BLEND_VERSION_ARG, build_change); - } + BLI_snprintf(header, sizeof(header), "# " BLEND_VERSION_FMT ", Commit date: %s %s, Hash %s\n", + BLEND_VERSION_ARG, build_commit_date, build_commit_time, build_hash); #endif /* open the crash log */ @@ -1517,6 +1512,15 @@ int main(int argc, const char **argv) } } +#ifdef BUILD_DATE + { + time_t temp_time = build_commit_timestamp; + struct tm *tm = gmtime(&temp_time); + strftime(build_commit_date, sizeof(build_commit_date), "%Y-%m-%d", tm); + strftime(build_commit_time, sizeof(build_commit_time), "%H:%M", tm); + } +#endif + C = CTX_create(); #ifdef WITH_PYTHON_MODULE |