Skip to content

Commit 483dccb

Browse files
author
Tor Didriksen
committed
Merge branch 'mysql-5.5' into mysql-5.6
Conflicts: cmake/info_macros.cmake.in
2 parents b91b3bc + 22d684d commit 483dccb

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

cmake/info_macros.cmake.in

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
# If further variables are used in this file, add them to this list.
2424

2525
SET(VERSION "@VERSION@")
26+
SET(MAJOR_VERSION "@MAJOR_VERSION@")
27+
SET(MINOR_VERSION "@MINOR_VERSION@")
28+
SET(PATCH_VERSION "@PATCH_VERSION@")
2629
SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@")
2730
SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
2831
SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@")
2932
SET(CMAKE_SIZEOF_VOID_P "@CMAKE_SIZEOF_VOID_P@")
30-
SET(BZR_EXECUTABLE "@BZR_EXECUTABLE@")
3133
SET(GIT_EXECUTABLE "@GIT_EXECUTABLE@")
3234
SET(CMAKE_CROSSCOMPILING "@CMAKE_CROSSCOMPILING@")
3335
SET(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@")
@@ -45,41 +47,41 @@ SET(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@")
4547
MACRO(CREATE_INFO_SRC target_dir)
4648
SET(INFO_SRC "${target_dir}/INFO_SRC")
4749

50+
SET(PERLSCRIPT
51+
"use warnings; use POSIX qw(strftime); "
52+
"print strftime \"%F %T %z\", localtime;")
53+
EXECUTE_PROCESS(
54+
COMMAND perl -e "${PERLSCRIPT}"
55+
RESULT_VARIABLE result
56+
OUTPUT_VARIABLE bdate
57+
ERROR_VARIABLE error
58+
)
59+
IF(error)
60+
MESSAGE(STATUS "Could not determine build-date: <${error}>")
61+
ENDIF()
62+
4863
IF(GIT_EXECUTABLE AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
4964
# Sources are in a GIT repository: Always update.
5065
EXECUTE_PROCESS(
51-
COMMAND ${GIT_EXECUTABLE} log -1
66+
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
5267
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
53-
OUTPUT_VARIABLE VERSION_INFO
54-
RESULT_VARIABLE RESULT
68+
OUTPUT_VARIABLE bname
5569
)
56-
FILE(WRITE ${INFO_SRC} "git log -1: ${VERSION_INFO}\n")
70+
5771
EXECUTE_PROCESS(
58-
COMMAND ${GIT_EXECUTABLE} branch
72+
COMMAND ${GIT_EXECUTABLE} log -1
73+
--pretty="commit: %H%ndate: %ci%nbuild-date: ${bdate} %nshort: %h%nbranch: ${bname}"
5974
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
6075
OUTPUT_VARIABLE VERSION_INFO
61-
RESULT_VARIABLE RESULT
6276
)
63-
FILE(APPEND ${INFO_SRC} "${VERSION_INFO}\n")
64-
FILE(APPEND ${INFO_SRC} "\nMySQL source ${VERSION}\n")
65-
ELSEIF(BZR_EXECUTABLE AND EXISTS ${CMAKE_SOURCE_DIR}/.bzr)
66-
# Sources are in a BZR repository: Always update.
67-
# Add a timeout in case BZR hangs forever ...
68-
EXECUTE_PROCESS(
69-
COMMAND ${BZR_EXECUTABLE} version-info ${CMAKE_SOURCE_DIR}
70-
OUTPUT_VARIABLE VERSION_INFO
71-
RESULT_VARIABLE RESULT
72-
ERROR_VARIABLE ERROR
73-
TIMEOUT 10
74-
)
75-
IF(NOT RESULT EQUAL 0)
76-
MESSAGE(STATUS "Error from ${BZR_EXECUTABLE}: ${ERROR}")
77-
SET(BZR_EXECUTABLE)
78-
ENDIF()
77+
78+
## Output from git is quoted with "", remove them.
79+
STRING(REPLACE "\"" "" VERSION_INFO "${VERSION_INFO}")
7980
FILE(WRITE ${INFO_SRC} "${VERSION_INFO}\n")
8081
# to debug, add: FILE(APPEND ${INFO_SRC} "\nResult ${RESULT}\n")
8182
# For better readability ...
82-
FILE(APPEND ${INFO_SRC} "\nMySQL source ${VERSION}\n")
83+
FILE(APPEND ${INFO_SRC}
84+
"MySQL source ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}\n")
8385
ELSEIF(EXISTS ${INFO_SRC})
8486
# Outside a BZR tree, there is no need to change an existing "INFO_SRC",
8587
# it cannot be improved.

mysql-test/t/file_contents.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ $found_revision = "No line 'revision-id: .....'";
6363
open(I_SRC,"<","$dir_docs/INFO_SRC") or print "Cannot open 'INFO_SRC' in '$dir_docs' (starting from bindir '$dir_bin')\n";
6464
while(defined ($line = <I_SRC>)) {
6565
if ($line =~ m|^MySQL source \d\.\d\.\d+|) {$found_version = "Found MySQL version number";}
66-
if ($line =~ m|^git log -1: commit \w{40}$|) {$found_revision = "Found GIT revision id";}
66+
if ($line =~ m|^commit: \w{40}$|) {$found_revision = "Found GIT revision id";}
6767
}
6868
close I_SRC;
6969
print "INFO_SRC: $found_version / $found_revision\n";

0 commit comments

Comments
 (0)