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 7699c35215babd00f1b41af868592a4ae0046e78 (commit) via a432b93b7919d34e37e202b0c992775a029928d3 (commit) via 1cb9ef817334235fa9ebb57060b6df78d1a0b058 (commit) via f73f0fb357eee40f794abc55a0091e77f50cc62d (commit) via b5e2265fc3a1e8505c6a230b79a2bbb768e5efc5 (commit) from ce5523022767b284f4189f277373f793d3f2ad22 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7699c35215babd00f1b41af868592a4ae0046e78 commit 7699c35215babd00f1b41af868592a4ae0046e78 Merge: ce55230 a432b93 Author: Matt McCormick <matt.mccorm...@kitware.com> AuthorDate: Thu Jan 23 17:39:47 2014 -0500 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Thu Jan 23 17:39:47 2014 -0500 Merge topic 'robust-ep-download-verify' into next a432b93b file DOWNLOAD: Display the curl result status when a hash mismatch occurs. 1cb9ef81 file DOWNLOAD: Test non-zero return status. f73f0fb3 file DOWNLOAD: Add test for bad hash. b5e2265f ExternalProject: Reattempt download when verification fails. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a432b93b7919d34e37e202b0c992775a029928d3 commit a432b93b7919d34e37e202b0c992775a029928d3 Author: Matt McCormick <matt.mccorm...@kitware.com> AuthorDate: Wed Jan 15 20:08:44 2014 -0500 Commit: Matt McCormick <matt.mccorm...@kitware.com> CommitDate: Wed Jan 15 20:08:44 2014 -0500 file DOWNLOAD: Display the curl result status when a hash mismatch occurs. diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 311763b..e79bc6c 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2983,6 +2983,8 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) << " for file: [" << file << "]" << std::endl << " expected hash: [" << expectedHash << "]" << std::endl << " actual hash: [" << actualHash << "]" << std::endl + << " status: [" << (int)res << ";\"" + << ::curl_easy_strerror(res) << "\"]" << std::endl ; this->SetError(oss.str().c_str()); return false; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1cb9ef817334235fa9ebb57060b6df78d1a0b058 commit 1cb9ef817334235fa9ebb57060b6df78d1a0b058 Author: Matt McCormick <matt.mccorm...@kitware.com> AuthorDate: Wed Jan 15 19:40:28 2014 -0500 Commit: Matt McCormick <matt.mccorm...@kitware.com> CommitDate: Wed Jan 15 19:43:25 2014 -0500 file DOWNLOAD: Test non-zero return status. diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in index 91086c6..83ade2b 100644 --- a/Tests/CMakeTests/FileDownloadTest.cmake.in +++ b/Tests/CMakeTests/FileDownloadTest.cmake.in @@ -94,3 +94,16 @@ file(DOWNLOAD EXPECTED_MD5 d16778650db435bda3a8c3435c3ff5d1 ) message(STATUS "${status}") + +message(STATUS "FileDownload:11") +file(DOWNLOAD + badhostname.png + ${dir}/file11.png + TIMEOUT 2 + STATUS status + ) +message(STATUS "${status}") +list(GET status 0 status_code) +if(NOT ${status_code} EQUAL 6) + message(SEND_ERROR "error: expected status code 6 for bad host name, got: ${status_code}") +endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f73f0fb357eee40f794abc55a0091e77f50cc62d commit f73f0fb357eee40f794abc55a0091e77f50cc62d Author: Matt McCormick <matt.mccorm...@kitware.com> AuthorDate: Wed Jan 15 19:27:26 2014 -0500 Commit: Matt McCormick <matt.mccorm...@kitware.com> CommitDate: Wed Jan 15 19:43:23 2014 -0500 file DOWNLOAD: Add test for bad hash. diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index 41714f6..ce36830 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -38,6 +38,10 @@ AddCMakeTest(FileDownload "") set_property(TEST CMake.FileDownload PROPERTY PASS_REGULAR_EXPRESSION "file already exists with expected MD5 sum" ) +AddCMakeTest(FileDownloadBadHash "") +set_property(TEST CMake.FileDownloadBadHash PROPERTY + WILL_FAIL TRUE + ) AddCMakeTest(FileUpload "") diff --git a/Tests/CMakeTests/FileDownloadBadHashTest.cmake.in b/Tests/CMakeTests/FileDownloadBadHashTest.cmake.in new file mode 100644 index 0000000..4a47c06 --- /dev/null +++ b/Tests/CMakeTests/FileDownloadBadHashTest.cmake.in @@ -0,0 +1,10 @@ +set(url "file://@CMAKE_CURRENT_SOURCE_DIR@/FileDownloadInput.png") +set(dir "@CMAKE_CURRENT_BINARY_DIR@/downloads") + +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA1=5555555555555555555555555555555555555555 + ) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b5e2265fc3a1e8505c6a230b79a2bbb768e5efc5 commit b5e2265fc3a1e8505c6a230b79a2bbb768e5efc5 Author: Matt McCormick <matt.mccorm...@kitware.com> AuthorDate: Wed Jan 15 16:31:23 2014 -0500 Commit: Matt McCormick <matt.mccorm...@kitware.com> CommitDate: Wed Jan 15 16:31:23 2014 -0500 ExternalProject: Reattempt download when verification fails. When downloading an URL with ExternalProject, reattempt the download three times if the file hash verification fails. The re-attempt is limited to non-local URL's. The same download CMake script is re-used after removing any file that resulted from the previous download attempt. Up to three re-attempts are performed. diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 63f1180..1c1bd2f 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -585,13 +585,30 @@ message(STATUS \"downloading... done\") endfunction() -function(_ep_write_verifyfile_script script_filename local hash) +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) set(script_content "set(expect_value \"${expect_value}\") -file(${algo} \"\${file}\" actual_value) -if(\"\${actual_value}\" STREQUAL \"\${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() +endwhile() + +if(\${succeeded}) message(STATUS \"verifying file... done\") else() message(FATAL_ERROR \"error: ${algo} hash of @@ -1394,6 +1411,8 @@ 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" "${stamp_dir}/${name}-urlinfo.txt" @@ -1423,16 +1442,17 @@ function(_ep_add_download_command name) get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY) get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO) - _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" - "${url}" "${file}" "${timeout}" "${hash}" "${tls_verify}" "${tls_cainfo}") - set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake + set(download_script "${stamp_dir}/download-${name}.cmake") + _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${hash}" "${tls_verify}" "${tls_cainfo}") + set(cmd ${CMAKE_COMMAND} -P "${download_script}" COMMAND) + set(retries 3) set(comment "Performing download step (download, verify and extract) for '${name}'") else() set(file "${url}") set(comment "Performing download step (verify and extract) for '${name}'") endif() - _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}") + _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}" "${retries}" "${download_script}") list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake COMMAND) _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${name}" "${file}" "${source_dir}") ----------------------------------------------------------------------- Summary of changes: Modules/ExternalProject.cmake | 34 ++++++++++++++++----- Source/cmFileCommand.cxx | 2 ++ Tests/CMakeTests/CMakeLists.txt | 4 +++ Tests/CMakeTests/FileDownloadBadHashTest.cmake.in | 10 ++++++ Tests/CMakeTests/FileDownloadTest.cmake.in | 13 ++++++++ 5 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 Tests/CMakeTests/FileDownloadBadHashTest.cmake.in hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits