diff options
author | Andy Piper <andy.piper@kaspersky.com> | 2012-08-07 17:15:19 (GMT) |
---|---|---|
committer | Eric NOULARD <eric.noulard@gmail.com> | 2012-08-07 17:15:19 (GMT) |
commit | 822c1eaf9e49007129998eab0cbe4b78cd610075 (patch) | |
tree | fcee4ace99ba692c95fa1678e55f937c12c2a687 /Modules/CPackRPM.cmake | |
parent | 3bfabfa04a2919ec140bc3578ab80b060c96737e (diff) | |
download | CMake-822c1eaf9e49007129998eab0cbe4b78cd610075.zip CMake-822c1eaf9e49007129998eab0cbe4b78cd610075.tar.gz CMake-822c1eaf9e49007129998eab0cbe4b78cd610075.tar.bz2 |
Do not include directories which are part of the package install prefix.
This fix bug #0013451. The bug prevents theorerically relocatable RPM package
to be installed properly.
Signed-off-by: Eric NOULARD <eric.noulard@gmail.com>
Diffstat (limited to 'Modules/CPackRPM.cmake')
-rw-r--r-- | Modules/CPackRPM.cmake | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index ae93512..0ac6e17 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -639,6 +639,25 @@ 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}") +# if we are creating a relocatable package, omit parent directories of +# CPACK_RPM_PACKAGE_PREFIX. This is achieved by building a "filter list" +# which is passed to the find command that generates the content-list +if(CPACK_RPM_PACKAGE_RELOCATABLE) + # get a list of the elements in CPACK_RPM_PACKAGE_PREFIX and remove + # the final element (so the install-prefix dir itself is not omitted + # from the RPM's content-list) + string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${CPACK_RPM_PACKAGE_PREFIX}") + list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) + # Now generate all of the parent dirs of CPACK_RPM_PACKAGE_PREFIX + foreach(_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) + list(APPEND _TMP_LIST "${_ELEM}") + string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}") + set(_OMIT_DIR "-o -path ${_OMIT_DIR}") + separate_arguments(_OMIT_DIR) + list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR}) + endforeach() +endif() + # Use files tree to construct files command (spec file) # We should not forget to include symlinks (thus -o -type l) # We should include directory as well (thus -type d) @@ -647,7 +666,7 @@ SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") # file name by enclosing it between double quotes (thus the sed) # 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 -o (-type d -a -not -name ".") +EXECUTE_PROCESS(COMMAND find . -type f -o -type l -o (-type d -a -not ( -name "." ${_RPM_DIRS_TO_OMIT} ) ) COMMAND sed s:.*/man.*/.*:&*: COMMAND sed s/\\.\\\(.*\\\)/\"\\1\"/ WORKING_DIRECTORY "${WDIR}" |