aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-07-24 19:11:27 +0200
committerGitHub <noreply@github.com>2019-07-24 19:11:27 +0200
commit8404e8df20bd093057206b5e7c6a363a24533150 (patch)
treea85578f99374c48eb38a87b8b2c7c5ff21960636
parent431cf56e2f5fd5a389bda481122ac62655d9193c (diff)
downloadrneovim-8404e8df20bd093057206b5e7c6a363a24533150.tar.gz
rneovim-8404e8df20bd093057206b5e7c6a363a24533150.tar.bz2
rneovim-8404e8df20bd093057206b5e7c6a363a24533150.zip
third-party: download: retry (#10599)
This is meant to handle the common case of failing to download libtermkey: FAILED: cd /home/travis/build/neovim/neovim/deps-downloads/libtermkey && /usr/local/cmake-3.12.4/bin/cmake -DPREFIX=/home/travis/nvim-deps/build -DDOWNLOAD_DIR=/home/travis/build/neovim/neovim/deps-downloads/libtermkey -DURL=http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.21.1.tar.gz -DEXPECTED_SHA256=cecbf737f35d18f433c8d7864f63c0f878af41f8bd0255a3ebb16010dc044d5f -DTARGET=libtermkey -DUSE_EXISTING_SRC_DIR=OFF -P /home/travis/build/neovim/neovim/third-party/cmake/DownloadAndExtractFile.cmake && /usr/local/cmake-3.12.4/bin/cmake -E touch /home/travis/nvim-deps/build/src/libtermkey-stamp/libtermkey-download -- file: /home/travis/build/neovim/neovim/deps-downloads/libtermkey/libtermkey-0.21.1.tar.gz -- downloading... src='http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.21.1.tar.gz' dst='/home/travis/build/neovim/neovim/deps-downloads/libtermkey/libtermkey-0.21.1.tar.gz' timeout='none' CMake Error at /home/travis/build/neovim/neovim/third-party/cmake/DownloadAndExtractFile.cmake:77 (message): error: downloading 'http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.21.1.tar.gz' failed status_code: 6 status_string: "Couldn't resolve host name" log: Curl_ipv4_resolve_r failed for www.leonerd.org.uk Couldn't resolve host 'www.leonerd.org.uk' Closing connection 0 Co-Authored-By: Justin M. Keyes <justinkz@gmail.com>
-rw-r--r--third-party/cmake/DownloadAndExtractFile.cmake17
1 files changed, 16 insertions, 1 deletions
diff --git a/third-party/cmake/DownloadAndExtractFile.cmake b/third-party/cmake/DownloadAndExtractFile.cmake
index 15d22e5ca1..bb8cf1b674 100644
--- a/third-party/cmake/DownloadAndExtractFile.cmake
+++ b/third-party/cmake/DownloadAndExtractFile.cmake
@@ -74,11 +74,26 @@ list(GET status 0 status_code)
list(GET status 1 status_string)
if(NOT status_code EQUAL 0)
- message(FATAL_ERROR "error: downloading '${URL}' failed
+ # Retry on certain errors, e.g. CURLE_COULDNT_RESOLVE_HOST, which is often
+ # seen with libtermkey (www.leonerd.org.uk).
+ if(status_code EQUAL 6) # "Couldn't resolve host name"
+ message(STATUS "warning: retrying '${URL}' (${status_string}, status ${status_code})")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 10)
+ file(DOWNLOAD ${URL} ${file}
+ ${timeout_args}
+ ${hash_args}
+ STATUS status
+ LOG log)
+ list(GET status 0 status_code)
+ list(GET status 1 status_string)
+ endif()
+ if(NOT status_code EQUAL 0)
+ message(FATAL_ERROR "error: downloading '${URL}' failed
status_code: ${status_code}
status_string: ${status_string}
log: ${log}
")
+ endif()
endif()
set(NULL_SHA256 "0000000000000000000000000000000000000000000000000000000000000000")