[Cmake-commits] CMake branch, next, updated. v3.5.2-1498-g0a67a11
Brad King
brad.king at kitware.com
Thu May 19 11:25:31 EDT 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 0a67a1180fc50eade5a753c8c2ec994865084eb7 (commit)
via 89113e125d95fc24eaaec59edaa00b6d428111f5 (commit)
via e7d5e4b4bf864fa779e2fc90dfb352588bf82246 (commit)
via ebcc70271db52bd1ce8322485235152ac2c859aa (commit)
via 33218f6a9373583d56a6ce73752f2365ac3779f5 (commit)
via e5409d1e0f38c9869748cca6f6f0c089a3e40ee1 (commit)
via d610407cca18af075693d4e9243aee06c4ce469c (commit)
from 2f506a44da9ed33a5c87f89b2d48ae389ef85a2e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a67a1180fc50eade5a753c8c2ec994865084eb7
commit 0a67a1180fc50eade5a753c8c2ec994865084eb7
Merge: 2f506a4 89113e1
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu May 19 11:25:29 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu May 19 11:25:29 2016 -0400
Merge topic 'ExternalProject-improve-retry' into next
89113e12 ExternalProject: Re-implement download logic as a dedicated script
e7d5e4b4 ExternalProject: Re-implement download verification as a dedicated script
ebcc7027 ExternalProject: Avoid repeating download verification
33218f6a ExternalProject: Remove unused verify script logic
e5409d1e ExternalProject: Remove unused 'retries' argument from verify script
d610407c ExternalProject: Use uppercase placeholders for script generation
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89113e125d95fc24eaaec59edaa00b6d428111f5
commit 89113e125d95fc24eaaec59edaa00b6d428111f5
Author: Ruslan Baratov <ruslan_baratov at yahoo.com>
AuthorDate: Thu May 19 16:35:01 2016 +0300
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu May 19 11:20:50 2016 -0400
ExternalProject: Re-implement download logic as a dedicated script
Move the content to a `ExternalProject-download.cmake.in` file and use
`configure_file` to generate the final script.
Retry logic was not working before because similar script trigger
FATAL_ERROR if 'file(DOWNLOAD ...)' exits with nonzero 'status_code'.
FATAL_ERROR makes the whole chain of commands stop and
'_ep_write_verifyfile_script' retry logic was not used in fact.
Default retry number set to 5 with pauses 0, 5, 5, 15, 60 seconds. Some
space left for future improvements if needed (90, 300, 1200=20min). Can
be controlled by user.
diff --git a/Modules/ExternalProject-download.cmake.in b/Modules/ExternalProject-download.cmake.in
new file mode 100644
index 0000000..5b73cd8
--- /dev/null
+++ b/Modules/ExternalProject-download.cmake.in
@@ -0,0 +1,161 @@
+#=============================================================================
+# Copyright 2008-2013 Kitware, Inc.
+# Copyright 2016 Ruslan Baratov
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+cmake_minimum_required(VERSION 3.5)
+
+function(check_file_hash has_hash hash_is_good)
+ if("${has_hash}" STREQUAL "")
+ message(FATAL_ERROR "has_hash Can't be empty")
+ endif()
+
+ if("${hash_is_good}" STREQUAL "")
+ message(FATAL_ERROR "hash_is_good Can't be empty")
+ endif()
+
+ if("@ALGO@" STREQUAL "")
+ # No check
+ set("${has_hash}" FALSE PARENT_SCOPE)
+ set("${hash_is_good}" FALSE PARENT_SCOPE)
+ return()
+ endif()
+
+ set("${has_hash}" TRUE PARENT_SCOPE)
+
+ message(STATUS "verifying file...
+ file='@LOCAL@'")
+
+ file("@ALGO@" "@LOCAL@" actual_value)
+
+ if(NOT "${actual_value}" STREQUAL "@EXPECT_VALUE@")
+ set("${hash_is_good}" FALSE PARENT_SCOPE)
+ message(STATUS "@ALGO@ hash of
+ @LOCAL@
+ does not match expected value
+ expected: '@EXPECT_VALUE@'
+ actual: '${actual_value}'")
+ else()
+ set("${hash_is_good}" TRUE PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(sleep_before_download attempt)
+ if(attempt EQUAL 0)
+ return()
+ endif()
+
+ if(attempt EQUAL 1)
+ message(STATUS "Retrying...")
+ return()
+ endif()
+
+ set(sleep_seconds 0)
+
+ if(attempt EQUAL 2)
+ set(sleep_seconds 5)
+ elseif(attempt EQUAL 3)
+ set(sleep_seconds 5)
+ elseif(attempt EQUAL 4)
+ set(sleep_seconds 15)
+ elseif(attempt EQUAL 5)
+ set(sleep_seconds 60)
+ elseif(attempt EQUAL 6)
+ set(sleep_seconds 90)
+ elseif(attempt EQUAL 7)
+ set(sleep_seconds 300)
+ else()
+ set(sleep_seconds 1200)
+ endif()
+
+ message(STATUS "Retry after ${sleep_seconds} seconds (attempt #${attempt}) ...")
+
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep "${sleep_seconds}")
+endfunction()
+
+if("@LOCAL@" STREQUAL "")
+ message(FATAL_ERROR "LOCAL can't be empty")
+endif()
+
+if("@REMOTE@" STREQUAL "")
+ message(FATAL_ERROR "REMOTE can't be empty")
+endif()
+
+if(EXISTS "@LOCAL@")
+ check_file_hash(has_hash hash_is_good)
+ if(has_hash)
+ if(hash_is_good)
+ message(STATUS "File already exists and hash match (skip download):
+ file='@LOCAL@'
+ @ALGO@='@EXPECT_VALUE@'"
+ )
+ return()
+ else()
+ message(STATUS "File already exists but hash mismatch. Removing...")
+ file(REMOVE "@LOCAL@")
+ endif()
+ else()
+ message(STATUS "File already exists but no hash specified (use URL_HASH):
+ file='@LOCAL@'
+Old file will be removed and new file downloaded from URL."
+ )
+ file(REMOVE "@LOCAL@")
+ endif()
+endif()
+
+set(retry_number 5)
+
+foreach(i RANGE ${retry_number})
+ sleep_before_download(${i})
+
+ message(STATUS "downloading...
+ src='@REMOTE@'
+ dst='@LOCAL@'
+ timeout='@TIMEOUT_MSG@'")
+
+ @TLS_VERIFY_CODE@
+ @TLS_CAINFO_CODE@
+
+ file(
+ DOWNLOAD
+ "@REMOTE@" "@LOCAL@"
+ @SHOW_PROGRESS@
+ @TIMEOUT_ARGS@
+ STATUS status
+ LOG log
+ )
+
+ list(GET status 0 status_code)
+ list(GET status 1 status_string)
+
+ if(status_code EQUAL 0)
+ check_file_hash(has_hash hash_is_good)
+ if(has_hash AND NOT hash_is_good)
+ message(STATUS "Hash mismatch, removing...")
+ file(REMOVE "@LOCAL@")
+ else()
+ message(STATUS "Downloading... done")
+ return()
+ endif()
+ else()
+ message("error: downloading '@REMOTE@' failed
+ status_code: ${status_code}
+ status_string: ${status_string}
+ log:
+ --- LOG BEGIN ---
+ ${log}
+ --- LOG END ---"
+ )
+ endif()
+endforeach()
+
+message(FATAL_ERROR "Downloading failed")
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 2249501..ad6de18 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -867,16 +867,11 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p
endif()
if("${hash}" MATCHES "${_ep_hash_regex}")
- string(CONCAT hash_check
- "if(EXISTS \"${LOCAL}\")\n"
- " file(\"${CMAKE_MATCH_1}\" \"${LOCAL}\" hash_value)\n"
- " if(\"x\${hash_value}\" STREQUAL \"x${CMAKE_MATCH_2}\")\n"
- " return()\n"
- " endif()\n"
- "endif()\n"
- )
+ set(ALGO "${CMAKE_MATCH_1}")
+ set(EXPECT_VALUE "${CMAKE_MATCH_2}")
else()
- set(hash_check "")
+ set(ALGO "")
+ set(EXPECT_VALUE "")
endif()
set(TLS_VERIFY_CODE "")
@@ -904,41 +899,23 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p
set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")")
endif()
- file(WRITE ${script_filename}
-"${hash_check}message(STATUS \"downloading...
- src='${REMOTE}'
- dst='${LOCAL}'
- timeout='${TIMEOUT_MSG}'\")
-
-${TLS_VERIFY_CODE}
-${TLS_CAINFO_CODE}
-
-file(DOWNLOAD
- \"${REMOTE}\"
- \"${LOCAL}\"
- ${SHOW_PROGRESS}
- ${TIMEOUT_ARGS}
- STATUS status
- LOG log)
-
-list(GET status 0 status_code)
-list(GET status 1 status_string)
-
-if(NOT status_code EQUAL 0)
- message(FATAL_ERROR \"error: downloading '${REMOTE}' failed
- status_code: \${status_code}
- status_string: \${status_string}
- log: \${log}
-\")
-endif()
-
-message(STATUS \"downloading... done\")
-"
-)
-
+ # Used variables:
+ # * TLS_VERIFY_CODE
+ # * TLS_CAINFO_CODE
+ # * ALGO
+ # * EXPECT_VALUE
+ # * REMOTE
+ # * LOCAL
+ # * SHOW_PROGRESS
+ # * TIMEOUT_ARGS
+ # * TIMEOUT_MSG
+ configure_file(
+ "${_ExternalProject_SELF_DIR}/ExternalProject-download.cmake.in"
+ "${script_filename}"
+ @ONLY
+ )
endfunction()
-
function(_ep_write_verifyfile_script script_filename LOCAL hash)
if("${hash}" MATCHES "${_ep_hash_regex}")
set(ALGO "${CMAKE_MATCH_1}")
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e7d5e4b4bf864fa779e2fc90dfb352588bf82246
commit e7d5e4b4bf864fa779e2fc90dfb352588bf82246
Author: Ruslan Baratov <ruslan_baratov at yahoo.com>
AuthorDate: Thu May 19 15:00:40 2016 +0300
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu May 19 11:20:25 2016 -0400
ExternalProject: Re-implement download verification as a dedicated script
Move the content to a `ExternalProject-verify.cmake.in` file and use
`configure_file` to generate the final script.
diff --git a/Modules/ExternalProject-verify.cmake.in b/Modules/ExternalProject-verify.cmake.in
new file mode 100644
index 0000000..1d8db96
--- /dev/null
+++ b/Modules/ExternalProject-verify.cmake.in
@@ -0,0 +1,48 @@
+#=============================================================================
+# Copyright 2008-2013 Kitware, Inc.
+# Copyright 2016 Ruslan Baratov
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+cmake_minimum_required(VERSION 3.5)
+
+if("@LOCAL@" STREQUAL "")
+ message(FATAL_ERROR "LOCAL can't be empty")
+endif()
+
+if(NOT EXISTS "@LOCAL@")
+ message(FATAL_ERROR "File not found: @LOCAL@")
+endif()
+
+if("@ALGO@" STREQUAL "")
+ message(WARNING "File will not be verified since no URL_HASH specified")
+ return()
+endif()
+
+if("@EXPECT_VALUE@" STREQUAL "")
+ message(FATAL_ERROR "EXPECT_VALUE can't be empty")
+endif()
+
+message(STATUS "verifying file...
+ file='@LOCAL@'")
+
+file("@ALGO@" "@LOCAL@" actual_value)
+
+if(NOT "${actual_value}" STREQUAL "@EXPECT_VALUE@")
+ message(FATAL_ERROR "error: @ALGO@ hash of
+ @LOCAL@
+does not match expected value
+ expected: '@EXPECT_VALUE@'
+ actual: '${actual_value}'
+")
+endif()
+
+message(STATUS "verifying file... done")
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 9752fc7..2249501 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -377,6 +377,7 @@ file::
#=============================================================================
# Copyright 2008-2013 Kitware, Inc.
+# Copyright 2016 Ruslan Baratov
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -418,6 +419,9 @@ endif()
set(_ep_hash_algos "MD5|SHA1|SHA224|SHA256|SHA384|SHA512")
set(_ep_hash_regex "^(${_ep_hash_algos})=([0-9A-Fa-f]+)$")
+set(_ExternalProject_SELF "${CMAKE_CURRENT_LIST_FILE}")
+get_filename_component(_ExternalProject_SELF_DIR "${_ExternalProject_SELF}" PATH)
+
function(_ep_parse_arguments f name ns args)
# Transfer the arguments to this function into target properties for the
# new custom target we just added so that we can set up all the build steps
@@ -937,33 +941,22 @@ endfunction()
function(_ep_write_verifyfile_script script_filename LOCAL hash)
if("${hash}" MATCHES "${_ep_hash_regex}")
- set(algo "${CMAKE_MATCH_1}")
- string(TOLOWER "${CMAKE_MATCH_2}" expect_value)
- set(script_content "set(expect_value \"${expect_value}\")
-set(succeeded 0)
- file(${algo} \"\${file}\" actual_value)
- if(\"\${actual_value}\" STREQUAL \"\${expect_value}\")
- set(succeeded 1)
- endif()
-
-if(\${succeeded})
- message(STATUS \"verifying file... done\")
-else()
- message(FATAL_ERROR \"error: ${algo} hash of
- \${file}
-does not match expected value
- expected: \${expect_value}
- actual: \${actual_value}
-\")
-endif()")
+ set(ALGO "${CMAKE_MATCH_1}")
+ string(TOLOWER "${CMAKE_MATCH_2}" EXPECT_VALUE)
else()
- set(script_content "message(STATUS \"verifying file... warning: did not verify file - no URL_HASH specified?\")")
+ set(ALGO "")
+ set(EXPECT_VALUE "")
endif()
- file(WRITE ${script_filename} "set(file \"${LOCAL}\")
-message(STATUS \"verifying file...
- file='\${file}'\")
-${script_content}
-")
+
+ # Used variables:
+ # * ALGO
+ # * EXPECT_VALUE
+ # * LOCAL
+ configure_file(
+ "${_ExternalProject_SELF_DIR}/ExternalProject-verify.cmake.in"
+ "${script_filename}"
+ @ONLY
+ )
endfunction()
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ebcc70271db52bd1ce8322485235152ac2c859aa
commit ebcc70271db52bd1ce8322485235152ac2c859aa
Author: Ruslan Baratov <ruslan_baratov at yahoo.com>
AuthorDate: Thu May 19 14:51:43 2016 +0300
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu May 19 11:15:59 2016 -0400
ExternalProject: Avoid repeating download verification
Verify step for downloaded files will be performed in separate script.
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 1755643..9752fc7 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1928,6 +1928,7 @@ function(_ep_add_download_command name)
set(steps "download, verify and extract")
endif ()
set(comment "Performing download step (${steps}) for '${name}'")
+ file(WRITE "${stamp_dir}/verify-${name}.cmake" "") # already verified by 'download_script'
else()
set(file "${url}")
if (no_extract)
@@ -1936,8 +1937,8 @@ function(_ep_add_download_command name)
set(steps "verify and extract")
endif ()
set(comment "Performing download step (${steps}) for '${name}'")
+ _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}")
endif()
- _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}")
list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake
COMMAND)
if (NOT no_extract)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=33218f6a9373583d56a6ce73752f2365ac3779f5
commit 33218f6a9373583d56a6ce73752f2365ac3779f5
Author: Ruslan Baratov <ruslan_baratov at yahoo.com>
AuthorDate: Thu May 19 14:48:49 2016 +0300
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu May 19 11:01:12 2016 -0400
ExternalProject: Remove unused verify script logic
The logic to re-run the download script will be moved elsewhere.
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index e97ecfc..1755643 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -935,30 +935,16 @@ message(STATUS \"downloading... done\")
endfunction()
-function(_ep_write_verifyfile_script script_filename LOCAL hash download_script)
- set(retries 0)
+function(_ep_write_verifyfile_script script_filename LOCAL hash)
if("${hash}" MATCHES "${_ep_hash_regex}")
set(algo "${CMAKE_MATCH_1}")
string(TOLOWER "${CMAKE_MATCH_2}" expect_value)
set(script_content "set(expect_value \"${expect_value}\")
-set(attempt 0)
set(succeeded 0)
-while(\${attempt} LESS ${retries} OR \${attempt} EQUAL ${retries} AND NOT \${succeeded})
file(${algo} \"\${file}\" actual_value)
if(\"\${actual_value}\" STREQUAL \"\${expect_value}\")
set(succeeded 1)
- elseif(\${attempt} LESS ${retries})
- message(STATUS \"${algo} hash of \${file}
-does not match expected value
- expected: \${expect_value}
- actual: \${actual_value}
-Retrying download.
-\")
- file(REMOVE \"\${file}\")
- execute_process(COMMAND \${CMAKE_COMMAND} -P \"${download_script}\")
endif()
- math(EXPR attempt \"\${attempt} + 1\")
-endwhile()
if(\${succeeded})
message(STATUS \"verifying file... done\")
@@ -1899,7 +1885,6 @@ function(_ep_add_download_command name)
set(repository "external project URL")
set(module "${url}")
set(tag "${hash}")
- set(download_script "")
configure_file(
"${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
"${stamp_dir}/${name}-urlinfo.txt"
@@ -1952,7 +1937,7 @@ function(_ep_add_download_command name)
endif ()
set(comment "Performing download step (${steps}) for '${name}'")
endif()
- _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}" "${download_script}")
+ _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}")
list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake
COMMAND)
if (NOT no_extract)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e5409d1e0f38c9869748cca6f6f0c089a3e40ee1
commit e5409d1e0f38c9869748cca6f6f0c089a3e40ee1
Author: Ruslan Baratov <ruslan_baratov at yahoo.com>
AuthorDate: Thu May 19 14:41:52 2016 +0300
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu May 19 10:58:08 2016 -0400
ExternalProject: Remove unused 'retries' argument from verify script
There is no retries for local files and retry logic is broken for downloads.
Will be implemented in '*-download.cmake' script.
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index f30f8a5..e97ecfc 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -935,7 +935,8 @@ message(STATUS \"downloading... done\")
endfunction()
-function(_ep_write_verifyfile_script script_filename LOCAL hash retries download_script)
+function(_ep_write_verifyfile_script script_filename LOCAL hash download_script)
+ set(retries 0)
if("${hash}" MATCHES "${_ep_hash_regex}")
set(algo "${CMAKE_MATCH_1}")
string(TOLOWER "${CMAKE_MATCH_2}" expect_value)
@@ -1898,7 +1899,6 @@ function(_ep_add_download_command name)
set(repository "external project URL")
set(module "${url}")
set(tag "${hash}")
- set(retries 0)
set(download_script "")
configure_file(
"${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
@@ -1937,7 +1937,6 @@ function(_ep_add_download_command name)
_ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}")
set(cmd ${CMAKE_COMMAND} -P "${download_script}"
COMMAND)
- set(retries 3)
if (no_extract)
set(steps "download and verify")
else ()
@@ -1953,7 +1952,7 @@ function(_ep_add_download_command name)
endif ()
set(comment "Performing download step (${steps}) for '${name}'")
endif()
- _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}" "${retries}" "${download_script}")
+ _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}" "${download_script}")
list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake
COMMAND)
if (NOT no_extract)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d610407cca18af075693d4e9243aee06c4ce469c
commit d610407cca18af075693d4e9243aee06c4ce469c
Author: Ruslan Baratov <ruslan_baratov at yahoo.com>
AuthorDate: Thu May 19 14:38:06 2016 +0300
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu May 19 10:54:33 2016 -0400
ExternalProject: Use uppercase placeholders for script generation
Use uppercase variables for future 'configure_file' command.
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index ec846b9..f30f8a5 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -847,25 +847,25 @@ endif()
endfunction(_ep_write_gitupdate_script)
-function(_ep_write_downloadfile_script script_filename remote local timeout no_progress hash tls_verify tls_cainfo)
+function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo)
if(timeout)
- set(timeout_args TIMEOUT ${timeout})
- set(timeout_msg "${timeout} seconds")
+ set(TIMEOUT_ARGS TIMEOUT ${timeout})
+ set(TIMEOUT_MSG "${timeout} seconds")
else()
- set(timeout_args "# no TIMEOUT")
- set(timeout_msg "none")
+ set(TIMEOUT_ARGS "# no TIMEOUT")
+ set(TIMEOUT_MSG "none")
endif()
if(no_progress)
- set(show_progress "")
+ set(SHOW_PROGRESS "")
else()
- set(show_progress "SHOW_PROGRESS")
+ set(SHOW_PROGRESS "SHOW_PROGRESS")
endif()
if("${hash}" MATCHES "${_ep_hash_regex}")
string(CONCAT hash_check
- "if(EXISTS \"${local}\")\n"
- " file(\"${CMAKE_MATCH_1}\" \"${local}\" hash_value)\n"
+ "if(EXISTS \"${LOCAL}\")\n"
+ " file(\"${CMAKE_MATCH_1}\" \"${LOCAL}\" hash_value)\n"
" if(\"x\${hash_value}\" STREQUAL \"x${CMAKE_MATCH_2}\")\n"
" return()\n"
" endif()\n"
@@ -875,15 +875,15 @@ function(_ep_write_downloadfile_script script_filename remote local timeout no_p
set(hash_check "")
endif()
- set(tls_verify_code "")
- set(tls_cainfo_code "")
+ set(TLS_VERIFY_CODE "")
+ set(TLS_CAINFO_CODE "")
# check for curl globals in the project
if(DEFINED CMAKE_TLS_VERIFY)
- set(tls_verify_code "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})")
+ set(TLS_VERIFY_CODE "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})")
endif()
if(DEFINED CMAKE_TLS_CAINFO)
- set(tls_cainfo_code "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")")
+ set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")")
endif()
# now check for curl locals so that the local values
@@ -892,28 +892,28 @@ function(_ep_write_downloadfile_script script_filename remote local timeout no_p
# check for tls_verify argument
string(LENGTH "${tls_verify}" tls_verify_len)
if(tls_verify_len GREATER 0)
- set(tls_verify_code "set(CMAKE_TLS_VERIFY ${tls_verify})")
+ set(TLS_VERIFY_CODE "set(CMAKE_TLS_VERIFY ${tls_verify})")
endif()
# check for tls_cainfo argument
string(LENGTH "${tls_cainfo}" tls_cainfo_len)
if(tls_cainfo_len GREATER 0)
- set(tls_cainfo_code "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")")
+ set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")")
endif()
file(WRITE ${script_filename}
"${hash_check}message(STATUS \"downloading...
- src='${remote}'
- dst='${local}'
- timeout='${timeout_msg}'\")
+ src='${REMOTE}'
+ dst='${LOCAL}'
+ timeout='${TIMEOUT_MSG}'\")
-${tls_verify_code}
-${tls_cainfo_code}
+${TLS_VERIFY_CODE}
+${TLS_CAINFO_CODE}
file(DOWNLOAD
- \"${remote}\"
- \"${local}\"
- ${show_progress}
- ${timeout_args}
+ \"${REMOTE}\"
+ \"${LOCAL}\"
+ ${SHOW_PROGRESS}
+ ${TIMEOUT_ARGS}
STATUS status
LOG log)
@@ -921,7 +921,7 @@ list(GET status 0 status_code)
list(GET status 1 status_string)
if(NOT status_code EQUAL 0)
- message(FATAL_ERROR \"error: downloading '${remote}' failed
+ message(FATAL_ERROR \"error: downloading '${REMOTE}' failed
status_code: \${status_code}
status_string: \${status_string}
log: \${log}
@@ -935,7 +935,7 @@ message(STATUS \"downloading... done\")
endfunction()
-function(_ep_write_verifyfile_script script_filename local hash retries download_script)
+function(_ep_write_verifyfile_script script_filename LOCAL hash retries download_script)
if("${hash}" MATCHES "${_ep_hash_regex}")
set(algo "${CMAKE_MATCH_1}")
string(TOLOWER "${CMAKE_MATCH_2}" expect_value)
@@ -972,7 +972,7 @@ endif()")
else()
set(script_content "message(STATUS \"verifying file... warning: did not verify file - no URL_HASH specified?\")")
endif()
- file(WRITE ${script_filename} "set(file \"${local}\")
+ file(WRITE ${script_filename} "set(file \"${LOCAL}\")
message(STATUS \"verifying file...
file='\${file}'\")
${script_content}
-----------------------------------------------------------------------
Summary of changes:
Modules/ExternalProject-download.cmake.in | 161 +++++++++++++++++++++++++++++
Modules/ExternalProject-verify.cmake.in | 48 +++++++++
Modules/ExternalProject.cmake | 155 ++++++++++-----------------
3 files changed, 264 insertions(+), 100 deletions(-)
create mode 100644 Modules/ExternalProject-download.cmake.in
create mode 100644 Modules/ExternalProject-verify.cmake.in
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list