[CMake] CPack RPM with COMPONENTS packaging

Eric Noulard eric.noulard at gmail.com
Wed Mar 20 12:01:28 EDT 2013


2013/3/20 Theodore Papadopoulo <Theodore.Papadopoulo at inria.fr>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 03/20/2013 03:58 PM, Eric Noulard wrote:
>> 2013/3/20 Theodore Papadopoulo <Theodore.Papadopoulo at inria.fr>:
>>>
>>> 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?
>
> The ComponentExample.zip mentionned at
> http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack
>
>>> - 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?
>
> Well there is a difference. Imagine I generate the template as you
> said and then use my template. Later on, I add a new file, the
> filenames in the template being fixed, this file will not be added
> whereas it will with the proposed patch (since the template will
> already not have the file list and cpack will replace them).
>
>>> 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?
>
> As I said above, no there is no difference in my case because the set
> of file is fixed. But the difference will appear if a new file is
> added in a component.

No I don't think so, but I shall check with an example.

Theoretical explanation is:  the variable (@ or $) get expanded
when CPack runs (i.e. at CPack time) not when CMake runs
(i.e. at CMake time) so adding a file to the component implies
CMakeLists.txt change which will trigger CMake re-run
then when CPack run the content of CPACK_RPM_* will be
updated as well.

>>> 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.
>
> Ouch. This is a showstopper for me...
> But not too difficult to do...
> Would the attached patch be a solution ?

May be, I'll check it later today or this WE.

> Works for me at least.

That's already promising.

> Then I'll have to proceed to DEB, NSIS and MacOS BUNDLE packages....
> Should I expect similar problems (looks like NSIS should be easy) and
> I suspect that DEB will be very similar to RPM.

I know NSIS should work since it has full component support
the main difference being that NSIS always generate a single installer file
whereas DEB and RPM do generate 1 file per component group.
see:
cpack --help-variable CPACK_COMPONENTS_GROUPING

So yes DEB is very similar to RPM.
I don't know MacOS BUNDLE enough to tell you the limitation.


>    Thank's again,

You're welcome.
and... wait until you discover you really miss something :-]

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


More information about the CMake mailing list