cmake -E tar: add support for .xz files with 'J'
This commit is contained in:
parent
b0a5d3932d
commit
df16dcfb44
|
@ -0,0 +1,5 @@
|
||||||
|
add-xz-support
|
||||||
|
--------------
|
||||||
|
|
||||||
|
* The :manual:`cmake(1)` ``-E tar`` command now supports creating
|
||||||
|
``.xz``-compressed archives with the ``J`` flag.
|
|
@ -1674,7 +1674,8 @@ std::string cmCTest::Base64GzipEncodeFile(std::string file)
|
||||||
std::vector<std::string> files;
|
std::vector<std::string> files;
|
||||||
files.push_back(file);
|
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 "
|
cmCTestLog(this, ERROR_MESSAGE, "Error creating tar while "
|
||||||
"encoding file: " << file << std::endl);
|
"encoding file: " << file << std::endl);
|
||||||
|
|
|
@ -1482,7 +1482,8 @@ bool cmSystemTools::IsPathToFramework(const char* path)
|
||||||
|
|
||||||
bool cmSystemTools::CreateTar(const char* outFileName,
|
bool cmSystemTools::CreateTar(const char* outFileName,
|
||||||
const std::vector<std::string>& files,
|
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)
|
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||||
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
|
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
|
||||||
|
@ -1498,7 +1499,8 @@ bool cmSystemTools::CreateTar(const char* outFileName,
|
||||||
}
|
}
|
||||||
cmArchiveWrite a(fout, (gzip? cmArchiveWrite::CompressGZip :
|
cmArchiveWrite a(fout, (gzip? cmArchiveWrite::CompressGZip :
|
||||||
(bzip2? cmArchiveWrite::CompressBZip2 :
|
(bzip2? cmArchiveWrite::CompressBZip2 :
|
||||||
cmArchiveWrite::CompressNone)),
|
(xz? cmArchiveWrite::CompressXZ :
|
||||||
|
cmArchiveWrite::CompressNone))),
|
||||||
cmArchiveWrite::TypeTAR);
|
cmArchiveWrite::TypeTAR);
|
||||||
a.SetVerbose(verbose);
|
a.SetVerbose(verbose);
|
||||||
for(std::vector<std::string>::const_iterator i = files.begin();
|
for(std::vector<std::string>::const_iterator i = files.begin();
|
||||||
|
|
|
@ -387,7 +387,7 @@ public:
|
||||||
bool gzip, bool verbose);
|
bool gzip, bool verbose);
|
||||||
static bool CreateTar(const char* outFileName,
|
static bool CreateTar(const char* outFileName,
|
||||||
const std::vector<std::string>& files, bool gzip,
|
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,
|
static bool ExtractTar(const char* inFileName, bool gzip,
|
||||||
bool verbose);
|
bool verbose);
|
||||||
// This should be called first thing in main
|
// This should be called first thing in main
|
||||||
|
|
|
@ -71,7 +71,7 @@ void CMakeCommandUsage(const char* program)
|
||||||
<< " remove_directory dir - remove a directory and its contents\n"
|
<< " remove_directory dir - remove a directory and its contents\n"
|
||||||
<< " rename oldname newname - rename a file or directory "
|
<< " rename oldname newname - rename a file or directory "
|
||||||
"(on one volume)\n"
|
"(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"
|
<< " - create or extract a tar or zip archive\n"
|
||||||
<< " sleep <number>... - sleep for given number of seconds\n"
|
<< " sleep <number>... - sleep for given number of seconds\n"
|
||||||
<< " time command [args] ... - run command and return elapsed time\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 gzip = false;
|
||||||
bool bzip2 = false;
|
bool bzip2 = false;
|
||||||
|
bool xz = false;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
if ( flags.find_first_of('j') != flags.npos )
|
if ( flags.find_first_of('j') != flags.npos )
|
||||||
{
|
{
|
||||||
bzip2 = true;
|
bzip2 = true;
|
||||||
}
|
}
|
||||||
|
if ( flags.find_first_of('J') != flags.npos )
|
||||||
|
{
|
||||||
|
xz = true;
|
||||||
|
}
|
||||||
if ( flags.find_first_of('z') != flags.npos )
|
if ( flags.find_first_of('z') != flags.npos )
|
||||||
{
|
{
|
||||||
gzip = true;
|
gzip = true;
|
||||||
|
@ -760,7 +765,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
||||||
else if ( flags.find_first_of('c') != flags.npos )
|
else if ( flags.find_first_of('c') != flags.npos )
|
||||||
{
|
{
|
||||||
if ( !cmSystemTools::CreateTar(
|
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());
|
cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue