summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CPack/TGZ/Helpers.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/CPack/TGZ/Helpers.cmake')
-rw-r--r--Tests/RunCMake/CPack/TGZ/Helpers.cmake38
1 files changed, 38 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPack/TGZ/Helpers.cmake b/Tests/RunCMake/CPack/TGZ/Helpers.cmake
index 50fda9e..8715258 100644
--- a/Tests/RunCMake/CPack/TGZ/Helpers.cmake
+++ b/Tests/RunCMake/CPack/TGZ/Helpers.cmake
@@ -16,3 +16,41 @@ function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_V
set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.tar.gz" PARENT_SCOPE)
endfunction()
+
+function(getPackageContentList FILE RESULT_VAR)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar -ztf ${FILE}
+ OUTPUT_VARIABLE package_content_
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ string(REPLACE "\n" ";" package_content_ "${package_content_}")
+ foreach(i_ IN LISTS package_content_)
+ string(REGEX REPLACE "/$" "" result_ "${i_}")
+ list(APPEND items_ "${result_}")
+ endforeach()
+
+ set(${RESULT_VAR} "${items_}" PARENT_SCOPE)
+endfunction()
+
+function(toExpectedContentList FILE_NO CONTENT_VAR)
+ findExpectedFile("${FILE_NO}" "file_")
+
+ get_filename_component(prefix_ "${file_}" NAME)
+ # NAME_WE removes everything after the dot and dot is in version so use this instead
+ string(REPLACE ".tar.gz" "" prefix_ "${prefix_}")
+
+ if(NOT DEFINED TEST_MAIN_INSTALL_PREFIX_PATH)
+ set(TEST_MAIN_INSTALL_PREFIX_PATH "/usr")
+ endif()
+
+ unset(filtered_)
+ foreach(part_ IN LISTS ${CONTENT_VAR})
+ string(REPLACE "${TEST_MAIN_INSTALL_PREFIX_PATH}" "" part_ "${part_}")
+
+ if(part_)
+ list(APPEND filtered_ "${prefix_}${part_}")
+ endif()
+ endforeach()
+
+ set(${CONTENT_VAR} "${filtered_}" PARENT_SCOPE)
+endfunction()