[cmake-developers] Adding ZIP and LZMA compression support to libarchive-wrapper

Brad King brad.king at kitware.com
Fri Aug 13 11:05:45 EDT 2010


On 08/12/2010 05:36 PM, Eric Noulard wrote:
> I began working on backporting my previous cmCPackArchiveGenerator component
> support to redesigned CPackAPI **and** the use of libarchive-wrapper (step3).
> 
> The current libarchive-wrapper is missing:
>    - support for ZIP archive which is needed
>    - support for LZMA compression which not needed since not used

Certainly cmArchiveWrite's interface should support any archive type.

> #if !defined(_WIN32) || defined(__CYGWIN__)
>   if (archive_read_disk_set_standard_lookup(this->Disk) != ARCHIVE_OK)
[snip]
> which wasn't conditional before. Since the call has no error check before
> it may have been failing silently on _WIN32 and __CYGWIN....?

If you look at libarchive's implementation of set_standard_lookup it
simply returns failure on Windows and Cygwin.  I guess that's why the
conditional was not checked in the CreateTar version of the code on
which I based cmArchiveWrite.  Certainly your change is better because
it preserves the error handling on platforms where it is expected to
work.

>   // do not pad the last block!!
>   if (archive_write_set_bytes_in_last_block(this->Archive, 1))
>     {
>     this->Error = "archive_write_set_format_pax_restricted: ";
                                       ^^^^^^^^^^^^^^^^^^^^^
This string should match the function in the call.

> Even with those changes the whole CMake testsuite is ok.
> (obviously I miss some Win32 / Cygwin tests).
> 
> Now that I am fully aware of "stage" I may push those to your
> libarchive-wrapper stage if you want.

Please push to github first and send me a pointer.  I'll fetch
it and test on Windows and Cygwin for you.

Thanks,
-Brad



More information about the cmake-developers mailing list