diff options
author | Brad King <brad.king@kitware.com> | 2023-11-30 14:05:38 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-11-30 14:05:53 (GMT) |
commit | 6a49dc03919e95bf5b29ad60e96aba6be94719df (patch) | |
tree | e5aa5ffb6afbaf385fa88fd453fb5d0075059621 | |
parent | d2167f7224c67076dc8a35e894ffae2712e8a45a (diff) | |
parent | 5123e9e160c1d3238dadc8ee1fea4a095191b62f (diff) | |
download | CMake-6a49dc03919e95bf5b29ad60e96aba6be94719df.zip CMake-6a49dc03919e95bf5b29ad60e96aba6be94719df.tar.gz CMake-6a49dc03919e95bf5b29ad60e96aba6be94719df.tar.bz2 |
Merge topic 'rpm-quoting' into release-3.28
5123e9e160 ci: unmask RPM tests on Fedora 39
bf22ac5263 CPack/RPM: Quote paths in rpm spec only if they have whitespace
75ea6207b7 CPack/RPM: Factor out helper to quote paths in generated rpm spec
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9005
-rw-r--r-- | .gitlab/ci/ctest_exclusions.cmake | 9 | ||||
-rw-r--r-- | Modules/Internal/CPack/CPackRPM.cmake | 24 |
2 files changed, 19 insertions, 14 deletions
diff --git a/.gitlab/ci/ctest_exclusions.cmake b/.gitlab/ci/ctest_exclusions.cmake index 159c1c8..a2789c3 100644 --- a/.gitlab/ci/ctest_exclusions.cmake +++ b/.gitlab/ci/ctest_exclusions.cmake @@ -34,15 +34,6 @@ if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "nvhpc_") ) endif() -if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "fedora39_makefiles") - list(APPEND test_exclusions - # FIXME(#25421): CPack/RPM needs an update for Fedora 39. - "^CPackComponentsForAll-RPM-default$" - "^CPackComponentsForAll-RPM-AllInOne$" - "^CPackComponentsForAll-RPM-OnePackPerGroup$" - ) -endif() - string(REPLACE ";" "|" test_exclusions "${test_exclusions}") if (test_exclusions) set(test_exclusions "(${test_exclusions})") diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake index 36c0a3f..ace2c6b 100644 --- a/Modules/Internal/CPack/CPackRPM.cmake +++ b/Modules/Internal/CPack/CPackRPM.cmake @@ -54,6 +54,15 @@ macro(set_spec_scripts PACKAGE_NAME) "${CPACK_RPM_SPEC_PREUNINSTALL}") endmacro() +function(make_rpm_spec_path var path) + # RPM supports either whitespace with quoting or globbing without quoting. + if(path MATCHES "[ \t]") + set("${var}" "\"${path}\"" PARENT_SCOPE) + else() + set("${var}" "${path}" PARENT_SCOPE) + endif() +endfunction() + function(get_file_permissions FILE RETURN_VAR) execute_process(COMMAND ls -l ${FILE} OUTPUT_VARIABLE permissions_ @@ -596,7 +605,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 +1327,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 +1341,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 +1363,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}") |