Commit 0c635d40 authored by Andre Sailer's avatar Andre Sailer
Browse files

DownloadURL: add retry loop for download

parent 1fa61325
......@@ -35,10 +35,26 @@ if("${url}" MATCHES "^[a-z]+://")
md5='${md5_msg}'")
endif()
file(DOWNLOAD "${url}" "${file}" ${md5_args} ${timeout_args} STATUS status LOG log)
set(retry_counter 0)
set(status_code 1)
while((NOT ${status_code} EQUAL 0) AND (${retry_counter} LESS 5))
MATH(EXPR retry_counter "${retry_counter}+1")
file(DOWNLOAD "${url}" "${file}" ${md5_args} ${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(WARNING "error: downloading '${remote}' failed
status_code: ${status_code}
status_string: ${status_string}
log: ${log}
retry_counter: ${retry_counter}
")
endif()
endwhile()
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}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment