diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2018-03-01 11:10:19 -0800 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2018-03-01 11:10:19 -0800 |
| commit | a0eece81c68faf9713441c3aeb283a16bc232c52 (patch) | |
| tree | e52caa36777341a0a976e448629611ec332223e1 /scripts | |
| parent | 523b61169498e60168e56f956a9cf63e1d324079 (diff) | |
| download | vcpkg-a0eece81c68faf9713441c3aeb283a16bc232c52.tar.gz vcpkg-a0eece81c68faf9713441c3aeb283a16bc232c52.zip | |
[vcpkg-download-distfile] Add proxy usage information to download failed message
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/cmake/vcpkg_download_distfile.cmake | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index af4926008..4b111f3f0 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -71,22 +71,22 @@ function(vcpkg_download_distfile VAR) file(REMOVE_RECURSE "${DOWNLOADS}/temp") file(MAKE_DIRECTORY "${DOWNLOADS}/temp") - function(test_hash FILE_KIND CUSTOM_ERROR_ADVICE) + function(test_hash FILE_PATH FILE_KIND CUSTOM_ERROR_ADVICE) if(_VCPKG_INTERNAL_NO_HASH_CHECK) # When using the internal hash skip, do not output an explicit message. return() endif() if(vcpkg_download_distfile_SKIP_SHA512) - message(STATUS "Skipping hash check for ${downloaded_file_path}.") + message(STATUS "Skipping hash check for ${FILE_PATH}.") return() endif() message(STATUS "Testing integrity of ${FILE_KIND}...") - file(SHA512 ${downloaded_file_path} FILE_HASH) + file(SHA512 ${FILE_PATH} FILE_HASH) if(NOT "${FILE_HASH}" STREQUAL "${vcpkg_download_distfile_SHA512}") message(FATAL_ERROR "\nFile does not have expected hash:\n" - " File path: [ ${downloaded_file_path} ]\n" + " File path: [ ${FILE_PATH} ]\n" " Expected hash: [ ${vcpkg_download_distfile_SHA512} ]\n" " Actual hash: [ ${FILE_HASH} ]\n" "${CUSTOM_ERROR_ADVICE}\n") @@ -96,7 +96,7 @@ function(vcpkg_download_distfile VAR) if(EXISTS ${downloaded_file_path}) message(STATUS "Using cached ${downloaded_file_path}") - test_hash("cached file" "Please delete the file and retry if this file should be downloaded again.") + test_hash("${downloaded_file_path}" "cached file" "Please delete the file and retry if this file should be downloaded again.") else() if(_VCPKG_NO_DOWNLOADS) message(FATAL_ERROR "Downloads are disabled, but '${downloaded_file_path}' does not exist.") @@ -111,9 +111,6 @@ function(vcpkg_download_distfile VAR) message(STATUS "Downloading ${url}... Failed. Status: ${download_status}") set(download_success 0) else() - get_filename_component(downloaded_file_dir "${downloaded_file_path}" DIRECTORY) - file(MAKE_DIRECTORY "${downloaded_file_dir}") - file(RENAME ${download_file_path_part} ${downloaded_file_path}) message(STATUS "Downloading ${url}... OK") set(download_success 1) break() @@ -122,11 +119,16 @@ function(vcpkg_download_distfile VAR) if (NOT download_success) message(FATAL_ERROR - "\n" + " \n" " Failed to download file.\n" - " Add mirrors or submit an issue at https://github.com/Microsoft/vcpkg/issues\n") + " If you use a proxy, please set the HTTPS_PROXY and HTTP_PROXY environment\n" + " variables to \"https://user:password@your-proxy-ip-address:port/\".\n" + " Otherwise, please submit an issue at https://github.com/Microsoft/vcpkg/issues\n") else() - test_hash("downloaded file" "The file may have been corrupted in transit.") + test_hash("${download_file_path_part}" "downloaded file" "The file may have been corrupted in transit. This can be caused by proxies. If you use a proxy, please set the HTTPS_PROXY and HTTP_PROXY environment variables to \"https://user:password@your-proxy-ip-address:port/\".\n") + get_filename_component(downloaded_file_dir "${downloaded_file_path}" DIRECTORY) + file(MAKE_DIRECTORY "${downloaded_file_dir}") + file(RENAME ${download_file_path_part} ${downloaded_file_path}) endif() endif() set(${VAR} ${downloaded_file_path} PARENT_SCOPE) |
