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, master has been updated
       via  05af1770a05e00d67f12f4e3ef294360d8d6480d (commit)
       via  53cb1f2d04bc9ca7bd50bd3b1a60dc933eab0777 (commit)
      from  c68efd196eace176bed5216573d99fabba66df84 (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=05af1770a05e00d67f12f4e3ef294360d8d6480d
commit 05af1770a05e00d67f12f4e3ef294360d8d6480d
Merge: c68efd1 53cb1f2
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Thu May 30 13:39:23 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Thu May 30 09:39:35 2019 -0400

    Merge topic 'tar-zstd-compression'
    
    53cb1f2d04 cmake: Teach cmake -E tar command, Zstandard compression
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3357


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=53cb1f2d04bc9ca7bd50bd3b1a60dc933eab0777
commit 53cb1f2d04bc9ca7bd50bd3b1a60dc933eab0777
Author:     Bartosz Kosiorek <gan...@poczta.onet.pl>
AuthorDate: Mon Mar 11 23:26:04 2019 +0100
Commit:     Bartosz Kosiorek <gan...@poczta.onet.pl>
CommitDate: Wed May 22 03:46:55 2019 +0200

    cmake: Teach cmake -E tar command, Zstandard compression
    
    Fixes #18657

diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index df0d4c5..eddc3cb 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -546,20 +546,23 @@ Available commands are:
     Compress the resulting archive with bzip2.
   ``J``
     Compress the resulting archive with XZ.
-  ``--``
-    Stop interpreting options and treat all remaining arguments
-    as file names even if they start in ``-``.
+  ``--zstd``
+    Compress the resulting archive with Zstandard.
   ``--files-from=<file>``
     Read file names from the given file, one per line.
     Blank lines are ignored.  Lines may not start in ``-``
     except for ``--add-file=<name>`` to add files whose
     names start in ``-``.
-  ``--mtime=<date>``
-    Specify modification time recorded in tarball entries.
   ``--format=<format>``
     Specify the format of the archive to be created.
     Supported formats are: ``7zip``, ``gnutar``, ``pax``,
     ``paxr`` (restricted pax, default), and ``zip``.
+  ``--mtime=<date>``
+    Specify modification time recorded in tarball entries.
+  ``--``
+    Stop interpreting options and treat all remaining arguments
+    as file names, even if they start with ``-``.
+
 
 ``time <command> [<args>...]``
   Run command and display elapsed time.
diff --git a/Help/release/dev/cmake-e-tar-zstd-support.rst 
b/Help/release/dev/cmake-e-tar-zstd-support.rst
new file mode 100644
index 0000000..e3488b5
--- /dev/null
+++ b/Help/release/dev/cmake-e-tar-zstd-support.rst
@@ -0,0 +1,7 @@
+Help/release/dev/cmake-e-tar-zstd-support
+-----------------------------------------
+
+* The :manual:`cmake(1)` ``-E tar`` tool now support Zstandard compression
+  algorithm with ``--zstd`` option. Zstandard was designed to give
+  a compression ratio comparable to that of the DEFLATE (zip) algorithm,
+  but faster, especially for decompression.
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index 177ba02..359d57a 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -137,6 +137,13 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress 
c,
         return;
       }
       break;
+    case CompressZstd:
+      if (archive_write_add_filter_zstd(this->Archive) != ARCHIVE_OK) {
+        this->Error = "archive_write_add_filter_zstd: ";
+        this->Error += cm_archive_error_string(this->Archive);
+        return;
+      }
+      break;
   }
 #if !defined(_WIN32) || defined(__CYGWIN__)
   if (archive_read_disk_set_standard_lookup(this->Disk) != ARCHIVE_OK) {
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index 1f23dae..9ea88d3 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -49,7 +49,8 @@ public:
     CompressGZip,
     CompressBZip2,
     CompressLZMA,
-    CompressXZ
+    CompressXZ,
+    CompressZstd
   };
 
   /** Construct with output stream to which to write archive.  */
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 545e6c5..4ba04ed 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1614,6 +1614,9 @@ bool cmSystemTools::CreateTar(const char* outFileName,
     case TarCompressXZ:
       compress = cmArchiveWrite::CompressXZ;
       break;
+    case TarCompressZstd:
+      compress = cmArchiveWrite::CompressZstd;
+      break;
     case TarCompressNone:
       compress = cmArchiveWrite::CompressNone;
       break;
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index d145d47..64d6d7a 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -451,6 +451,7 @@ public:
     TarCompressGZip,
     TarCompressBZip2,
     TarCompressXZ,
+    TarCompressZstd,
     TarCompressNone
   };
 
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 3c75957..e1b6f48 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1043,11 +1043,17 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> 
const& args)
       std::vector<std::string> files;
       std::string mtime;
       std::string format;
+      cmSystemTools::cmTarCompression compress =
+        cmSystemTools::TarCompressNone;
+      int nCompress = 0;
       bool doing_options = true;
       for (auto const& arg : cmMakeRange(args).advance(4)) {
         if (doing_options && cmHasLiteralPrefix(arg, "--")) {
           if (arg == "--") {
             doing_options = false;
+          } else if (arg == "--zstd") {
+            compress = cmSystemTools::TarCompressZstd;
+            ++nCompress;
           } else if (cmHasLiteralPrefix(arg, "--mtime=")) {
             mtime = arg.substr(8);
           } else if (cmHasLiteralPrefix(arg, "--files-from=")) {
@@ -1075,10 +1081,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> 
const& args)
         }
       }
       cmSystemTools::cmTarAction action = cmSystemTools::TarActionNone;
-      cmSystemTools::cmTarCompression compress =
-        cmSystemTools::TarCompressNone;
       bool verbose = false;
-      int nCompress = 0;
 
       for (auto flag : flags) {
         switch (flag) {
diff --git a/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake 
b/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake
index 5deb110..4ed9535 100644
--- a/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake
@@ -27,6 +27,7 @@ run_cmake(gnutar)
 run_cmake(gnutar-gz)
 run_cmake(pax)
 run_cmake(pax-xz)
+run_cmake(pax-zstd)
 run_cmake(paxr)
 run_cmake(paxr-bz2)
 run_cmake(zip)
diff --git a/Tests/RunCMake/CommandLineTar/pax-zstd.cmake 
b/Tests/RunCMake/CommandLineTar/pax-zstd.cmake
new file mode 100644
index 0000000..c2a304d
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/pax-zstd.cmake
@@ -0,0 +1,10 @@
+set(OUTPUT_NAME "test.tar.zstd")
+
+set(COMPRESSION_FLAGS cvf)
+set(COMPRESSION_OPTIONS --format=pax --zstd)
+
+set(DECOMPRESSION_FLAGS xvf)
+
+include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake)
+
+check_magic("28b52ffd0058" LIMIT 6 HEX)

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

Summary of changes:
 Help/manual/cmake.1.rst                          | 13 ++++++++-----
 Help/release/dev/cmake-e-tar-zstd-support.rst    |  7 +++++++
 Source/cmArchiveWrite.cxx                        |  7 +++++++
 Source/cmArchiveWrite.h                          |  3 ++-
 Source/cmSystemTools.cxx                         |  3 +++
 Source/cmSystemTools.h                           |  1 +
 Source/cmcmd.cxx                                 |  9 ++++++---
 Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake |  1 +
 Tests/RunCMake/CommandLineTar/pax-zstd.cmake     | 10 ++++++++++
 9 files changed, 45 insertions(+), 9 deletions(-)
 create mode 100644 Help/release/dev/cmake-e-tar-zstd-support.rst
 create mode 100644 Tests/RunCMake/CommandLineTar/pax-zstd.cmake


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
https://cmake.org/mailman/listinfo/cmake-commits

Reply via email to