mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 22:59:56 -05:00
Merge topic 'file-download-url-error'
cc2cbfc61e file: Add more context to errors from file(DOWNLOAD)
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10672
This commit is contained in:
+15
-12
@@ -2131,7 +2131,8 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
|
||||
if (!file.empty()) {
|
||||
fout.open(file.c_str(), std::ios::binary);
|
||||
if (!fout) {
|
||||
status.SetError("DOWNLOAD cannot open file for write.");
|
||||
status.SetError(cmStrCat("DOWNLOAD cannot open file for write\n",
|
||||
" file: \"", file, '"'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2320,16 +2321,18 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
|
||||
//
|
||||
if (hash) {
|
||||
if (res != CURLE_OK) {
|
||||
status.SetError(cmStrCat(
|
||||
"DOWNLOAD cannot compute hash on failed download\n"
|
||||
" status: [",
|
||||
static_cast<int>(res), ";\"", ::curl_easy_strerror(res), "\"]"));
|
||||
status.SetError(
|
||||
cmStrCat("DOWNLOAD cannot compute hash on failed download\n"
|
||||
" from url: \"",
|
||||
url, "\"\n status: [", static_cast<int>(res), ";\"",
|
||||
::curl_easy_strerror(res), "\"]"));
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string actualHash = hash->HashFile(file);
|
||||
if (actualHash.empty()) {
|
||||
status.SetError("DOWNLOAD cannot compute hash on downloaded file");
|
||||
status.SetError(cmStrCat("DOWNLOAD cannot compute hash on download\n",
|
||||
" for file: \"", file, '"'));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2343,14 +2346,14 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
|
||||
}
|
||||
|
||||
status.SetError(cmStrCat("DOWNLOAD HASH mismatch\n"
|
||||
" for file: [",
|
||||
" for file: \"",
|
||||
file,
|
||||
"]\n"
|
||||
" expected hash: [",
|
||||
"\"\n"
|
||||
" expected hash: \"",
|
||||
expectedHash,
|
||||
"]\n"
|
||||
" actual hash: [",
|
||||
actualHash, "]\n"));
|
||||
"\"\n"
|
||||
" actual hash: \"",
|
||||
actualHash, "\"\n"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user