summaryrefslogtreecommitdiffstats
path: root/Modules/CPackRPM.cmake
diff options
context:
space:
mode:
authorDomen Vrankar <domen.vrankar@gmail.com>2017-03-13 22:17:24 (GMT)
committerDomen Vrankar <domen.vrankar@gmail.com>2017-03-13 22:22:55 (GMT)
commit598400a3e7148c75f83e1adf995cd6c1a3857d58 (patch)
treea202c96b7d7e7f01e9d19619c163c29b500e172d /Modules/CPackRPM.cmake
parentccec62c6aa8ac44aaa9908ca5d72c396c5f068c0 (diff)
downloadCMake-598400a3e7148c75f83e1adf995cd6c1a3857d58.zip
CMake-598400a3e7148c75f83e1adf995cd6c1a3857d58.tar.gz
CMake-598400a3e7148c75f83e1adf995cd6c1a3857d58.tar.bz2
CPack/RPM: handle extra slashes
Extra slashes in some locations can cause errors during package generation and can also be present in generated rpm packages causing issues for the package user. Closes #16619
Diffstat (limited to 'Modules/CPackRPM.cmake')
-rw-r--r--Modules/CPackRPM.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index b32feb5..7a7c170 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -958,10 +958,20 @@ function(cpack_rpm_prepare_relocation_paths)
foreach(RELOCATION_PATH ${RPM_RELOCATION_PATHS})
if(IS_ABSOLUTE "${RELOCATION_PATH}")
set(PREPARED_RELOCATION_PATH "${RELOCATION_PATH}")
+ elseif(PATH_PREFIX STREQUAL "/")
+ # don't prefix path with a second slash as "//" is treated as network path
+ # by get_filename_component() so it remains in path even inside rpm
+ # package where it may cause problems with relocation
+ set(PREPARED_RELOCATION_PATH "/${RELOCATION_PATH}")
else()
set(PREPARED_RELOCATION_PATH "${PATH_PREFIX}/${RELOCATION_PATH}")
endif()
+ # handle cases where path contains extra slashes (e.g. /a//b/ instead of
+ # /a/b)
+ get_filename_component(PREPARED_RELOCATION_PATH
+ "${PREPARED_RELOCATION_PATH}" ABSOLUTE)
+
if(EXISTS "${WDIR}/${PREPARED_RELOCATION_PATH}")
string(APPEND TMP_RPM_PREFIXES "Prefix: ${PREPARED_RELOCATION_PATH}\n")
list(APPEND RPM_USED_PACKAGE_PREFIXES "${PREPARED_RELOCATION_PATH}")
@@ -2130,6 +2140,11 @@ function(cpack_rpm_generate_package)
set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/usr/src/debug/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}")
endif()
+ # handle cases where path contains extra slashes (e.g. /a//b/ instead of
+ # /a/b)
+ get_filename_component(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX
+ "${CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX}" ABSOLUTE)
+
if(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE AND GENERATE_SPEC_PARTS)
file(WRITE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}.files"
"${CPACK_RPM_INSTALL_FILES}")