Thanks Eric. Here is the patch for supporting the compression level on cmake 2.8.7. -Anil
--- cmake/modules/patches/CPackRPM.cmake | 51 +++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/cmake/modules/patches/CPackRPM.cmake b/cmake/modules/patches/CPackRPM.cmake index bf476ad..db4823f 100644 --- a/cmake/modules/patches/CPackRPM.cmake +++ b/cmake/modules/patches/CPackRPM.cmake @@ -68,6 +68,12 @@ # to lzma or xz compression whereas older cannot use such RPM. # Using this one can enforce compression type to be used. # Possible value are: lzma, xz, bzip2 and gzip. +# CPACK_RPM_COMPRESSION_LEVEL +# Mandatory : NO +# Default : - +# May be used to set the compression level. If this is not specified it defaults +# to best possible compression level. +# Possible values are: 0-9. # CPACK_RPM_PACKAGE_REQUIRES # Mandatory : NO # Default : - @@ -374,17 +380,54 @@ IF (CPACK_RPM_COMPRESSION_TYPE) IF(CPACK_RPM_PACKAGE_DEBUG) MESSAGE("CPackRPM:Debug: User Specified RPM compression type: ${CPACK_RPM_COMPRESSION_TYPE}") ENDIF(CPACK_RPM_PACKAGE_DEBUG) + + IF(DEFINED CPACK_RPM_COMPRESSION_LEVEL) + # validate the compression level for the compression type + IF(CPACK_RPM_COMPRESSION_LEVEL GREATER 9) + IF(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Compression level should be less than 9 for lzma") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) + set(CPACK_RPM_COMPRESSION_LEVEL 9) + ENDIF(CPACK_RPM_COMPRESSION_LEVEL GREATER 9) + + IF(CPACK_RPM_COMPRESSION_LEVEL LESS 0) + IF(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Compression level should be greater than 0 for lzma") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) + set(CPACK_RPM_COMPRESSION_LEVEL 0) + ENDIF(CPACK_RPM_COMPRESSION_LEVEL LESS 0) + ELSE(DEFINED CPACK_RPM_COMPRESSION_LEVEL) + # compression level not defined, use the highest level for + # given compression type + IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") + SET(CPACK_RPM_COMPRESSION_LEVEL 9) + ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") + IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") + SET(CPACK_RPM_COMPRESSION_LEVEL 7) + ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") + IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") + SET(CPACK_RPM_COMPRESSION_LEVEL 9) + ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") + IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") + SET(CPACK_RPM_COMPRESSION_LEVEL 9) + ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") + ENDIF(DEFINED CPACK_RPM_COMPRESSION_LEVEL) + + IF(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Compression level set to ${CPACK_RPM_COMPRESSION_LEVEL}") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) + IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") - SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio") + SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w${CPACK_RPM_COMPRESSION_LEVEL}.lzdio") ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") - SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio") + SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w${CPACK_RPM_COMPRESSION_LEVEL}.xzdio") ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") - SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio") + SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w${CPACK_RPM_COMPRESSION_LEVEL}.bzdio") ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") - SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio") + SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w${CPACK_RPM_COMPRESSION_LEVEL}.gzdio") ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") ELSE(CPACK_RPM_COMPRESSION_TYPE) SET(CPACK_RPM_COMPRESSION_TYPE_TMP "") -- 1.7.9.5 On Tue, Jul 2, 2013 at 5:24 AM, Eric Noulard <eric.noul...@gmail.com> wrote: > 2013/7/2 Anil Gunturu <anil.gunt...@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 >
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake