diff options
author | Domen Vrankar <domen.vrankar@gmail.com> | 2016-11-27 14:30:46 (GMT) |
---|---|---|
committer | Domen Vrankar <domen.vrankar@gmail.com> | 2016-11-27 22:20:35 (GMT) |
commit | b687d2ba093b1b79e9faf09e45d11567b0ec9ac1 (patch) | |
tree | e71ea1d488d0e1130fa2f211bdabff0a322fc86b /Tests/RunCMake/CPack/RPM | |
parent | ed8858edb7c5100e1928c5a94f85485f0e322aa7 (diff) | |
download | CMake-b687d2ba093b1b79e9faf09e45d11567b0ec9ac1.zip CMake-b687d2ba093b1b79e9faf09e45d11567b0ec9ac1.tar.gz CMake-b687d2ba093b1b79e9faf09e45d11567b0ec9ac1.tar.bz2 |
Tests: CPack test use same content list
Content list for a certain test
should be the same between different
generators so whenever possible use
a single expected files list per
file for all generators.
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 |