Skip to content

Commit 2ee7167

Browse files
author
Tor Didriksen
committed
Bug#19908468 PLACE CORRECT INFORMATION IN INFO_SRC AFTER TRANSITIONING TO GIT
Use 'git log -1; git branch' rather than 'bzr version-info'
1 parent 9bd6e87 commit 2ee7167

4 files changed

Lines changed: 24 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,8 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
427427
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
428428
${CMAKE_BINARY_DIR}/sql/sql_builtin.cc)
429429
CONFIGURE_FILE(
430-
${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in ${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY)
430+
${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in
431+
${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY)
431432

432433
# Handle the "INFO_*" files.
433434
INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake)

cmake/info_macros.cmake.in

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -28,6 +28,7 @@ SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
2828
SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@")
2929
SET(CMAKE_SIZEOF_VOID_P "@CMAKE_SIZEOF_VOID_P@")
3030
SET(BZR_EXECUTABLE "@BZR_EXECUTABLE@")
31+
SET(GIT_EXECUTABLE "@GIT_EXECUTABLE@")
3132
SET(CMAKE_CROSSCOMPILING "@CMAKE_CROSSCOMPILING@")
3233
SET(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@")
3334
SET(CMAKE_HOST_SYSTEM_PROCESSOR "@CMAKE_HOST_SYSTEM_PROCESSOR@")
@@ -44,7 +45,24 @@ SET(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@")
4445
MACRO(CREATE_INFO_SRC target_dir)
4546
SET(INFO_SRC "${target_dir}/INFO_SRC")
4647

47-
IF(EXISTS ${CMAKE_SOURCE_DIR}/.bzr)
48+
IF(GIT_EXECUTABLE AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
49+
# Sources are in a GIT repository: Always update.
50+
EXECUTE_PROCESS(
51+
COMMAND ${GIT_EXECUTABLE} log -1
52+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
53+
OUTPUT_VARIABLE VERSION_INFO
54+
RESULT_VARIABLE RESULT
55+
)
56+
FILE(WRITE ${INFO_SRC} "git log -1: ${VERSION_INFO}\n")
57+
EXECUTE_PROCESS(
58+
COMMAND ${GIT_EXECUTABLE} branch
59+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
60+
OUTPUT_VARIABLE VERSION_INFO
61+
RESULT_VARIABLE RESULT
62+
)
63+
FILE(APPEND ${INFO_SRC} "${VERSION_INFO}\n")
64+
FILE(APPEND ${INFO_SRC} "\nMySQL source ${VERSION}\n")
65+
ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/.bzr)
4866
# Sources are in a BZR repository: Always update.
4967
EXECUTE_PROCESS(
5068
COMMAND ${BZR_EXECUTABLE} version-info ${CMAKE_SOURCE_DIR}

mysql-test/r/file_contents.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
Checking 'INFO_SRC' and 'INFO_BIN'
3-
INFO_SRC: Found MySQL version number / Found BZR revision id
3+
INFO_SRC: Found MySQL version number / Found GIT revision id
44
INFO_BIN: Found 'Compiler ... used' line / Found 'Feature flags' line
55

66
End of tests

mysql-test/t/file_contents.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ $found_revision = "No line 'revision-id: .....'";
4747
open(I_SRC,"<","$dir_docs/INFO_SRC") or print "Cannot open 'INFO_SRC' in '$dir_docs' (starting from bindir '$dir_bin')\n";
4848
while(defined ($line = <I_SRC>)) {
4949
if ($line =~ m|^MySQL source \d\.\d\.\d+|) {$found_version = "Found MySQL version number";}
50-
if ($line =~ m|^revision-id: .*@.*-2\d{13}-\w+$|) {$found_revision = "Found BZR revision id";}
50+
if ($line =~ m|^git log -1: commit \w{40}$|) {$found_revision = "Found GIT revision id";}
5151
}
5252
close I_SRC;
5353
print "INFO_SRC: $found_version / $found_revision\n";

0 commit comments

Comments
 (0)