summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/release/dev/add-xz-support.rst5
-rw-r--r--Source/cmCTest.cxx3
-rw-r--r--Source/cmSystemTools.cxx6
-rw-r--r--Source/cmSystemTools.h2
-rw-r--r--Source/cmcmd.cxx9
5 files changed, 19 insertions, 6 deletions
diff --git a/Help/release/dev/add-xz-support.rst b/Help/release/dev/add-xz-support.rst
new file mode 100644
index 0000000..9bdf528
--- /dev/null
+++ b/Help/release/dev/add-xz-support.rst
@@ -0,0 +1,5 @@
+add-xz-support
+--------------
+
+* The :manual:`cmake(1)` ``-E tar`` command now supports creating
+ ``.xz``-compressed archives with the ``J`` flag.
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 80dbaf3..f02d78e 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1674,7 +1674,8 @@ std::string cmCTest::Base64GzipEncodeFile(std::string file)
std::vector<std::string> files;
files.push_back(file);
- if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false, false))
+ if(!cmSystemTools::CreateTar(tarFile.c_str(), files,
+ true, false, false, false))
{
cmCTestLog(this, ERROR_MESSAGE, "Error creating tar while "
"encoding file: " << file << std::endl);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 1c8c387..cd63347 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1482,7 +1482,8 @@ bool cmSystemTools::IsPathToFramework(const char* path)
bool cmSystemTools::CreateTar(const char* outFileName,
const std::vector<std::string>& files,
- bool gzip, bool bzip2, bool verbose)
+ bool gzip, bool bzip2, bool xz,
+ bool verbose)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
@@ -1498,7 +1499,8 @@ bool cmSystemTools::CreateTar(const char* outFileName,
}
cmArchiveWrite a(fout, (gzip? cmArchiveWrite::CompressGZip :
(bzip2? cmArchiveWrite::CompressBZip2 :
- cmArchiveWrite::CompressNone)),
+ (xz? cmArchiveWrite::CompressXZ :
+ cmArchiveWrite::CompressNone))),
cmArchiveWrite::TypeTAR);
a.SetVerbose(verbose);
for(std::vector<std::string>::const_iterator i = files.begin();
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index d49af74..47d2771 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -387,7 +387,7 @@ public:
bool gzip, bool verbose);
static bool CreateTar(const char* outFileName,
const std::vector<std::string>& files, bool gzip,
- bool bzip2, bool verbose);
+ bool bzip2, bool xz, bool verbose);
static bool ExtractTar(const char* inFileName, bool gzip,
bool verbose);
// This should be called first thing in main
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index f2f028a..6b3efb5 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -71,7 +71,7 @@ void CMakeCommandUsage(const char* program)
<< " remove_directory dir - remove a directory and its contents\n"
<< " rename oldname newname - rename a file or directory "
"(on one volume)\n"
- << " tar [cxt][vf][zj] file.tar [file/dir1 file/dir2 ...]\n"
+ << " tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]\n"
<< " - create or extract a tar or zip archive\n"
<< " sleep <number>... - sleep for given number of seconds\n"
<< " time command [args] ... - run command and return elapsed time\n"
@@ -735,11 +735,16 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
bool gzip = false;
bool bzip2 = false;
+ bool xz = false;
bool verbose = false;
if ( flags.find_first_of('j') != flags.npos )
{
bzip2 = true;
}
+ if ( flags.find_first_of('J') != flags.npos )
+ {
+ xz = true;
+ }
if ( flags.find_first_of('z') != flags.npos )
{
gzip = true;
@@ -760,7 +765,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
else if ( flags.find_first_of('c') != flags.npos )
{
if ( !cmSystemTools::CreateTar(
- outFile.c_str(), files, gzip, bzip2, verbose) )
+ outFile.c_str(), files, gzip, bzip2, xz, verbose) )
{
cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
return 1;