diff options
Diffstat (limited to 'Tests/RunCMake/CPack/RPM')
-rw-r--r-- | Tests/RunCMake/CPack/RPM/Helpers.cmake | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake index 9ed03e2..bbc358c8 100644 --- a/Tests/RunCMake/CPack/RPM/Helpers.cmake +++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake @@ -29,6 +29,39 @@ function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_V endif() endfunction() +function(getPackageContentList FILE RESULT_VAR) + execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${FILE} + OUTPUT_VARIABLE package_content_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX REPLACE "\n" ";" package_content_ "${package_content_}") + + set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) +endfunction() + +function(toExpectedContentList FILE_NO CONTENT_VAR) + if(NOT DEFINED TEST_INSTALL_PREFIX_PATHS) + set(TEST_INSTALL_PREFIX_PATHS "/usr") + endif() + + unset(filtered_) + foreach(part_ IN LISTS ${CONTENT_VAR}) + unset(dont_add_) + foreach(for_removal_ IN LISTS TEST_INSTALL_PREFIX_PATHS) + if(part_ STREQUAL for_removal_) + set(dont_add_ TRUE) + break() + endif() + endforeach() + + if(NOT dont_add_) + list(APPEND filtered_ "${part_}") + endif() + endforeach() + + set(${CONTENT_VAR} "${filtered_}" PARENT_SCOPE) +endfunction() + function(getPackageInfo FILE RESULT_VAR) execute_process(COMMAND ${RPM_EXECUTABLE} -pqi ${FILE} OUTPUT_VARIABLE info_content |