Add wget retry (#2455)
authorKonstantin Satunin <konstantin.satunin@intel.com>
Tue, 29 Sep 2020 16:10:04 +0000 (19:10 +0300)
committerGitHub <noreply@github.com>
Tue, 29 Sep 2020 16:10:04 +0000 (19:10 +0300)
* Add wget retry

Make CMake download more tolerant to network issues

* Sync log message

cmake/download/download_and_check.cmake

index 83f8e84..b18c4e3 100644 (file)
@@ -22,8 +22,11 @@ function (DownloadAndCheck from to fatal result)
           Download(${from} ${to} ${fatal} ${result} output)
           list(GET output 0 status_code)
         else()
-          message(STATUS "${WGET_EXECUTABLE} --no-cache ${from}")
-          execute_process(COMMAND ${WGET_EXECUTABLE} "--no-cache" "--no-check-certificate" "${from}" "-O" "${to}"
+          message(STATUS "${WGET_EXECUTABLE} --no-cache --no-check-certificate 
+            --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 --tries=5 ${from}")
+          execute_process(COMMAND ${WGET_EXECUTABLE} "--no-cache" "--no-check-certificate" 
+            "--retry-connrefused" "--waitretry=1" "--read-timeout=20" "--timeout=15" "--tries=5" 
+            "${from}" "-O" "${to}"
             TIMEOUT 2000
             RESULT_VARIABLE status_code)
         endif()