diff options
author | Brad King <brad.king@kitware.com> | 2019-05-28 15:42:38 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-05-28 15:43:24 (GMT) |
commit | da78d0f5ea5506602db9f761e559ff9057430c57 (patch) | |
tree | 3ab583630d2cd8e78ffc4591c08533760c47ecfc /Utilities | |
parent | 540640fc0aca7f181098b0270fb1cae1cd684791 (diff) | |
parent | 9bf97363b0d0f3ba0bf89247ce4f8811b4286961 (diff) | |
download | CMake-da78d0f5ea5506602db9f761e559ff9057430c57.zip CMake-da78d0f5ea5506602db9f761e559ff9057430c57.tar.gz CMake-da78d0f5ea5506602db9f761e559ff9057430c57.tar.bz2 |
Merge topic 'rel-push'
9bf97363b0 Utilities/Release: Replace upload step with a "push" script
3a0ab3ba23 Utilities/Release: Teach upload script to compute version automatically
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3370
Diffstat (limited to 'Utilities')
-rwxr-xr-x | Utilities/Release/push.bash | 70 | ||||
-rw-r--r-- | Utilities/Release/upload_release.cmake | 39 |
2 files changed, 70 insertions, 39 deletions
diff --git a/Utilities/Release/push.bash b/Utilities/Release/push.bash new file mode 100755 index 0000000..1c8efe9 --- /dev/null +++ b/Utilities/Release/push.bash @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +usage='usage: push.bash [<options>] [--] <dest> + +Options: + + --dir <dir> Specify subdirectory under destination. + Defaults to "v<version>". + --version <ver> CMake <major>.<minor> version number to push. + Defaults to version of source tree. +' + +die() { + echo "$@" 1>&2; exit 1 +} + +cmake_source_dir="${BASH_SOURCE%/*}/../.." + +cmake_version_component() +{ + sed -n " +/^set(CMake_VERSION_${1}/ {s/set(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;} +" "${cmake_source_dir}/Source/CMakeVersion.cmake" +} + + +version='' +dir='' +while test "$#" != 0; do + case "$1" in + --dir) shift; dir="$1" ;; + --version) shift; version="$1" ;; + --) shift ; break ;; + -*) die "$usage" ;; + *) break ;; + esac + shift +done +test "$#" = 1 || die "$usage" +readonly dest="$1" + +if test -z "$version"; then + cmake_version_major="$(cmake_version_component MAJOR)" + cmake_version_minor="$(cmake_version_component MINOR)" + version="${cmake_version_major}.${cmake_version_minor}" +fi +readonly version + +if test -z "$dir"; then + dir="v${version}" +fi +readonly dir + +for f in cmake-${version}*; do + if ! test -f "${f}"; then + continue + fi + + echo "pushing '${f}'" + + # Make a copy with a new timestamp and atomically rename into place. + tf="${dest}/${dir}/.tmp.${f}" + df="${dest}/${dir}/${f}" + cp "${f}" "${tf}" + mv "${tf}" "${df}" + + # Pause to give each file a distinct time stamp even with 1s resolution + # so that sorting by time also sorts alphabetically. + sleep 1.1 +done diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake deleted file mode 100644 index 3613ae7..0000000 --- a/Utilities/Release/upload_release.cmake +++ /dev/null @@ -1,39 +0,0 @@ -set(CTEST_RUN_CURRENT_SCRIPT 0) -if(NOT VERSION) - set(VERSION 3.14) -endif() -if(NOT DEFINED PROJECT_PREFIX) - set(PROJECT_PREFIX cmake-${VERSION}) -endif() -if(NOT DEFINED DIR) - set(DIR "v${VERSION}") -endif() -file(GLOB FILES ${CMAKE_CURRENT_SOURCE_DIR} "${PROJECT_PREFIX}*") -list(SORT FILES) -list(REVERSE FILES) -message("${FILES}") -set(UPLOAD_LOC - "kitware@www.cmake.org:/projects/FTP/pub/cmake/${DIR}") -set(count 0) -foreach(file ${FILES}) - if(NOT IS_DIRECTORY ${file}) - message("upload ${file} ${UPLOAD_LOC}") - execute_process(COMMAND - scp ${file} ${UPLOAD_LOC} - RESULT_VARIABLE result) - if("${result}" GREATER 0) - message(FATAL_ERROR "failed to upload file to ${UPLOAD_LOC}") - endif() - - # Pause to give each upload a distinct (to the nearest second) - # time stamp - if(COMMAND ctest_sleep) - ctest_sleep(2) - endif() - - math(EXPR count "${count} + 1") - endif() -endforeach() -if(${count} EQUAL 0) - message(FATAL_ERROR "Error no files uploaded.") -endif() |