Skip to content

Commit

Permalink
Check and/or report the version of CE used in EE builds
Browse files Browse the repository at this point in the history
Clean up the code for checking git tags match on a build, to allow other
editions to check it when building systems that are based on CE builds.

See also hpcc-systems/LN#407

Signed-off-by: Richard Chapman <[email protected]>
  • Loading branch information
richardkchapman committed Mar 29, 2012
1 parent 6400f2b commit 4e73cdf
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
33 changes: 12 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,32 +213,23 @@ set(CPACK_SOURCE_IGNORE_FILES
###
set( BUILD_TAG "${CPACK_RPM_PACKAGE_VERSION}_${version}-${stagever}")
if (USE_GIT_DESCRIBE OR CHECK_GIT_TAG)
execute_process(COMMAND "${GIT_COMMAND}" describe --exact --tags --dirty --match ${CPACK_RPM_PACKAGE_VERSION}*
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_BUILD_TAG
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (CHECK_GIT_TAG)
if(NOT "${GIT_BUILD_TAG}" STREQUAL "${BUILD_TAG}")
message(FATAL_ERROR "Git tag '${GIT_BUILD_TAG}' does not match source version '${BUILD_TAG}'" )
endif()
else()
if ("${GIT_BUILD_TAG}" STREQUAL "")
execute_process(COMMAND "${GIT_COMMAND}" describe --always --tags --all --abbrev=6 --dirty --long
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_BUILD_TAG
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()
FETCH_GIT_TAG (${CMAKE_SOURCE_DIR} ${CPACK_RPM_PACKAGE_VERSION} GIT_BUILD_TAG)
message ("-- Git tag is '${GIT_BUILD_TAG}'")
if(NOT "${GIT_BUILD_TAG}" STREQUAL "${BUILD_TAG}")
if(NOT "${GIT_BUILD_TAG}" STREQUAL "") # probably means being built from a tarball...
set( BUILD_TAG "${BUILD_TAG}[${GIT_BUILD_TAG}]")
if (NOT "${GIT_BUILD_TAG}" STREQUAL "${BUILD_TAG}")
if (CHECK_GIT_TAG)
message(FATAL_ERROR "Git tag '${GIT_BUILD_TAG}' does not match source version '${BUILD_TAG}'" )
else()
if(NOT "${GIT_BUILD_TAG}" STREQUAL "") # probably means being built from a tarball...
set( BUILD_TAG "${BUILD_TAG}[${GIT_BUILD_TAG}]")
endif()
endif()
endif()
endif()
message ("-- Build tag is '${BUILD_TAG}'")
if (NOT "${BASE_BUILD_TAG}" STREQUAL "")
set(BUILD_TAG "${BUILD_TAG}[)
endif()
message ("-- Base build tag is '${BASE_BUILD_TAG}'")
configure_file(${HPCC_SOURCE_DIR}/build-config.h.cmake "build-config.h" )
#set( CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON )
Expand Down
4 changes: 4 additions & 0 deletions build-config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@
#cmakedefine BUILD_TAG "${BUILD_TAG}"
#endif

#ifndef BASE_BUILD_TAG
#cmakedefine BASE_BUILD_TAG "${BASE_BUILD_TAG}"
#endif

#ifndef BUILD_LEVEL
#cmakedefine BUILD_LEVEL "${BUILD_LEVEL}"
#endif
15 changes: 15 additions & 0 deletions cmake_modules/commonSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,19 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OSSDIR}/lib")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

MACRO (FETCH_GIT_TAG workdir edition result)
execute_process(COMMAND "${GIT_COMMAND}" describe --tags --dirty --abbrev=6 --match ${edition}*
WORKING_DIRECTORY "${workdir}"
OUTPUT_VARIABLE ${result}
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if ("${${result}}" STREQUAL "")
execute_process(COMMAND "${GIT_COMMAND}" describe --always --tags --all --abbrev=6 --dirty --long
WORKING_DIRECTORY "${workdir}"
OUTPUT_VARIABLE ${result}
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
ENDMACRO()

endif ("${COMMONSETUP_DONE}" STREQUAL "")

0 comments on commit 4e73cdf

Please sign in to comment.