summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-05-30 13:39:23 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-05-30 13:39:35 (GMT)
commit05af1770a05e00d67f12f4e3ef294360d8d6480d (patch)
treeaa3df4cd9049aaa6c7db42084590e4166cf5ec37 /Source
parentc68efd196eace176bed5216573d99fabba66df84 (diff)
parent53cb1f2d04bc9ca7bd50bd3b1a60dc933eab0777 (diff)
downloadCMake-05af1770a05e00d67f12f4e3ef294360d8d6480d.zip
CMake-05af1770a05e00d67f12f4e3ef294360d8d6480d.tar.gz
CMake-05af1770a05e00d67f12f4e3ef294360d8d6480d.tar.bz2
Merge topic 'tar-zstd-compression'
53cb1f2d04 cmake: Teach cmake -E tar command, Zstandard compression Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3357
Diffstat (limited to 'Source')
-rw-r--r--Source/cmArchiveWrite.cxx7
-rw-r--r--Source/cmArchiveWrite.h3
-rw-r--r--Source/cmSystemTools.cxx3
-rw-r--r--Source/cmSystemTools.h1
-rw-r--r--Source/cmcmd.cxx9
5 files changed, 19 insertions, 4 deletions
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 2453aea..8b9a517 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1557,6 +1557,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 09a4d13..f07de6d 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -447,6 +447,7 @@ public:
TarCompressGZip,
TarCompressBZip2,
TarCompressXZ,
+ TarCompressZstd,
TarCompressNone
};
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 4ddfddd..e37dbe8 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) {