From 6c9586f9c7804c4560a43aa6a03e490374174550 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 25 Feb 2016 11:28:07 -0500 Subject: file(DOWNLOAD): Fill STATUS variable on hash mismatch (#15987) Although we fail with an error on a hash mismatch, it is not a fatal error so the script may continue processing. If the download itself had no error then report in the STATUS variable that the operation was not successful due to the hash mismatch. Suggested-by: Tobias Hieta --- Source/cmFileCommand.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Source/cmFileCommand.cxx') diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index b3557f9a29..1fa27eb47c 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3300,6 +3300,15 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) << " status: [" << (int)res << ";\"" << ::curl_easy_strerror(res) << "\"]" << std::endl ; + + if(!statusVar.empty() && res == 0) + { + std::string status = "1;HASH mismatch: " + "expected: " + expectedHash + + " actual: " + actualHash; + this->Makefile->AddDefinition(statusVar, status.c_str()); + } + this->SetError(oss.str()); return false; } -- cgit v1.2.1