Merge topic 'tar-portability'

edae4023 cmArchiveWrite: do not store sparse files when using standard tar formats
This commit is contained in:
Brad King 2015-07-07 09:53:52 -04:00 committed by CMake Topic Stage
commit 86bbcdfeb8
2 changed files with 11 additions and 1 deletions

View File

@ -84,7 +84,8 @@ cmArchiveWrite::cmArchiveWrite(
Stream(os),
Archive(archive_write_new()),
Disk(archive_read_disk_new()),
Verbose(false)
Verbose(false),
Format(format)
{
switch (c)
{
@ -282,6 +283,14 @@ bool cmArchiveWrite::AddFile(const char* file,
archive_entry_acl_clear(e);
archive_entry_xattr_clear(e);
archive_entry_set_fflags(e, 0, 0);
if (this->Format == "pax" || this->Format == "paxr")
{
// Sparse files are a GNU tar extension.
// Do not use them in standard tar files.
archive_entry_sparse_clear(e);
}
if(archive_write_header(this->Archive, e) != ARCHIVE_OK)
{
this->Error = "archive_write_header: ";

View File

@ -84,6 +84,7 @@ private:
struct archive* Archive;
struct archive* Disk;
bool Verbose;
std::string Format;
std::string Error;
std::string MTime;
};