mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 20:46:37 +08:00
@@ -546,20 +546,23 @@ Available commands are:
|
|||||||
Compress the resulting archive with bzip2.
|
Compress the resulting archive with bzip2.
|
||||||
``J``
|
``J``
|
||||||
Compress the resulting archive with XZ.
|
Compress the resulting archive with XZ.
|
||||||
``--``
|
``--zstd``
|
||||||
Stop interpreting options and treat all remaining arguments
|
Compress the resulting archive with Zstandard.
|
||||||
as file names even if they start in ``-``.
|
|
||||||
``--files-from=<file>``
|
``--files-from=<file>``
|
||||||
Read file names from the given file, one per line.
|
Read file names from the given file, one per line.
|
||||||
Blank lines are ignored. Lines may not start in ``-``
|
Blank lines are ignored. Lines may not start in ``-``
|
||||||
except for ``--add-file=<name>`` to add files whose
|
except for ``--add-file=<name>`` to add files whose
|
||||||
names start in ``-``.
|
names start in ``-``.
|
||||||
``--mtime=<date>``
|
|
||||||
Specify modification time recorded in tarball entries.
|
|
||||||
``--format=<format>``
|
``--format=<format>``
|
||||||
Specify the format of the archive to be created.
|
Specify the format of the archive to be created.
|
||||||
Supported formats are: ``7zip``, ``gnutar``, ``pax``,
|
Supported formats are: ``7zip``, ``gnutar``, ``pax``,
|
||||||
``paxr`` (restricted pax, default), and ``zip``.
|
``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>...]``
|
``time <command> [<args>...]``
|
||||||
Run command and display elapsed time.
|
Run command and display elapsed time.
|
||||||
|
7
Help/release/dev/cmake-e-tar-zstd-support.rst
Normal file
7
Help/release/dev/cmake-e-tar-zstd-support.rst
Normal file
@@ -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.
|
@@ -137,6 +137,13 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
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 !defined(_WIN32) || defined(__CYGWIN__)
|
||||||
if (archive_read_disk_set_standard_lookup(this->Disk) != ARCHIVE_OK) {
|
if (archive_read_disk_set_standard_lookup(this->Disk) != ARCHIVE_OK) {
|
||||||
|
@@ -49,7 +49,8 @@ public:
|
|||||||
CompressGZip,
|
CompressGZip,
|
||||||
CompressBZip2,
|
CompressBZip2,
|
||||||
CompressLZMA,
|
CompressLZMA,
|
||||||
CompressXZ
|
CompressXZ,
|
||||||
|
CompressZstd
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Construct with output stream to which to write archive. */
|
/** Construct with output stream to which to write archive. */
|
||||||
|
@@ -1614,6 +1614,9 @@ bool cmSystemTools::CreateTar(const char* outFileName,
|
|||||||
case TarCompressXZ:
|
case TarCompressXZ:
|
||||||
compress = cmArchiveWrite::CompressXZ;
|
compress = cmArchiveWrite::CompressXZ;
|
||||||
break;
|
break;
|
||||||
|
case TarCompressZstd:
|
||||||
|
compress = cmArchiveWrite::CompressZstd;
|
||||||
|
break;
|
||||||
case TarCompressNone:
|
case TarCompressNone:
|
||||||
compress = cmArchiveWrite::CompressNone;
|
compress = cmArchiveWrite::CompressNone;
|
||||||
break;
|
break;
|
||||||
|
@@ -451,6 +451,7 @@ public:
|
|||||||
TarCompressGZip,
|
TarCompressGZip,
|
||||||
TarCompressBZip2,
|
TarCompressBZip2,
|
||||||
TarCompressXZ,
|
TarCompressXZ,
|
||||||
|
TarCompressZstd,
|
||||||
TarCompressNone
|
TarCompressNone
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1043,11 +1043,17 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
|
|||||||
std::vector<std::string> files;
|
std::vector<std::string> files;
|
||||||
std::string mtime;
|
std::string mtime;
|
||||||
std::string format;
|
std::string format;
|
||||||
|
cmSystemTools::cmTarCompression compress =
|
||||||
|
cmSystemTools::TarCompressNone;
|
||||||
|
int nCompress = 0;
|
||||||
bool doing_options = true;
|
bool doing_options = true;
|
||||||
for (auto const& arg : cmMakeRange(args).advance(4)) {
|
for (auto const& arg : cmMakeRange(args).advance(4)) {
|
||||||
if (doing_options && cmHasLiteralPrefix(arg, "--")) {
|
if (doing_options && cmHasLiteralPrefix(arg, "--")) {
|
||||||
if (arg == "--") {
|
if (arg == "--") {
|
||||||
doing_options = false;
|
doing_options = false;
|
||||||
|
} else if (arg == "--zstd") {
|
||||||
|
compress = cmSystemTools::TarCompressZstd;
|
||||||
|
++nCompress;
|
||||||
} else if (cmHasLiteralPrefix(arg, "--mtime=")) {
|
} else if (cmHasLiteralPrefix(arg, "--mtime=")) {
|
||||||
mtime = arg.substr(8);
|
mtime = arg.substr(8);
|
||||||
} else if (cmHasLiteralPrefix(arg, "--files-from=")) {
|
} 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::cmTarAction action = cmSystemTools::TarActionNone;
|
||||||
cmSystemTools::cmTarCompression compress =
|
|
||||||
cmSystemTools::TarCompressNone;
|
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
int nCompress = 0;
|
|
||||||
|
|
||||||
for (auto flag : flags) {
|
for (auto flag : flags) {
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
|
@@ -27,6 +27,7 @@ run_cmake(gnutar)
|
|||||||
run_cmake(gnutar-gz)
|
run_cmake(gnutar-gz)
|
||||||
run_cmake(pax)
|
run_cmake(pax)
|
||||||
run_cmake(pax-xz)
|
run_cmake(pax-xz)
|
||||||
|
run_cmake(pax-zstd)
|
||||||
run_cmake(paxr)
|
run_cmake(paxr)
|
||||||
run_cmake(paxr-bz2)
|
run_cmake(paxr-bz2)
|
||||||
run_cmake(zip)
|
run_cmake(zip)
|
||||||
|
10
Tests/RunCMake/CommandLineTar/pax-zstd.cmake
Normal file
10
Tests/RunCMake/CommandLineTar/pax-zstd.cmake
Normal file
@@ -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)
|
Reference in New Issue
Block a user