diff options
author | Eric NOULARD <eric.noulard@gmail.com> | 2010-11-13 16:56:36 (GMT) |
---|---|---|
committer | Eric NOULARD <eric.noulard@gmail.com> | 2010-11-13 16:56:36 (GMT) |
commit | 2c84d169b36b1b8713517a8d8799b82dbf59725a (patch) | |
tree | 13cef3ebb30eda89fd3907c7b098cb4c8f2b8de9 /Modules/CPackRPM.cmake | |
parent | d95017deec954ad81253c9d545eaeb323c52ac0e (diff) | |
download | CMake-2c84d169b36b1b8713517a8d8799b82dbf59725a.zip CMake-2c84d169b36b1b8713517a8d8799b82dbf59725a.tar.gz CMake-2c84d169b36b1b8713517a8d8799b82dbf59725a.tar.bz2 |
CPackRPM add basic component support to CPackRPM
basic means 1 RPM per component and no dependency handling
this implies some CPackGenerator refactoring
Diffstat (limited to 'Modules/CPackRPM.cmake')
-rw-r--r-- | Modules/CPackRPM.cmake | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index e2d78802..ab909f4 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -331,7 +331,7 @@ ELSE(CPACK_RPM_COMPRESSION_TYPE) ENDIF(CPACK_RPM_COMPRESSION_TYPE) if(CPACK_PACKAGE_RELOCATABLE) - set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) + set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) endif(CPACK_PACKAGE_RELOCATABLE) if(CPACK_RPM_PACKAGE_RELOCATABLE) if(CPACK_RPM_PACKAGE_DEBUG) @@ -453,6 +453,17 @@ SET(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") #STRING(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") + +# Are we packaging components ? +IF(CPACK_RPM_PACKAGE_COMPONENT) + SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") + SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "/${CPACK_RPM_PACKAGE_COMPONENT}") + SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_RPM_PACKAGE_COMPONENT}") +ELSE(CPACK_RPM_PACKAGE_COMPONENT) + SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "") + SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "") + SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}") +ENDIF(CPACK_RPM_PACKAGE_COMPONENT) # Use files tree to construct files command (spec file) # We should not forget to include symlinks (thus -o -type l) # We must remove the './' due to the local search and escape the @@ -460,10 +471,10 @@ SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") # Then we must authorize any man pages extension (adding * at the end) # because rpmbuild may automatically compress those files EXECUTE_PROCESS(COMMAND find -type f -o -type l - COMMAND sed {s:.*/man.*/.*:&*:} - COMMAND sed {s/\\.\\\(.*\\\)/\"\\1\"/} - WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" - OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) + COMMAND sed {s:.*/man.*/.*:&*:} + COMMAND sed {s/\\.\\\(.*\\\)/\"\\1\"/} + WORKING_DIRECTORY "${WDIR}" + OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) if (CPACK_ABSOLUTE_DESTINATION_FILES) IF(CPACK_RPM_PACKAGE_DEBUG) @@ -494,7 +505,7 @@ if (CPACK_ABSOLUTE_DESTINATION_FILES) endif(CPACK_ABSOLUTE_DESTINATION_FILES) # The name of the final spec file to be used by rpmbuild -SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec") +SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") # Print out some debug information if we were asked for that IF(CPACK_RPM_PACKAGE_DEBUG) @@ -517,7 +528,7 @@ ENDIF(CPACK_RPM_PACKAGE_DEBUG) IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in "# -*- rpm-spec -*- -BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@ +BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@ Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ Name: \@CPACK_RPM_PACKAGE_NAME\@ Version: \@CPACK_RPM_PACKAGE_VERSION\@ @@ -608,15 +619,15 @@ IF(RPMBUILD_EXECUTABLE) # Now call rpmbuild using the SPECFILE EXECUTE_PROCESS( COMMAND "${RPMBUILD_EXECUTABLE}" -bb - --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" + --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" "${CPACK_RPM_BINARY_SPECFILE}" - WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" - ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err" - OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out") + WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" + ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err" + OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") IF(CPACK_RPM_PACKAGE_DEBUG) MESSAGE("CPackRPM:Debug: You may consult rpmbuild logs in: ") - MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err") - MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out") + MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err") + MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") ENDIF(CPACK_RPM_PACKAGE_DEBUG) ELSE(RPMBUILD_EXECUTABLE) IF(ALIEN_EXECUTABLE) |