2006-05-03 07:20:02 +04:00
|
|
|
get_filename_component(SCRIPT_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|
|
|
|
2006-05-12 00:07:42 +04:00
|
|
|
# default to self extracting tgz, tgz, and tar.Z
|
|
|
|
if(NOT DEFINED CPACK_BINARY_GENERATORS)
|
|
|
|
set(CPACK_BINARY_GENERATORS "STGZ TGZ TZ")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-05 23:51:13 +04:00
|
|
|
if(NOT DEFINED CMAKE_RELEASE_DIRECTORY)
|
|
|
|
set(CMAKE_RELEASE_DIRECTORY "~/CMakeReleaseDirectory")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-09 21:48:36 +04:00
|
|
|
if(NOT DEFINED SCRIPT_NAME)
|
|
|
|
set(SCRIPT_NAME "${HOST}")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-09 00:50:17 +04:00
|
|
|
if(NOT DEFINED MAKE_PROGRAM)
|
|
|
|
message(FATAL_ERROR "MAKE_PROGRAM must be set")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-09 00:36:51 +04:00
|
|
|
if(NOT DEFINED MAKE)
|
2006-05-09 00:50:17 +04:00
|
|
|
set(MAKE "${MAKE_PROGRAM}")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-05 20:14:32 +04:00
|
|
|
if(NOT DEFINED RUN_SHELL)
|
|
|
|
set(RUN_SHELL "/bin/sh")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-03 00:32:46 +04:00
|
|
|
if(NOT DEFINED PROCESSORS)
|
|
|
|
set(PROCESSORS 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2009-01-27 18:34:14 +03:00
|
|
|
if(NOT DEFINED CMAKE_CREATE_VERSION)
|
|
|
|
message(FATAL_ERROR "CMAKE_CREATE_VERSION not defined")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2011-06-02 06:32:42 +04:00
|
|
|
if(NOT DEFINED GIT_COMMAND)
|
|
|
|
set(GIT_COMMAND git)
|
|
|
|
endif()
|
2006-05-04 01:08:34 +04:00
|
|
|
|
2011-01-07 21:50:36 +03:00
|
|
|
if(${CMAKE_CREATE_VERSION} MATCHES "^(release|maint|next|nightly)$")
|
2010-09-10 23:41:27 +04:00
|
|
|
set(GIT_BRANCH origin/${CMAKE_CREATE_VERSION})
|
|
|
|
else()
|
|
|
|
set(GIT_BRANCH ${CMAKE_CREATE_VERSION})
|
|
|
|
endif()
|
2006-05-04 01:08:34 +04:00
|
|
|
|
2006-05-14 23:24:57 +04:00
|
|
|
if(NOT DEFINED FINAL_PATH )
|
2009-01-27 18:34:14 +03:00
|
|
|
set(FINAL_PATH ${CMAKE_RELEASE_DIRECTORY}/${CMAKE_CREATE_VERSION}-build)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-14 23:24:57 +04:00
|
|
|
|
2006-05-03 00:32:46 +04:00
|
|
|
if(NOT HOST)
|
|
|
|
message(FATAL_ERROR "HOST must be specified with -DHOST=host")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-03 00:32:46 +04:00
|
|
|
if(NOT DEFINED MAKE)
|
|
|
|
message(FATAL_ERROR "MAKE must be specified with -DMAKE=\"make -j2\"")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2009-01-27 18:34:14 +03:00
|
|
|
message("Creating CMake release ${CMAKE_CREATE_VERSION} on ${HOST} with parallel = ${PROCESSORS}")
|
2006-05-03 00:32:46 +04:00
|
|
|
|
|
|
|
# define a macro to run a remote command
|
|
|
|
macro(remote_command comment command)
|
|
|
|
message("${comment}")
|
2006-05-05 20:14:32 +04:00
|
|
|
if(${ARGC} GREATER 2)
|
2014-02-27 22:03:29 +04:00
|
|
|
message("ssh ${HOST} ${command}")
|
|
|
|
execute_process(COMMAND ssh ${HOST} ${command} RESULT_VARIABLE result INPUT_FILE ${ARGV2})
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2014-02-27 22:03:29 +04:00
|
|
|
message("ssh ${HOST} ${command}")
|
|
|
|
execute_process(COMMAND ssh ${HOST} ${command} RESULT_VARIABLE result)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-03 00:32:46 +04:00
|
|
|
if(${result} GREATER 0)
|
|
|
|
message(FATAL_ERROR "Error running command: ${command}, return value = ${result}")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endmacro()
|
2006-05-03 00:32:46 +04:00
|
|
|
|
2014-01-28 19:41:56 +04:00
|
|
|
if(CMAKE_DOC_TARBALL)
|
2014-02-25 22:11:04 +04:00
|
|
|
get_filename_component(CMAKE_DOC_TARBALL_NAME "${CMAKE_DOC_TARBALL}" NAME)
|
|
|
|
string(REPLACE ".tar.gz" "-${SCRIPT_NAME}.tar.gz" CMAKE_DOC_TARBALL_STAGED "${CMAKE_DOC_TARBALL_NAME}")
|
|
|
|
message("scp '${CMAKE_DOC_TARBALL}' '${HOST}:${CMAKE_DOC_TARBALL_STAGED}'")
|
2014-01-28 19:41:56 +04:00
|
|
|
execute_process(COMMAND
|
2014-02-25 22:11:04 +04:00
|
|
|
scp ${CMAKE_DOC_TARBALL} ${HOST}:${CMAKE_DOC_TARBALL_STAGED}
|
2014-01-28 19:41:56 +04:00
|
|
|
RESULT_VARIABLE result)
|
|
|
|
if(${result} GREATER 0)
|
2014-02-25 22:11:04 +04:00
|
|
|
message("error sending doc tarball with scp '${CMAKE_DOC_TARBALL}' '${HOST}:${CMAKE_DOC_TARBALL_STAGED}'")
|
2014-01-28 19:41:56 +04:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2006-05-05 21:10:49 +04:00
|
|
|
# set this so configure file will work from script mode
|
|
|
|
# create the script specific for the given host
|
2006-05-09 21:48:36 +04:00
|
|
|
set(SCRIPT_FILE release_cmake-${SCRIPT_NAME}.sh)
|
|
|
|
configure_file(${SCRIPT_PATH}/release_cmake.sh.in ${SCRIPT_FILE} @ONLY)
|
2006-05-05 18:30:26 +04:00
|
|
|
|
2006-05-09 22:14:47 +04:00
|
|
|
# run the script by starting a shell on the remote machine
|
|
|
|
# then using the script file as input to the shell
|
2012-08-13 21:47:32 +04:00
|
|
|
if(RUN_LOCAL)
|
2007-02-02 22:40:26 +03:00
|
|
|
message(FATAL_ERROR "run this command: ${RUN_SHELL} ${SCRIPT_FILE}")
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2007-02-02 22:40:26 +03:00
|
|
|
remote_command("run release_cmake-${HOST}.sh on server"
|
|
|
|
"${RUN_SHELL}" ${SCRIPT_FILE})
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-03 07:20:02 +04:00
|
|
|
|
2012-08-13 21:42:58 +04:00
|
|
|
# now figure out which types of packages were created
|
2006-05-12 00:07:42 +04:00
|
|
|
set(generators ${CPACK_BINARY_GENERATORS} ${CPACK_SOURCE_GENERATORS})
|
|
|
|
separate_arguments(generators)
|
|
|
|
foreach(gen ${generators})
|
|
|
|
if("${gen}" STREQUAL "TGZ")
|
|
|
|
set(SUFFIXES ${SUFFIXES} "*.tar.gz")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-12 00:07:42 +04:00
|
|
|
if("${gen}" STREQUAL "STGZ")
|
|
|
|
set(SUFFIXES ${SUFFIXES} "*.sh")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2014-05-08 21:38:33 +04:00
|
|
|
if("${gen}" STREQUAL "DragNDrop")
|
2006-05-12 00:07:42 +04:00
|
|
|
set(SUFFIXES ${SUFFIXES} "*.dmg")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-12 00:07:42 +04:00
|
|
|
if("${gen}" STREQUAL "TBZ2")
|
|
|
|
set(SUFFIXES ${SUFFIXES} "*.tar.bz2")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-02-02 22:40:26 +03:00
|
|
|
if("${gen}" MATCHES "Cygwin")
|
|
|
|
set(SUFFIXES ${SUFFIXES} "*.tar.bz2")
|
2007-02-12 20:06:02 +03:00
|
|
|
set(extra_files setup.hint)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-12 00:07:42 +04:00
|
|
|
if("${gen}" STREQUAL "TZ")
|
|
|
|
set(SUFFIXES ${SUFFIXES} "*.tar.Z")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-12 00:07:42 +04:00
|
|
|
if("${gen}" STREQUAL "ZIP")
|
|
|
|
set(SUFFIXES ${SUFFIXES} "*.zip")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-12 00:07:42 +04:00
|
|
|
if("${gen}" STREQUAL "NSIS")
|
|
|
|
set(SUFFIXES ${SUFFIXES} "*.exe")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2015-10-06 17:13:28 +03:00
|
|
|
|
|
|
|
if(LOCAL_DIR)
|
|
|
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${LOCAL_DIR}")
|
|
|
|
else()
|
|
|
|
set(LOCAL_DIR .)
|
|
|
|
endif()
|
|
|
|
|
2006-05-12 00:07:42 +04:00
|
|
|
# copy all the files over from the remote machine
|
|
|
|
set(PROJECT_PREFIX cmake-)
|
|
|
|
foreach(suffix ${SUFFIXES})
|
2015-10-06 17:13:28 +03:00
|
|
|
message("scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} ${LOCAL_DIR}")
|
2012-08-13 21:42:58 +04:00
|
|
|
execute_process(COMMAND
|
2015-10-06 17:13:28 +03:00
|
|
|
scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} ${LOCAL_DIR}
|
2012-08-13 21:42:58 +04:00
|
|
|
RESULT_VARIABLE result)
|
2006-05-12 00:07:42 +04:00
|
|
|
if(${result} GREATER 0)
|
2015-10-06 17:13:28 +03:00
|
|
|
message("error getting file back scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} ${LOCAL_DIR}")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2007-02-12 20:06:02 +03:00
|
|
|
|
|
|
|
# if there are extra files to copy get them as well
|
|
|
|
if(extra_files)
|
|
|
|
foreach(f ${extra_files})
|
2015-10-06 17:13:28 +03:00
|
|
|
message("scp ${HOST}:${FINAL_PATH}/${f} ${LOCAL_DIR}")
|
2012-08-13 21:42:58 +04:00
|
|
|
execute_process(COMMAND
|
2015-10-06 17:13:28 +03:00
|
|
|
scp ${HOST}:${FINAL_PATH}/${f} ${LOCAL_DIR}
|
2007-02-12 20:06:02 +03:00
|
|
|
RESULT_VARIABLE result)
|
|
|
|
if(${result} GREATER 0)
|
2015-10-06 17:13:28 +03:00
|
|
|
message("error getting file back scp ${HOST}:${FINAL_PATH}/${f} ${LOCAL_DIR}")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|