[CMake] CPACK RPM compression type and level

Eric Noulard eric.noulard at gmail.com
Tue Jul 2 05:24:25 EDT 2013


2013/7/2 Anil Gunturu <anil.gunturu at skyfab.com>:
> Hi,
>
> I understand that CPACK_RPM_COMPRESSION_TYPE can used to change the
> compression type. Is it also possible to specify the compression level?
> Selecting a compression type of gzip puts the following line in the spec
> file:
> %define _binary_payload w9.gzdio
>
>  But is it possible specific fast compression say for example:
> %define _binary_payload w6.gzdio
>
> I am looking to speed up the time for RPM packaging, at the expense
> compression ratio.

Currently the compression level is not configurable, since it was not
designed for that when introduced:
see http://public.kitware.com/Bug/view.php?id=10363.

Have a look at CPackRPM.cmake module and you'll see:

# CPACK_RPM_COMPRESSION_TYPE
#
if (CPACK_RPM_COMPRESSION_TYPE)
   if(CPACK_RPM_PACKAGE_DEBUG)
     message("CPackRPM:Debug: User Specified RPM compression type:
${CPACK_RPM_COMPRESSION_TYPE}")
   endif()
   if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma")
     set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio")
   endif()
   if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz")
     set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio")
   endif()
   if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2")
     set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio")
   endif()
   if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip")
     set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio")
   endif()
else()
   set(CPACK_RPM_COMPRESSION_TYPE_TMP "")
endif()

So if you want to play with the compression level you'll currently
have to patch CPackRPM.cmake.
If you wish you could file a feature request
http://public.kitware.com/Bug/bug_report_page.php
for adding control for the compression level, if you provide a patch
I'll have a look.

As an alternative you can use CPACK_RPM_SPEC_MORE_DEFINE like this:
set(CPACK_RPM_SPEC_MORE_DEFINE "%define _binary_payload w6.gzdio")
and leave CPACK_RPM_COMPRESSION_TYPE empty/undefined.


--
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org


More information about the CMake mailing list