Adaption of CTest-Scripts for Mercurial
This commit is contained in:
parent
3944983064
commit
403fda0869
2 changed files with 84 additions and 16 deletions
|
@ -79,10 +79,10 @@ SET(
|
||||||
CACHE STRING "Build ID"
|
CACHE STRING "Build ID"
|
||||||
)
|
)
|
||||||
|
|
||||||
# We allow overriding the git branch and revision information with some
|
# We allow overriding the git branch and revision information with some
|
||||||
# user-supplied information using the CDASH_SCM_INFO environment variable.
|
# user-supplied information using the CDASH_SCM_INFO environment variable.
|
||||||
#
|
#
|
||||||
# Mercurial or other SCM users should be using this environment variable
|
# Mercurial or other SCM users should be using this environment variable
|
||||||
# in order to provide branch and revision information for the buildname.
|
# in order to provide branch and revision information for the buildname.
|
||||||
#
|
#
|
||||||
# Git users should use this environment variable in order to provide
|
# Git users should use this environment variable in order to provide
|
||||||
|
@ -137,7 +137,7 @@ if(NOT BUILDNAME_SCM_INFO STREQUAL "")
|
||||||
|
|
||||||
elseif(GIT_FOUND)
|
elseif(GIT_FOUND)
|
||||||
message("The git command was found: ${GIT_EXECUTABLE}")
|
message("The git command was found: ${GIT_EXECUTABLE}")
|
||||||
|
|
||||||
# Check if the source code is under a valid git repository
|
# Check if the source code is under a valid git repository
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND git status
|
COMMAND git status
|
||||||
|
@ -164,11 +164,43 @@ elseif(GIT_FOUND)
|
||||||
|
|
||||||
SET(BUILDNAME "${BUILDNAME}-git-branch=${GIT_BRANCH_NAME}")
|
SET(BUILDNAME "${BUILDNAME}-git-branch=${GIT_BRANCH_NAME}")
|
||||||
SET(BUILDNAME "${BUILDNAME}-git-rev=${GIT_REV_NUMBER}")
|
SET(BUILDNAME "${BUILDNAME}-git-rev=${GIT_REV_NUMBER}")
|
||||||
else()
|
else()
|
||||||
# Not a git repository: no branch nor revision information available
|
execute_process(
|
||||||
SET(BUILDNAME "${BUILDNAME}-git-branch=unknown")
|
COMMAND hg id
|
||||||
SET(BUILDNAME "${BUILDNAME}-git-rev=unknown")
|
WORKING_DIRECTORY ${FOAM_ROOT}
|
||||||
endif()
|
OUTPUT_VARIABLE HG_STATUS
|
||||||
|
RESULT_VARIABLE HG_ECODE
|
||||||
|
ERROR_QUIET
|
||||||
|
)
|
||||||
|
if(NOT HG_ECODE)
|
||||||
|
# We have a valid git repository. Grab the branch and revision info.
|
||||||
|
# Add to the build name
|
||||||
|
message("No git-branch. Mercurial?")
|
||||||
|
EXEC_PROGRAM(hg
|
||||||
|
ARGS id --bookmarks
|
||||||
|
OUTPUT_VARIABLE GIT_BRANCH_NAME
|
||||||
|
)
|
||||||
|
EXEC_PROGRAM(hg
|
||||||
|
ARGS id --id
|
||||||
|
OUTPUT_VARIABLE GIT_REV_NUMBER
|
||||||
|
)
|
||||||
|
EXEC_PROGRAM(hg
|
||||||
|
ARGS log --template='git_{gitnode|short}' -l 1
|
||||||
|
OUTPUT_VARIABLE GIT_REAL_REV_NUMBER
|
||||||
|
)
|
||||||
|
string(REPLACE " " "_" GIT_BRANCH_NAME ${GIT_BRANCH_NAME})
|
||||||
|
string(REPLACE "+" ":modified" GIT_REV_NUMBER ${GIT_REV_NUMBER})
|
||||||
|
SET(GIT_REV_NUMBER "${GIT_REV_NUMBER}_${GIT_REAL_REV_NUMBER}")
|
||||||
|
message("Git branch (mercurial): ${GIT_BRANCH_NAME} Revision: ${GIT_REV_NUMBER}")
|
||||||
|
|
||||||
|
SET(BUILDNAME "${BUILDNAME}-hg-branch=${GIT_BRANCH_NAME}")
|
||||||
|
SET(BUILDNAME "${BUILDNAME}-hg-rev=${GIT_REV_NUMBER}")
|
||||||
|
else()
|
||||||
|
# Not a git or mercurial repository: no branch nor revision information available
|
||||||
|
SET(BUILDNAME "${BUILDNAME}-git-branch=unknown")
|
||||||
|
SET(BUILDNAME "${BUILDNAME}-git-rev=unknown")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
# Git is not available: no branch nor revision information supplied
|
# Git is not available: no branch nor revision information supplied
|
||||||
SET(BUILDNAME "${BUILDNAME}-git-branch=unknown")
|
SET(BUILDNAME "${BUILDNAME}-git-branch=unknown")
|
||||||
|
@ -182,6 +214,8 @@ string(REPLACE " " "_" BUILDNAME ${BUILDNAME})
|
||||||
string(REPLACE "/" "_" SITE ${SITE})
|
string(REPLACE "/" "_" SITE ${SITE})
|
||||||
string(REPLACE " " "_" SITE ${SITE})
|
string(REPLACE " " "_" SITE ${SITE})
|
||||||
|
|
||||||
|
message("Build name: ${BUILDNAME}")
|
||||||
|
|
||||||
# Build section
|
# Build section
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -79,10 +79,10 @@ SET(
|
||||||
CACHE STRING "Build ID"
|
CACHE STRING "Build ID"
|
||||||
)
|
)
|
||||||
|
|
||||||
# We allow overriding the git branch and revision information with some
|
# We allow overriding the git branch and revision information with some
|
||||||
# user-supplied information using the CDASH_SCM_INFO environment variable.
|
# user-supplied information using the CDASH_SCM_INFO environment variable.
|
||||||
#
|
#
|
||||||
# Mercurial or other SCM users should be using this environment variable
|
# Mercurial or other SCM users should be using this environment variable
|
||||||
# in order to provide branch and revision information for the buildname.
|
# in order to provide branch and revision information for the buildname.
|
||||||
#
|
#
|
||||||
# Git users should use this environment variable in order to provide
|
# Git users should use this environment variable in order to provide
|
||||||
|
@ -137,7 +137,7 @@ if(NOT BUILDNAME_SCM_INFO STREQUAL "")
|
||||||
|
|
||||||
elseif(GIT_FOUND)
|
elseif(GIT_FOUND)
|
||||||
message("The git command was found: ${GIT_EXECUTABLE}")
|
message("The git command was found: ${GIT_EXECUTABLE}")
|
||||||
|
|
||||||
# Check if the source code is under a valid git repository
|
# Check if the source code is under a valid git repository
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND git status
|
COMMAND git status
|
||||||
|
@ -164,11 +164,43 @@ elseif(GIT_FOUND)
|
||||||
|
|
||||||
SET(BUILDNAME "${BUILDNAME}-git-branch=${GIT_BRANCH_NAME}")
|
SET(BUILDNAME "${BUILDNAME}-git-branch=${GIT_BRANCH_NAME}")
|
||||||
SET(BUILDNAME "${BUILDNAME}-git-rev=${GIT_REV_NUMBER}")
|
SET(BUILDNAME "${BUILDNAME}-git-rev=${GIT_REV_NUMBER}")
|
||||||
else()
|
else()
|
||||||
# Not a git repository: no branch nor revision information available
|
execute_process(
|
||||||
SET(BUILDNAME "${BUILDNAME}-git-branch=unknown")
|
COMMAND hg id
|
||||||
SET(BUILDNAME "${BUILDNAME}-git-rev=unknown")
|
WORKING_DIRECTORY ${FOAM_ROOT}
|
||||||
endif()
|
OUTPUT_VARIABLE HG_STATUS
|
||||||
|
RESULT_VARIABLE HG_ECODE
|
||||||
|
ERROR_QUIET
|
||||||
|
)
|
||||||
|
if(NOT HG_ECODE)
|
||||||
|
# We have a valid git repository. Grab the branch and revision info.
|
||||||
|
# Add to the build name
|
||||||
|
message("No git-branch. Mercurial?")
|
||||||
|
EXEC_PROGRAM(hg
|
||||||
|
ARGS id --bookmarks
|
||||||
|
OUTPUT_VARIABLE GIT_BRANCH_NAME
|
||||||
|
)
|
||||||
|
EXEC_PROGRAM(hg
|
||||||
|
ARGS id --id
|
||||||
|
OUTPUT_VARIABLE GIT_REV_NUMBER
|
||||||
|
)
|
||||||
|
EXEC_PROGRAM(hg
|
||||||
|
ARGS log --template='git_{gitnode|short}' -l 1
|
||||||
|
OUTPUT_VARIABLE GIT_REAL_REV_NUMBER
|
||||||
|
)
|
||||||
|
string(REPLACE " " "_" GIT_BRANCH_NAME ${GIT_BRANCH_NAME})
|
||||||
|
string(REPLACE "+" ":modified" GIT_REV_NUMBER ${GIT_REV_NUMBER})
|
||||||
|
SET(GIT_REV_NUMBER "${GIT_REV_NUMBER}_${GIT_REAL_REV_NUMBER}")
|
||||||
|
message("Git branch (mercurial): ${GIT_BRANCH_NAME} Revision: ${GIT_REV_NUMBER}")
|
||||||
|
|
||||||
|
SET(BUILDNAME "${BUILDNAME}-hg-branch=${GIT_BRANCH_NAME}")
|
||||||
|
SET(BUILDNAME "${BUILDNAME}-hg-rev=${GIT_REV_NUMBER}")
|
||||||
|
else()
|
||||||
|
# Not a git or mercurial repository: no branch nor revision information available
|
||||||
|
SET(BUILDNAME "${BUILDNAME}-git-branch=unknown")
|
||||||
|
SET(BUILDNAME "${BUILDNAME}-git-rev=unknown")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
# Git is not available: no branch nor revision information supplied
|
# Git is not available: no branch nor revision information supplied
|
||||||
SET(BUILDNAME "${BUILDNAME}-git-branch=unknown")
|
SET(BUILDNAME "${BUILDNAME}-git-branch=unknown")
|
||||||
|
@ -182,6 +214,8 @@ string(REPLACE " " "_" BUILDNAME ${BUILDNAME})
|
||||||
string(REPLACE "/" "_" SITE ${SITE})
|
string(REPLACE "/" "_" SITE ${SITE})
|
||||||
string(REPLACE " " "_" SITE ${SITE})
|
string(REPLACE " " "_" SITE ${SITE})
|
||||||
|
|
||||||
|
message("Build name: ${BUILDNAME}")
|
||||||
|
|
||||||
# Build section
|
# Build section
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Reference in a new issue