[CMake] CPack RPM with COMPONENTS packaging
Theodore Papadopoulo
Theodore.Papadopoulo at inria.fr
Wed Mar 20 09:35:07 EDT 2013
-----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
> It is there but incomplete as the list of pending bugs/features
> request can show, see e.g.:
> http://public.kitware.com/Bug/view.php?id=13176
> http://public.kitware.com/Bug/view.php?id=12997 and related ones.
>
>> I can easily provide a spec file, but I would at least wish that
>> the files corresponding to the components be configured. How can
>> I get them.
>
> Try what is already working and see if it already suits your
> needs. If not browse the pending bugs in order to see if any of
> them is related to your specific need. Then ask question here on
> the concerned bug and you'll certainly get specific answer.
>
>> And I cannot even see a clean way to provide CPackRPM with my
>> own template.
>
> You can use CPACK_RPM_USER_BINARY_SPECFILE in order to provide your
> template (see cpack --help-variable
> CPACK_RPM_USER_BINARY_SPECFILE)
>
> but the spec file used by CPackRPM is a "short-cutted" one.
>
> 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\@
%changelog
\@CPACK_RPM_SPEC_CHANGELOG\@
Anyhow, I guess I have a workaround by placing these lines instead of
the files in my templates.
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.
>> 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....
Thanks.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlFJuwsACgkQEr8WrU8nPV12OQCdGTF4Q9zeirvE32ADeefkxpwe
u7sAoLY00zZ1lEJRHIwynEiygOja/6f2
=zW8G
-----END PGP SIGNATURE-----
More information about the CMake
mailing list