MantisBT - CMake
View Issue Details
0008988CMakeCPackpublic2009-05-08 11:432009-11-22 13:32
Eric NOULARD 
Eric NOULARD 
normalfeaturealways
closedfixed 
CMake-2-6 
CMake-2-8 
0008988: CPack RPM generator should support post (un)install scripts and/or custom spec file
The RPM spec file enables the developer to specify some
actions (i.e. scripts) to be run:

before installing (%pre)
or after installing (%post).

In the same way before un-installing (%preun)
or after un-installing (%postun)
more informations there:
http://www.rpm.org/max-rpm/s1-rpm-inside-scripts.html [^]

Some CPack RPM users may want to use thoses features:
http://www.cmake.org/pipermail/cmake/2009-May/029247.html [^]
No tags attached.
? CPackRPM.cmake (14,709) 2009-05-08 13:39
https://public.kitware.com/Bug/file/2225/CPackRPM.cmake
patch bug-8988-erk1.patch (9,692) 2009-05-08 13:39
https://public.kitware.com/Bug/file/2226/bug-8988-erk1.patch
Issue History
2009-05-08 11:43Eric NOULARDNew Issue
2009-05-08 13:39Eric NOULARDFile Added: CPackRPM.cmake
2009-05-08 13:39Eric NOULARDFile Added: bug-8988-erk1.patch
2009-05-08 13:49Eric NOULARDNote Added: 0016357
2009-05-12 10:07Eric NOULARDNote Added: 0016397
2009-05-12 10:08Eric NOULARDNote Added: 0016398
2009-09-14 14:49Bill HoffmanStatusnew => assigned
2009-09-14 14:49Bill HoffmanAssigned To => Alex Neundorf
2009-09-14 14:49Bill HoffmanAssigned ToAlex Neundorf => Bill Hoffman
2009-10-07 15:27Eric NOULARDNote Added: 0018018
2009-11-11 15:55Eric NOULARDNote Added: 0018396
2009-11-11 15:56Eric NOULARDNote Added: 0018397
2009-11-22 13:32Eric NOULARDAssigned ToBill Hoffman => Eric NOULARD
2009-11-22 13:32Eric NOULARDNote Added: 0018537
2009-11-22 13:32Eric NOULARDStatusassigned => closed
2009-11-22 13:32Eric NOULARDResolutionopen => fixed
2009-11-22 13:32Eric NOULARDFixed in Version => CMake-2-8

Notes
(0016357)
Eric NOULARD   
2009-05-08 13:49   
The attached patch (against CMake-2-6 branch) add
the requested support.

if the user defines one or several of thoses vars:
CPACK_RPM_POST_INSTALL_SCRIPT_FILE
CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE

with appropriate file names, the content of the specified files
will be embedded in the RPM spec file in the appropriate sections.

Moreover the current patch add custom user spec file.
If the user defines
CPACK_RPM_USER_BINARY_SPECFILE
to a custom made spec file, CPack RPM will use this spec file
instead of using its own generated spec file.
The user provided file will be
CONFIGURE( ... @ONLY) at CPack time.

Since the spec file usable by CPack RPM is a bit special
(because it skips some usual spec file step) one can ask CPackRPM
for a template file using

cd /your/build/dir
cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM

then CPack will end with the following "error":
CPack: Compress package
CMake Error at ../../cmake-Verk-2_6/share/cmake-2.6/Modules/CPackRPM.cmake:314 (MESSAGE):
  CPackRPM: STOP here Generated USER binary spec file templare is:
  /home/eric/CMake/builds/CMake-V2_6-CDTbuild/_CPack_Packages/Linux-x86_64/RPM/SPECS/cmake.spec.in

the user may copy the spec file and make appropriate changes before
using it with CPACK_RPM_USER_BINARY_SPECFILE.

Note that as usual all this CPACK_RPM_xxx vars may be defined either in
the user CMakeLists.txt or from the cpack command line.
(0016397)
Eric NOULARD   
2009-05-12 10:07   
Seems to be working OK for at least one user
http://www.cmake.org/pipermail/cmake/2009-May/029383.html [^]
(0016398)
Eric NOULARD   
2009-05-12 10:08   
More discussion on the topic there
http://www.cmake.org/pipermail/cmake/2009-May/029348.html [^]
(0018018)
Eric NOULARD   
2009-10-07 15:27   
This patch will need an update for CMake-2.8
see related bugs:
http://public.kitware.com/Bug/view.php?id=9679 [^]
(0018396)
Eric NOULARD   
2009-11-11 15:55   
Preparing updated patch for CVS HEAD.
(0018397)
Eric NOULARD   
2009-11-11 15:56   
Committed to HEAD.

Committer: Eric Noulard <eric.noulard@gmail.com>
/cvsroot/CMake/CMake/Modules/CPackRPM.cmake,v <-- Modules/CPackRPM.cmake
new revision: 1.18; previous revision: 1.17
(0018537)
Eric NOULARD   
2009-11-22 13:32   
may be included in 2.8.1