<div dir="ltr">Thanks Eric. Here is the patch for supporting the compression level on cmake 2.8.7.<div>-Anil<br><div><br></div><div><div>---<br></div><div> cmake/modules/patches/CPackRPM.cmake | 51 +++++++++++++++++++++++++++++++---</div>
<div> 1 file changed, 47 insertions(+), 4 deletions(-)</div><div><br></div><div>diff --git a/cmake/modules/patches/CPackRPM.cmake b/cmake/modules/patches/CPackRPM.cmake</div><div>index bf476ad..db4823f 100644</div><div>--- a/cmake/modules/patches/CPackRPM.cmake</div>
<div>+++ b/cmake/modules/patches/CPackRPM.cmake</div><div>@@ -68,6 +68,12 @@</div><div> # to lzma or xz compression whereas older cannot use such RPM.</div><div> # Using this one can enforce compression type to be used.</div>
<div> # Possible value are: lzma, xz, bzip2 and gzip.</div><div>+# CPACK_RPM_COMPRESSION_LEVEL</div><div>+# Mandatory : NO</div><div>+# Default : -</div><div>+# May be used to set the compression level. If this is not specified it defaults</div>
<div>+# to best possible compression level. </div><div>+# Possible values are: 0-9. </div><div> # CPACK_RPM_PACKAGE_REQUIRES</div><div> # Mandatory : NO</div><div> # Default : -</div><div>@@ -374,17 +380,54 @@ IF (CPACK_RPM_COMPRESSION_TYPE)</div>
<div> IF(CPACK_RPM_PACKAGE_DEBUG)</div><div> MESSAGE("CPackRPM:Debug: User Specified RPM compression type: ${CPACK_RPM_COMPRESSION_TYPE}")</div><div> ENDIF(CPACK_RPM_PACKAGE_DEBUG)</div><div>+</div><div>
+ IF(DEFINED CPACK_RPM_COMPRESSION_LEVEL)</div><div>+ # validate the compression level for the compression type</div><div>+ IF(CPACK_RPM_COMPRESSION_LEVEL GREATER 9)</div><div>+ IF(CPACK_RPM_PACKAGE_DEBUG)</div>
<div>+ message("CPackRPM:Debug: Compression level should be less than 9 for lzma")</div><div>+ ENDIF(CPACK_RPM_PACKAGE_DEBUG) </div><div>+ set(CPACK_RPM_COMPRESSION_LEVEL 9)</div><div>+ ENDIF(CPACK_RPM_COMPRESSION_LEVEL GREATER 9)</div>
<div>+</div><div>+ IF(CPACK_RPM_COMPRESSION_LEVEL LESS 0)</div><div>+ IF(CPACK_RPM_PACKAGE_DEBUG)</div><div>+ message("CPackRPM:Debug: Compression level should be greater than 0 for lzma")</div>
<div>+ ENDIF(CPACK_RPM_PACKAGE_DEBUG)</div><div>+ set(CPACK_RPM_COMPRESSION_LEVEL 0)</div><div>+ ENDIF(CPACK_RPM_COMPRESSION_LEVEL LESS 0)</div><div>+ ELSE(DEFINED CPACK_RPM_COMPRESSION_LEVEL)</div><div>
+ # compression level not defined, use the highest level for</div><div>+ # given compression type</div><div>+ IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma")</div><div>+ SET(CPACK_RPM_COMPRESSION_LEVEL 9)</div>
<div>+ ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma")</div><div>+ IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz")</div><div>+ SET(CPACK_RPM_COMPRESSION_LEVEL 7)</div><div>+ ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz")</div>
<div>+ IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2")</div><div>+ SET(CPACK_RPM_COMPRESSION_LEVEL 9)</div><div>+ ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2")</div><div>+ IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip")</div>
<div>+ SET(CPACK_RPM_COMPRESSION_LEVEL 9)</div><div>+ ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip")</div><div>+ ENDIF(DEFINED CPACK_RPM_COMPRESSION_LEVEL)</div><div>+</div><div>+ IF(CPACK_RPM_PACKAGE_DEBUG)</div>
<div>+ message("CPackRPM:Debug: Compression level set to ${CPACK_RPM_COMPRESSION_LEVEL}")</div><div>+ ENDIF(CPACK_RPM_PACKAGE_DEBUG)</div><div>+</div><div> IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma")</div>
<div>- SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio")</div><div>+ SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w${CPACK_RPM_COMPRESSION_LEVEL}.lzdio")</div>
<div> ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma")</div><div> IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz")</div><div>- SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio")</div>
<div>+ SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w${CPACK_RPM_COMPRESSION_LEVEL}.xzdio")</div><div> ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz")</div><div> IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2")</div>
<div>- SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio")</div><div>+ SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w${CPACK_RPM_COMPRESSION_LEVEL}.bzdio")</div>
<div> ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2")</div><div> IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip")</div><div>- SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio")</div>
<div>+ SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w${CPACK_RPM_COMPRESSION_LEVEL}.gzdio")</div><div> ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip")</div><div> ELSE(CPACK_RPM_COMPRESSION_TYPE)</div>
<div> SET(CPACK_RPM_COMPRESSION_TYPE_TMP "")</div><div>-- </div><div>1.7.9.5</div></div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 2, 2013 at 5:24 AM, Eric Noulard <span dir="ltr"><<a href="mailto:eric.noulard@gmail.com" target="_blank">eric.noulard@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2013/7/2 Anil Gunturu <<a href="mailto:anil.gunturu@skyfab.com">anil.gunturu@skyfab.com</a>>:<br>
<div><div class="h5">> Hi,<br>
><br>
> I understand that CPACK_RPM_COMPRESSION_TYPE can used to change the<br>
> compression type. Is it also possible to specify the compression level?<br>
> Selecting a compression type of gzip puts the following line in the spec<br>
> file:<br>
> %define _binary_payload w9.gzdio<br>
><br>
> But is it possible specific fast compression say for example:<br>
> %define _binary_payload w6.gzdio<br>
><br>
> I am looking to speed up the time for RPM packaging, at the expense<br>
> compression ratio.<br>
<br>
</div></div>Currently the compression level is not configurable, since it was not<br>
designed for that when introduced:<br>
see <a href="http://public.kitware.com/Bug/view.php?id=10363" target="_blank">http://public.kitware.com/Bug/view.php?id=10363</a>.<br>
<br>
Have a look at CPackRPM.cmake module and you'll see:<br>
<br>
# CPACK_RPM_COMPRESSION_TYPE<br>
#<br>
if (CPACK_RPM_COMPRESSION_TYPE)<br>
if(CPACK_RPM_PACKAGE_DEBUG)<br>
message("CPackRPM:Debug: User Specified RPM compression type:<br>
${CPACK_RPM_COMPRESSION_TYPE}")<br>
endif()<br>
if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma")<br>
set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio")<br>
endif()<br>
if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz")<br>
set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio")<br>
endif()<br>
if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2")<br>
set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio")<br>
endif()<br>
if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip")<br>
set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio")<br>
endif()<br>
else()<br>
set(CPACK_RPM_COMPRESSION_TYPE_TMP "")<br>
endif()<br>
<br>
So if you want to play with the compression level you'll currently<br>
have to patch CPackRPM.cmake.<br>
If you wish you could file a feature request<br>
<a href="http://public.kitware.com/Bug/bug_report_page.php" target="_blank">http://public.kitware.com/Bug/bug_report_page.php</a><br>
for adding control for the compression level, if you provide a patch<br>
I'll have a look.<br>
<br>
As an alternative you can use CPACK_RPM_SPEC_MORE_DEFINE like this:<br>
set(CPACK_RPM_SPEC_MORE_DEFINE "%define _binary_payload w6.gzdio")<br>
and leave CPACK_RPM_COMPRESSION_TYPE empty/undefined.<br>
<br>
<br>
--<br>
Erk<br>
L'élection n'est pas la démocratie -- <a href="http://www.le-message.org" target="_blank">http://www.le-message.org</a><br>
</blockquote></div><br></div>