summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorDomen Vrankar <domen.vrankar@gmail.com>2016-03-31 05:48:38 (GMT)
committerBrad King <brad.king@kitware.com>2016-04-01 13:52:04 (GMT)
commiteae4eef0c48188027b5c25657054b12b6b301c85 (patch)
tree41f10040e4d1e2878870224ebe7fe75241169f78 /Modules
parentb290ddf925aee7dca25396035b1b53223d37e9e5 (diff)
downloadCMake-eae4eef0c48188027b5c25657054b12b6b301c85.zip
CMake-eae4eef0c48188027b5c25657054b12b6b301c85.tar.gz
CMake-eae4eef0c48188027b5c25657054b12b6b301c85.tar.bz2
CPack/RPM external symlink handling
Symbolic links that point to external location no longer cause cmake to fail with string out of bounds error but are instead packaged as non relocatable symlinks and print out a warning message.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CPackRPM.cmake30
1 files changed, 23 insertions, 7 deletions
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index ae51dc1..713b938 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -599,9 +599,10 @@
# while determining if symlink should be either created or present in a
# post install script - depending on relocation paths.
#
-# Currenty there are a few limitations though:
+# Symbolic links that point to locations outside packaging path produce a
+# warning and are treated as non relocatable permanent symbolic links.
#
-# * Only symbolic links with relative path can be packaged.
+# Currenty there are a few limitations though:
#
# * For component based packaging component interdependency is not checked
# when processing symbolic links. Symbolic links pointing to content of
@@ -1068,13 +1069,28 @@ function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXE
get_filename_component(SYMLINK_POINT_ "${SYMLINK_LOCATION_}/${SYMLINK_POINT_}" ABSOLUTE)
endif()
- string(SUBSTRING "${SYMLINK_POINT_}" ${WDR_LEN_} -1 SYMLINK_POINT_WD_)
+ # recalculate path length after conversion to canonical form
+ string(LENGTH "${SYMLINK_POINT_}" SYMLINK_POINT_LENGTH_)
- cpack_rpm_symlink_get_relocation_prefixes("${F}" "${PACKAGE_PREFIXES}" "SYMLINK_RELOCATIONS")
- cpack_rpm_symlink_get_relocation_prefixes("${SYMLINK_POINT_WD_}" "${PACKAGE_PREFIXES}" "POINT_RELOCATIONS")
+ if(SYMLINK_POINT_ MATCHES "${WDIR}/.*")
+ # only symlinks that are pointing inside the packaging structure should be checked for relocation
+ string(SUBSTRING "${SYMLINK_POINT_}" ${WDR_LEN_} -1 SYMLINK_POINT_WD_)
+ cpack_rpm_symlink_get_relocation_prefixes("${F}" "${PACKAGE_PREFIXES}" "SYMLINK_RELOCATIONS")
+ cpack_rpm_symlink_get_relocation_prefixes("${SYMLINK_POINT_WD_}" "${PACKAGE_PREFIXES}" "POINT_RELOCATIONS")
- list(LENGTH SYMLINK_RELOCATIONS SYMLINK_RELOCATIONS_COUNT)
- list(LENGTH POINT_RELOCATIONS POINT_RELOCATIONS_COUNT)
+ list(LENGTH SYMLINK_RELOCATIONS SYMLINK_RELOCATIONS_COUNT)
+ list(LENGTH POINT_RELOCATIONS POINT_RELOCATIONS_COUNT)
+ else()
+ # location pointed to is ouside WDR so it should be treated as a permanent symlink
+ set(SYMLINK_POINT_WD_ "${SYMLINK_POINT_}")
+
+ unset(SYMLINK_RELOCATIONS)
+ unset(POINT_RELOCATIONS)
+ unset(SYMLINK_RELOCATIONS_COUNT)
+ unset(POINT_RELOCATIONS_COUNT)
+
+ message(AUTHOR_WARNING "CPackRPM:Warning: Symbolic link '${F}' points to location that is outside packaging path! Link will possibly not be relocatable.")
+ endif()
if(SYMLINK_RELOCATIONS_COUNT AND POINT_RELOCATIONS_COUNT)
# find matching