Commit Graph

15 Commits

Author SHA1 Message Date
Daniel Pfeifer f931a18c33 CPack: add generators for .7z and .tar.xz (#13072, #14519) 2014-07-29 09:48:41 -04:00
Clinton Stimpson 71c981a213 Encoding: Fix potential encoding issues with libarchive on Windows.
Because the 8bit string encoding in libarchive can be different than
the 8bit string encoding in CMake, change to call the wide version
of libarchive functions.  They are different if CMake is configured
to use UTF-8 as the internal encoding.

Create helper functions for some libarchive calls to use wstring
internally on platforms supporting it.
2014-07-02 09:49:45 -04:00
Brad King c14010e4ea Merge topic 'archive-null-error'
b508de59 cmArchiveWrite: Handle NULL error string (#14882)
2014-04-17 09:10:56 -04:00
Brad King b508de59e8 cmArchiveWrite: Handle NULL error string (#14882)
If archive_error_string returns NULL, use a placeholder string instead
of crashing.
2014-04-16 13:13:28 -04:00
Clinton Stimpson 5730710c86 Use cmsys::[io]fstream instead of cmsys_ios::[io]fstream.
Also use SystemTools::Fopen() instead of fopen().
This is to eventually support utf-8 filenames.
2014-01-07 09:27:44 -05:00
Brad King a34015d356 cmArchiveWrite: Clear fflags from archive entries
When reading archive entries from disk strip any "fflags" entry headers
that may have been loaded from the filesystem when libarchive is built
with HAVE_STRUCT_STAT_ST_FLAGS (struct stat has 'st_flags').  The local
filesystem flags are not useful for distribution.  Furthermore, GNU tar
does not understand the "SCHILY.fflags" extended header used to store
the flags in the archive.  Use the approach from commit e8558efa
(cmArchiveWrite: Clear xattr and acl from entries, 2011-04-07) to remove
the flags and avoid producing the non-portable extended header.
2012-06-06 07:29:19 -04:00
Eric NOULARD 768cf91831 Do not add the content of a file if it's a symlink.
This wasn't necessary for TAR-like (TGZ, TBZ2, etc...) archive
because for those the size was 0. Either there is an error in
upstream libarchive concerning the size or we should not rely
on size of the entry for adding content.
2012-01-13 13:48:14 -05:00
Johan Björk d78bdb2783 CMake: Write symlinks to directories as files in archives (#12284)
Do not recurse through directory symlinks when adding files.

Recursing through directory symlinks will generate broken archives,
i.e., they will look something like this:
  foo -> bar/bar
  foo/Info <- Shouldn't be in archive.
  bar/bar
  bar/bar/Info
2011-09-06 13:58:00 -04:00
Brad King e8558efa01 cmArchiveWrite: Clear xattr and acl from entries (#11958)
When reading archive entries from disk strip any xattr and acl entry
headers that may have been loaded from the filesystem (e.g. selinux).
These fields are only useful for backup tools and not for packaging and
distribution of software.  Furthermore, the GNU tar 1.15.1 on at least
one Linux distribution treats unknown entry headers as an error rather
than a warning.  Therefore avoiding such fields is necessary for archive
portability.

Suggested-by: Tim Kientzle <tim@kientzle.com>
2011-04-07 08:27:56 -04:00
Eric NOULARD fb41da4a6b Add Compress compress support to libarchive-wrapper 2010-08-16 20:45:05 +02:00
Eric NOULARD 1a3ad5c615 Add XZ compress support to libarchive-wrapper
This is not needed but it does not cost much to do it for all
potentially supported format in libarchive. XZ and LZMA are not
builtin libarchive and require external lib but if
CMAKE_USE_SYSTEM_LIBARCHIVE is ON then we may get it for free.
2010-08-13 17:51:27 +02:00
Eric NOULARD b50c15915a Add ZIP archive format and LZMA compress support to libarchive-wrapper
This will be needed to use cmArchiveWrire in cmCPackArchiveGenerator
with the same feature set as before. Note that adding zip
support to libarchive-wrapper would also makes it easy to add
a new -E zip command to cmake commands.
2010-08-13 17:49:47 +02:00
Brad King 4663356079 cmArchiveWrite: Fix signed/unsigned again
Some stream libraries return size_t from gcount() and some return
ssize_t.  Add an explicit cast to ios::streamsize for its return value.
Also refactor use of nnext to reduce the use of casts.
2010-08-11 09:47:04 -04:00
Brad King aef672311a cmArchiveWrite: Fix signed/unsigned compare/convert
The libarchive interface accepts size_t but returns ssize_t.  The std
streams interface wants streamsize, which is typically ssize_t.  Since
no one type for our variable matches without conversions, make the
conversions explicit to avoid -Wsign-conversion and -Wsign-compare
warnings.
2010-08-09 10:43:03 -04:00
Brad King c7c90095d4 Create class cmArchiveWrite to wrap libarchive (#11020) 2010-08-06 11:38:05 -04:00