CPack/RPM debuginfo directories to sources

List of sources must be split into paths parts
so that debuginfo package cleans up after
itself.
This commit is contained in:
Domen Vrankar 2016-09-22 18:34:54 +02:00 committed by Brad King
parent b78fcf0d2f
commit dd3c938a0f
2 changed files with 32 additions and 4 deletions

View File

@ -1415,10 +1415,38 @@ function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR)
string(APPEND TMP_RPM_DEBUGINFO_INSTALL "${part_}\n")
endforeach()
if(NOT DEFINED CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS)
set(CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS /usr /usr/src /usr/src/debug)
if(CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS_ADDITION)
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: Adding ${CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS_ADDITION} to builtin omit list.")
endif()
list(APPEND CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS "${CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS_ADDITION}")
endif()
endif()
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS= ${CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS}")
endif()
list(REMOVE_DUPLICATES additional_sources_)
unset(additional_sources_all_)
foreach(source_ IN LISTS additional_sources_)
string(REPLACE "/" ";" split_source_ " ${source_}")
list(REMOVE_AT split_source_ 0)
unset(tmp_path_)
# Now generate all segments of the path
foreach(segment_ IN LISTS split_source_)
string(APPEND tmp_path_ "/${segment_}")
list(APPEND additional_sources_all_ "${tmp_path_}")
endforeach()
endforeach()
list(REMOVE_DUPLICATES additional_sources_all_)
list(REMOVE_ITEM additional_sources_all_ ${CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS})
unset(TMP_DEBUGINFO_ADDITIONAL_SOURCES)
foreach(part_ IN LISTS additional_sources_)
string(APPEND TMP_DEBUGINFO_ADDITIONAL_SOURCES "${part_}\n")
foreach(source_ IN LISTS additional_sources_all_)
string(APPEND TMP_DEBUGINFO_ADDITIONAL_SOURCES "${source_}\n")
endforeach()
set(TMP_RPM_DEBUGINFO_INSTALL "${TMP_RPM_DEBUGINFO_INSTALL}" PARENT_SCOPE)

View File

@ -9,6 +9,6 @@ set(EXPECTED_FILE_3 "debuginfo*-libs.rpm")
set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/libtest_lib.so$")
set(EXPECTED_FILE_4 "debuginfo-applications-debuginfo*.rpm")
set(EXPECTED_FILE_CONTENT_4 ".*/src/src_1/main.cpp.*")
set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*")
set(EXPECTED_FILE_5 "debuginfo-libs-debuginfo*.rpm")
set(EXPECTED_FILE_CONTENT_5 ".*/src/src_1/test_lib.cpp.*")
set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*")