This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  dd6870d0dab8ede1a2861016f052897f26541919 (commit)
       via  6c9586f9c7804c4560a43aa6a03e490374174550 (commit)
      from  5aa7416f9bebe43aa98d8ff66e416721706ecbd5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd6870d0dab8ede1a2861016f052897f26541919
commit dd6870d0dab8ede1a2861016f052897f26541919
Merge: 5aa7416 6c9586f
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Thu Feb 25 11:44:44 2016 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Thu Feb 25 11:44:44 2016 -0500

    Merge topic 'file-download-status-hash-mismatch' into next
    
    6c9586f9 file(DOWNLOAD): Fill STATUS variable on hash mismatch (#15987)


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6c9586f9c7804c4560a43aa6a03e490374174550
commit 6c9586f9c7804c4560a43aa6a03e490374174550
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Thu Feb 25 11:28:07 2016 -0500
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Thu Feb 25 11:40:50 2016 -0500

    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 <tob...@hieta.se>

diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index b3557f9..1fa27eb 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -3300,6 +3300,15 @@ 
cmFileCommand::HandleDownloadCommand(std::vector<std::string> 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;
       }
diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-result.txt 
b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt 
b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt
new file mode 100644
index 0000000..406e315
--- /dev/null
+++ b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Error at DOWNLOAD-hash-mismatch.cmake:[0-9]+ \(file\):
+  file DOWNLOAD HASH mismatch
+
+    for file: 
\[.*/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-build/hash-mismatch.txt\]
+      expected hash: \[0123456789abcdef0123456789abcdef01234567\]
+        actual hash: \[da39a3ee5e6b4b0d3255bfef95601890afd80709\]
+             status: \[0;"No error"\]
+
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
++
+status='1;HASH mismatch: expected: 0123456789abcdef0123456789abcdef01234567 
actual: da39a3ee5e6b4b0d3255bfef95601890afd80709'$
diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake 
b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake
new file mode 100644
index 0000000..ca72692
--- /dev/null
+++ b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake
@@ -0,0 +1,7 @@
+file(DOWNLOAD
+  "file://${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-hash-mismatch.txt"
+  ${CMAKE_CURRENT_BINARY_DIR}/hash-mismatch.txt
+  EXPECTED_HASH SHA1=0123456789abcdef0123456789abcdef01234567
+  STATUS status
+  )
+message("status='${status}'")
diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.txt 
b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.txt
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake 
b/Tests/RunCMake/file/RunCMakeTest.cmake
index d3dfb1b..5f85bba 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -1,5 +1,6 @@
 include(RunCMake)
 
+run_cmake(DOWNLOAD-hash-mismatch)
 run_cmake(INSTALL-DIRECTORY)
 run_cmake(INSTALL-MESSAGE-bad)
 run_cmake(FileOpenFailRead)

-----------------------------------------------------------------------

Summary of changes:
 Source/cmFileCommand.cxx                                   |    9 +++++++++
 .../DOWNLOAD-hash-mismatch-result.txt}                     |    0
 Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt      |   12 ++++++++++++
 Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake           |    7 +++++++
 .../RunCMake/file/DOWNLOAD-hash-mismatch.txt               |    0
 Tests/RunCMake/file/RunCMakeTest.cmake                     |    1 +
 6 files changed, 29 insertions(+)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => 
file/DOWNLOAD-hash-mismatch-result.txt} (100%)
 create mode 100644 Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt
 create mode 100644 Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake
 copy Modules/IntelVSImplicitPath/hello.f => 
Tests/RunCMake/file/DOWNLOAD-hash-mismatch.txt (100%)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to