release_cmake.cmake 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. set(CVSROOT ":pserver:[email protected]:/cvsroot/CMake")
  2. get_filename_component(SCRIPT_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
  3. if(NOT DEFINED INSTALLER_SUFFIX)
  4. set(INSTALLER_SUFFIX "*.sh")
  5. endif(NOT DEFINED INSTALLER_SUFFIX)
  6. if(NOT DEFINED PROCESSORS)
  7. set(PROCESSORS 1)
  8. endif(NOT DEFINED PROCESSORS)
  9. if(NOT DEFINED CMAKE_VERSION)
  10. message(FATAL_ERROR "CMAKE_VERSION not defined")
  11. endif(NOT DEFINED CMAKE_VERSION)
  12. if(NOT DEFINED CVS_COMMAND)
  13. set(CVS_COMMAND cvs)
  14. endif(NOT DEFINED CVS_COMMAND)
  15. if("${CMAKE_VERSION}" STREQUAL "CVS")
  16. set( CMAKE_CHECKOUT "${CVS_COMMAND} -q -z3 -d ${CVSROOT} export -D now ")
  17. set( CMAKE_VERSION "CurrentCVS")
  18. else("${CMAKE_VERSION}" STREQUAL "CVS")
  19. set( CMAKE_CHECKOUT "${CVS_COMMAND} -q -z3 -d ${CVSROOT} export -r ${CMAKE_VERSION} ")
  20. endif("${CMAKE_VERSION}" STREQUAL "CVS")
  21. if(NOT HOST)
  22. message(FATAL_ERROR "HOST must be specified with -DHOST=host")
  23. endif(NOT HOST)
  24. if(NOT DEFINED MAKE)
  25. message(FATAL_ERROR "MAKE must be specified with -DMAKE=\"make -j2\"")
  26. endif(NOT DEFINED MAKE)
  27. message("Creating CMake release ${CMAKE_VERSION} on ${HOST} with parallel = ${PROCESSORS}")
  28. # define a macro to run a remote command
  29. macro(remote_command comment command)
  30. message("${comment}")
  31. execute_process(COMMAND ssh ${HOST} ${EXTRA_HOP} ${command} RESULT_VARIABLE result)
  32. if(${result} GREATER 0)
  33. message(FATAL_ERROR "Error running command: ${command}, return value = ${result}")
  34. endif(${result} GREATER 0)
  35. endmacro(remote_command)
  36. set(CMAKE_BACKWARDS_COMPATIBILITY 2.4)
  37. configure_file(${SCRIPT_PATH}/release_cmake.sh.in release_cmake-${HOST}.sh)
  38. file(READ release_cmake-${HOST}.sh RELEASE_CMAKE_CONTENTS)
  39. remote_command("Copy release_cmake-${HOST}.sh to sever"
  40. "echo '${RELEASE_CMAKE_CONTENTS}' > release_cmake-${HOST}.sh")
  41. remote_command("Run release script" "sh release_cmake-${HOST}.sh")
  42. message("copy the .gz file back from the machine")
  43. execute_process(COMMAND scp ${HOST}:CMakeReleaseDirectory/${CMAKE_VERSION}-build/*.gz .
  44. RESULT_VARIABLE result)
  45. message("copy the ${INSTALLER_SUFFIX} file back from the machine")
  46. execute_process(COMMAND scp ${HOST}:CMakeReleaseDirectory/${CMAKE_VERSION}-build/${INSTALLER_SUFFIX} .
  47. RESULT_VARIABLE result)