summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-11-29 17:24:21 (GMT)
committerBrad King <brad.king@kitware.com>2023-11-29 17:27:31 (GMT)
commit75ea6207b74110a61eefe390868ae6987acb1a5d (patch)
treeb5b2f6a885a6d84fe2d864e802ca7eb4b7bc54bd
parent66149dd1a93f4f22f68d7465de74b14d7c03f89d (diff)
downloadCMake-75ea6207b74110a61eefe390868ae6987acb1a5d.zip
CMake-75ea6207b74110a61eefe390868ae6987acb1a5d.tar.gz
CMake-75ea6207b74110a61eefe390868ae6987acb1a5d.tar.bz2
CPack/RPM: Factor out helper to quote paths in generated rpm spec
-rw-r--r--Modules/Internal/CPack/CPackRPM.cmake19
1 files changed, 14 insertions, 5 deletions
diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake
index 36c0a3f..2676c88 100644
--- a/Modules/Internal/CPack/CPackRPM.cmake
+++ b/Modules/Internal/CPack/CPackRPM.cmake
@@ -54,6 +54,10 @@ macro(set_spec_scripts PACKAGE_NAME)
"${CPACK_RPM_SPEC_PREUNINSTALL}")
endmacro()
+function(make_rpm_spec_path var path)
+ set("${var}" "\"${path}\"" PARENT_SCOPE)
+endfunction()
+
function(get_file_permissions FILE RETURN_VAR)
execute_process(COMMAND ls -l ${FILE}
OUTPUT_VARIABLE permissions_
@@ -596,7 +600,8 @@ function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXE
set(DIRECTIVE "%dir ")
endif()
- string(APPEND INSTALL_FILES "${DIRECTIVE}\"${F}\"\n")
+ make_rpm_spec_path(F_SPEC "${F}")
+ string(APPEND INSTALL_FILES "${DIRECTIVE}${F_SPEC}\n")
endforeach()
if(REQUIRES_SYMLINK_RELOCATION_SCRIPT)
@@ -1317,7 +1322,8 @@ function(cpack_rpm_generate_package)
string(APPEND F_PREFIX " ")
endif()
# Rebuild the user list file
- string(APPEND CPACK_RPM_USER_INSTALL_FILES "${F_PREFIX}\"${F_PATH}\"\n")
+ make_rpm_spec_path(F_SPEC "${F_PATH}")
+ string(APPEND CPACK_RPM_USER_INSTALL_FILES "${F_PREFIX}${F_SPEC}\n")
# Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL
list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH})
@@ -1330,7 +1336,8 @@ function(cpack_rpm_generate_package)
# Rebuild CPACK_RPM_INSTALL_FILES
set(CPACK_RPM_INSTALL_FILES "")
foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST)
- string(APPEND CPACK_RPM_INSTALL_FILES "\"${F}\"\n")
+ make_rpm_spec_path(F_SPEC "${F}")
+ string(APPEND CPACK_RPM_INSTALL_FILES "${F_SPEC}\n")
endforeach()
else()
set(CPACK_RPM_USER_INSTALL_FILES "")
@@ -1351,12 +1358,14 @@ function(cpack_rpm_generate_package)
# Rebuild INSTALL_FILES
set(CPACK_RPM_INSTALL_FILES "")
foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST)
- string(APPEND CPACK_RPM_INSTALL_FILES "\"${F}\"\n")
+ make_rpm_spec_path(F_SPEC "${F}")
+ string(APPEND CPACK_RPM_INSTALL_FILES "${F_SPEC}\n")
endforeach()
# Build ABSOLUTE_INSTALL_FILES
set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "")
foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL)
- string(APPEND CPACK_RPM_ABSOLUTE_INSTALL_FILES "%config \"${F}\"\n")
+ make_rpm_spec_path(F_SPEC "${F}")
+ string(APPEND CPACK_RPM_ABSOLUTE_INSTALL_FILES "%config ${F_SPEC}\n")
endforeach()
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: CPACK_RPM_ABSOLUTE_INSTALL_FILES=${CPACK_RPM_ABSOLUTE_INSTALL_FILES}")