diff options
author | Kasper Laudrup <you@example.com> | 2022-03-15 18:27:54 (GMT) |
---|---|---|
committer | Kasper Laudrup <you@example.com> | 2022-03-23 13:41:34 (GMT) |
commit | 0b7fd783f82639ba129e62edeac0de6594542708 (patch) | |
tree | 6958f1bb75909c6fa703927b16d184d15a5de9b5 /Source/cmFileCommand.cxx | |
parent | f692cba34b758f5c308c3fd659c438ce022a0a80 (diff) | |
download | CMake-0b7fd783f82639ba129e62edeac0de6594542708.zip CMake-0b7fd783f82639ba129e62edeac0de6594542708.tar.gz CMake-0b7fd783f82639ba129e62edeac0de6594542708.tar.bz2 |
cmake -E tar: Add --touch option
Similar to GNU tar add a --touch option to the tar extract command to
skip extracting the timestamps from the files in the archive
effectively touching them as if they were just created.
Issue: #22746
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 09e5015..e4728ac 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3507,6 +3507,7 @@ bool HandleArchiveExtractCommand(std::vector<std::string> const& args, bool ListOnly = false; std::string Destination; std::vector<std::string> Patterns; + bool Touch = false; }; static auto const parser = cmArgumentParser<Arguments>{} @@ -3514,7 +3515,8 @@ bool HandleArchiveExtractCommand(std::vector<std::string> const& args, .Bind("VERBOSE"_s, &Arguments::Verbose) .Bind("LIST_ONLY"_s, &Arguments::ListOnly) .Bind("DESTINATION"_s, &Arguments::Destination) - .Bind("PATTERNS"_s, &Arguments::Patterns); + .Bind("PATTERNS"_s, &Arguments::Patterns) + .Bind("TOUCH"_s, &Arguments::Touch); std::vector<std::string> unrecognizedArguments; std::vector<std::string> keywordsMissingValues; @@ -3577,8 +3579,11 @@ bool HandleArchiveExtractCommand(std::vector<std::string> const& args, return false; } - if (!cmSystemTools::ExtractTar(inFile, parsedArgs.Patterns, - parsedArgs.Verbose)) { + if (!cmSystemTools::ExtractTar( + inFile, parsedArgs.Patterns, + parsedArgs.Touch ? cmSystemTools::cmTarExtractTimestamps::No + : cmSystemTools::cmTarExtractTimestamps::Yes, + parsedArgs.Verbose)) { status.SetError(cmStrCat("failed to extract: ", inFile)); cmSystemTools::SetFatalErrorOccured(); return false; |