Notes |
|
(0027073)
|
winfriedd
|
2011-07-26 14:13
(edited on: 2011-07-26 14:25) |
|
I made some modifications agains the CPackRPM.cmake of cmake 2.8.5 to implement this issue.
If component installation is turned the CPACK_RPM_PRE_INSTALL_SCRIPT_FILE and friends variables can be overridden with:
CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE
CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE
CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE
CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE
If they are not specified the CPACK_RPM_PRE_INSTALL_SCRIPT_FILE etc. variables are used (for backwards compatibility).
I will attach the modified module and a simple test project with 2 components.
Hopefully this can be accepted for 2.8.6
regards, Winfried
ps: what I don't understand and don't like is that in the attached test project I have to set the CPACK_RPM_COMPONENT1_POST_INSTALL_SCRIPT_FILE etc variables in the CMakeLists.txt of the root directory. If I set them in the CMakeLists.txt of one of the subdirectories they are not set in CPackRPM.cmake...
|
|
|
(0027075)
|
Eric NOULARD
|
2011-07-26 16:23
|
|
Thank you winfried,
I'll review your patch.
But probably not before a week or two.
Concerning the location of "where" you can set(CPACK_xxx) in order to get them
defined in CPackRPM.cmake this is a "SCOPE" issue.
CPackRPM.cmake is loaded "at CPack-time" and CMakeLists.txt are loaded at "CMake-time".
CPackRPM.cmake inherits from the vars defined in CPackConfig.cmake (in your build tree).
CPackConfig.cmake gets created by the include(CPack.cmake) probably done in
your main CMakeLists.txt. This inclusion gets all CPACK_<whatever> vars defined
before the inclusion and put them in the generated CPackConfig.cmake.
CPACK_xx variable defined in subdirs are out of the scope of the main CMakeLists.txt (unless you use PARENT_SCOPE or CACHE) thus the problem.
The solution should be either put the var in global SCOPE
or define those in a separate CPACK_PROJECT_CONFIG_FILE:
http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29 [^]
this file gets loaded at CPack-time. |
|
|
(0027094)
|
winfriedd
|
2011-07-28 04:22
|
|
Thanks for the clarification.
If the patch needs any changes let me know, or edit yourself as you see fit. |
|
|
(0027095)
|
winfriedd
|
2011-07-28 07:35
|
|
Please use file rpmcomponenttest2.tar.bz2 for testing, that one is for cmake 2.8.5. The first uploaded tar ball (for cmake 2.8.4) can be deleted, but I don't seem to be able to delete it myself. |
|
|
(0027455)
|
Chip Christian
|
2011-09-19 15:32
|
|
This patch works well for me, but I see a problem for non-component installs:
CPACK_RPM_POST_INSTALL_READ_FILE, etc. are only set iff CPACK_RPM_PACKAGE_COMPONENT is set |
|
|
(0027458)
|
Chip Christian
|
2011-09-20 10:32
|
|
Try the patch I just uploaded. Should work correctly now with or without a COMPONENT install. Also fixed up the else/endifs. |
|
|
(0027459)
|
Eric NOULARD
|
2011-09-20 10:37
|
|
I'll do that may be tonight or in a day or two.
Thank you for you contribution. |
|
|
(0027460)
|
Eric NOULARD
|
2011-09-20 14:24
|
|
Just merged to next with small editing.
Merge topic 'CPackRPM-per-component-script' into next
cc26a06 CPackRPM authorize per-component pre/post-[un]install scripts (0012063) |
|
|
(0028825)
|
David Cole
|
2012-03-06 08:37
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|