From 87a40b720a53ea70bfa4466a52aa696e1940cd0d Mon Sep 17 00:00:00 2001 From: Michael Hirsch Date: Sun, 21 Aug 2022 23:42:28 -0400 Subject: file(DOWNLOAD): Fix message for existing file with matching hash file(DOWNLOAD STATUS) docs say the return list is of length 2. However, when an already downloaded file hash matches EXPECTED_HASH, the return message had a semicolon that made the return list length 3. Adjust the message to no longer contain the extra semicolon and to more clearly describe the situation. --- Source/cmFileCommand.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 330d991..7810040 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1914,7 +1914,7 @@ bool HandleDownloadCommand(std::vector const& args, std::string msg; std::string actualHash = hash->HashFile(file); if (actualHash == expectedHash) { - msg = cmStrCat("returning early; file already exists with expected ", + msg = cmStrCat("skipping download as file already exists with expected ", hashMatchMSG, '"'); if (!statusVar.empty()) { status.GetMakefile().AddDefinition(statusVar, cmStrCat(0, ";\"", msg)); -- cgit v0.12 From 666b3c6f1305e4cb9d42bead935f95debb6cb543 Mon Sep 17 00:00:00 2001 From: Michael Hirsch Date: Sun, 21 Aug 2022 23:46:57 -0400 Subject: Help: Clarify file(DOWNLOAD) behavior for existing file with same hash --- Help/command/file.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Help/command/file.rst b/Help/command/file.rst index 3374d2d..fbe2a81 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -1121,8 +1121,11 @@ Additional options to ``DOWNLOAD`` are: Verify that the downloaded content hash matches the expected value, where ``ALGO`` is one of the algorithms supported by ``file()``. - If it does not match, the operation fails with an error. It is an error to - specify this if ``DOWNLOAD`` is not given a ````. + If the file already exists and matches the hash, the download is skipped. + If the file already exists and does not match the hash, the file is + downloaded again. If after download the file does not match the hash, the + operation fails with an error. It is an error to specify this option if + ``DOWNLOAD`` is not given a ````. ``EXPECTED_MD5 `` Historical short-hand for ``EXPECTED_HASH MD5=``. It is an error to -- cgit v0.12