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 /Tests/RunCMake/CommandLineTar | |
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 'Tests/RunCMake/CommandLineTar')
-rw-r--r-- | Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLineTar/touch-mtime.cmake | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake b/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake index 079a535..a487f37 100644 --- a/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake @@ -37,3 +37,6 @@ run_cmake(zip-filtered) # Use the --mtime option to set the mtime when creating archive run_cmake(set-mtime) + +# Use the --touch option to avoid extracting the mtime +run_cmake(touch-mtime) diff --git a/Tests/RunCMake/CommandLineTar/touch-mtime.cmake b/Tests/RunCMake/CommandLineTar/touch-mtime.cmake new file mode 100644 index 0000000..c9e3524 --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/touch-mtime.cmake @@ -0,0 +1,13 @@ +include(${CMAKE_CURRENT_LIST_DIR}/mtime-tests.cmake) + +set(DECOMPRESSION_OPTIONS --touch) + +include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake) + +foreach(file ${CHECK_FILES}) + file(TIMESTAMP ${FULL_DECOMPRESS_DIR}/${COMPRESS_DIR}/${file} MTIME UTC) + if(MTIME STREQUAL ARCHIVE_MTIME_RFC3339) + message(FATAL_ERROR + "File has unexpected timestamp ${MTIME}") + endif() +endforeach() |