[cmake-developers] [CMake 0012556]: CPackRPM: pre/post-install/uninstall scripts leak from one COMPONENT to the next

Mantis Bug Tracker mantis at public.kitware.com
Thu Nov 3 18:07:42 EDT 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12556 
====================================================================== 
Reported By:                Chip Christian
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12556
Category:                   CPack
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-11-04 00:07 WAST
Last Modified:              2011-11-04 00:07 WAST
====================================================================== 
Summary:                    CPackRPM: pre/post-install/uninstall scripts leak
from one COMPONENT to the next
Description: 
I have 4 COMPONENTS.  One of them needs a pre-uninstall and a post-install
script

Once the scripts are referenced all subsequent COMPONENTS get stuck with the
same scripts.

Steps to Reproduce: 
    SET(CPACK_COMPONENTS_ALL libraries devel internal perl)

    SET(CPACK_RPM_libraries_PRE_UNINSTALL_SCRIPT_FILE
        ${CMAKE_CURRENT_SOURCE_DIR}/rpm/pre-uninstall)
    SET(CPACK_RPM_libraries_POST_INSTALL_SCRIPT_FILE
        ${CMAKE_CURRENT_SOURCE_DIR}/rpm/post-install)
    SET(CPACK_PACKAGE_FILE_NAME
            ${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${ARCHITECTURE})


Additional Information: 
To fix, apply this patch:

--- /usr/share/cmake/Modules/CPackRPM.cmake     2011-10-04 11:09:24.000000000
-0500
+++ cmake/CPackRPM.cmake        2011-11-03 09:59:36.216592884 -0500
@@ -421,6 +421,8 @@
 # The refered script file(s) will be read and directly
 # put after the %post or %postun section
 if(CPACK_RPM_PACKAGE_COMPONENT)
+  set(CPACK_RPM_SPEC_POSTUNINSTALL "")
+  set(CPACK_RPM_SPEC_POSTINSTALL "")
   if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE)
     set(CPACK_RPM_POST_INSTALL_READ_FILE
${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE})
   else()
@@ -457,6 +459,8 @@
 # The refered script file(s) will be read and directly
 # put after the %pre or %preun section
 if(CPACK_RPM_PACKAGE_COMPONENT)
+  set(CPACK_RPM_SPEC_PREUNINSTALL "")
+  set(CPACK_RPM_SPEC_PREINSTALL "")
   if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE)
     set(CPACK_RPM_PRE_INSTALL_READ_FILE
${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE})
   else(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE)

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-11-04 00:07 Chip Christian New Issue                                    
======================================================================




More information about the cmake-developers mailing list