summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-08-13 13:28:36 -0400
committerCMake Topic Stage <kwrobot@kitware.com>2012-08-13 13:28:36 -0400
commite0f7d7fe5a52613bc23cc596fbf6bde8f54f367a (patch)
tree8731849f6848b26c72d316d7777f2edd17b0dd69 /Modules
parent1f793ab6baf47ce6564f02a5540840c727a48d52 (diff)
parent822c1eaf9e49007129998eab0cbe4b78cd610075 (diff)
downloadcmake-e0f7d7fe5a52613bc23cc596fbf6bde8f54f367a.tar.gz
Merge topic 'CPackRPM-fixRelocatablePrefix'
822c1ea Do not include directories which are part of the package install prefix.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CPackRPM.cmake21
1 files changed, 20 insertions, 1 deletions
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index ae9351273e..0ac6e17e69 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}"