[CMake] CPack RPM with COMPONENTS packaging

Eric Noulard eric.noulard at gmail.com
Wed Mar 20 10:58:12 EDT 2013


2013/3/20 Theodore Papadopoulo <Theodore.Papadopoulo at inria.fr>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 03/19/2013 04:06 PM, Eric Noulard wrote:
>
>> See: cpack --help-variable "CPACK_<GENNAME>_COMPONENT_INSTALL"
>>
>> CPACK_<GENNAME>_COMPONENT_INSTALL Enable/Disable component install
>> for CPack generator <GENNAME>.
>>
>> Each CPack Generator (RPM, DEB, ARCHIVE, NSIS, DMG, etc...) has a
>> legacy default behavior.  e.g.  RPM builds monolithic whereas NSIS
>> builds component.  One can change the default behavior by setting
>> this variable to 0/1 or OFF/ON.
>>
>>
>> You have to enable it in you CMakeLists.txt or on the command
>> line: So for RPM:
>>
>> cpack -D CPACK_RPM_COMPONENT_INSTALL=1 -G RPM
>
> That was what I was missing. Thanks. It is a pity that the example
> does not include that. I think this is quite hidden

Which example are you refering to?

>> So that you first need to use:
>> CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE in order to
>> generate a template CPackRPM can handle then modify it and use
>> CPACK_RPM_USER_BINARY_SPECFILE.
>
> Well, I already figured that (even though I just recovered the
> template from the _CPack_Packages directory). The thing is that the
> template is not exactly how I would like it to be. The files to be
> installed are already expanded....
>
> - From CPackRPM.cmake
>
> [...]
> %files
> %defattr(-,root,root,-)
> ${CPACK_RPM_INSTALL_FILES}
> ${CPACK_RPM_ABSOLUTE_INSTALL_FILES}
> ${CPACK_RPM_USER_INSTALL_FILES}
> [...]
>
> That seems a bug...
> Should the following patch be applied ??
>
> diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
> index fa79e1b..e6b0076 100644
> - --- a/Modules/CPackRPM.cmake
> +++ b/Modules/CPackRPM.cmake
> @@ -902,9 +902,9 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\"
> $RPM_BUILD_ROOT
>
>  %files
>  %defattr(-,root,root,-)
> - -${CPACK_RPM_INSTALL_FILES}
> - -${CPACK_RPM_ABSOLUTE_INSTALL_FILES}
> - -${CPACK_RPM_USER_INSTALL_FILES}
> +\@CPACK_RPM_INSTALL_FILES\@
> +\@CPACK_RPM_ABSOLUTE_INSTALL_FILES\@
> +\@CPACK_RPM_USER_INSTALL_FILES\@

This shouldn't make any difference.
The template is expanded at CPack time so that putting
@ or $ should not make any difference unless
you do set those variables at CMake time, Do you do that?

> Anyhow, I guess I have a workaround by placing these lines instead of
> the files in my templates.

And do you observe differences when you do  that?

> But then there is another question, can I use different templates for
> different components ?? One of the bug reports seems to hint at that
> for changing descriptions, but I cannot figure out how to specify per
> component templates.

This is a missing feature.
Not all feature are componentized.

>>> Any help will be appreciated.
>> Hope this helps.
>
> Yes it helped a lot. At least, I can generate component rpms. I still
> have some quirks but at least I'm on some tracks....

Good.
If you have some documentation enhancement suggestion, please to do hesitate
to contribute.


-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list