diff options
author | Brad King <brad.king@kitware.com> | 2015-07-17 14:36:15 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-07-17 14:36:15 (GMT) |
commit | 536b6c7519e221573cdf96db13b9d72b65c80b0b (patch) | |
tree | 2e96a19fb3a21352ee39dce61fa9849688cb8f12 /Tests | |
parent | 386e1f796ca622e87f822b71e121c611cc184d47 (diff) | |
parent | 3e6b2ab6832f77a7e073b55331352a88a5d28488 (diff) | |
download | CMake-536b6c7519e221573cdf96db13b9d72b65c80b0b.zip CMake-536b6c7519e221573cdf96db13b9d72b65c80b0b.tar.gz CMake-536b6c7519e221573cdf96db13b9d72b65c80b0b.tar.bz2 |
Merge topic 'cpack-per-component-extra-control-file'
3e6b2ab6 CPack/DEB: component version of PACKAGE_CONTROL_EXTRA
506f6bc0 CPack/DEB: Remove duplicate string(TOUPPER) calls
32e9276a Tests/RunCMake/CPack/DEB: add verifyDebControl
47d1f118 Tests/RunCMake/CPack: found files should be preserved
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake | 9 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake | 11 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/DEB/Helpers.cmake | 18 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/DEB_EXTRA.cmake | 20 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/VerifyResult.cmake | 10 |
6 files changed, 64 insertions, 5 deletions
diff --git a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake new file mode 100644 index 0000000..2ff679a --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake @@ -0,0 +1,9 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "3") +set(EXPECTED_FILE_1 "deb_extra-*-foo.deb") +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_2 "deb_extra-*-bar.deb") +set(EXPECTED_FILE_CONTENT_2 "^.*/usr/${whitespaces_}.*/usr/bar/${whitespaces_}.*/usr/bar/CMakeLists.txt$") +set(EXPECTED_FILE_3 "deb_extra-*-bas.deb") +set(EXPECTED_FILE_CONTENT_3 "^.*/usr/${whitespaces_}.*/usr/bas/${whitespaces_}.*/usr/bas/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake new file mode 100644 index 0000000..78b6114 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake @@ -0,0 +1,11 @@ +set(foo_preinst "^echo default_preinst$") +set(foo_prerm "^echo default_prerm$") +verifyDebControl("${FOUND_FILE_1}" "foo" "preinst;prerm") + +set(bar_preinst "^echo bar_preinst$") +set(bar_prerm "^echo bar_prerm$") +verifyDebControl("${FOUND_FILE_2}" "bar" "preinst;prerm") + +set(bas_preinst "^echo default_preinst$") +set(bas_prerm "^echo default_prerm$") +verifyDebControl("${FOUND_FILE_3}" "bas" "preinst;prerm") diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index 4ed3fbd..45c85c3 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -8,3 +8,21 @@ function(getPackageContent FILE RESULT_VAR) set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) endfunction() + +function(verifyDebControl FILE PREFIX VERIFY_FILES) + execute_process(COMMAND ${DPKG_EXECUTABLE} --control ${FILE} control_${PREFIX} + ERROR_VARIABLE err_) + + if(err_) + message(FATAL_ERROR "Debian controll verification failed for file: " + "'${FILE}'; error output: '${err_}'") + endif() + + foreach(FILE_ IN LISTS VERIFY_FILES) + file(READ "${CMAKE_CURRENT_BINARY_DIR}/control_${PREFIX}/${FILE_}" content_) + if(NOT content_ MATCHES "${${PREFIX}_${FILE_}}") + message(FATAL_ERROR "Unexpected content in for '${PREFIX}_${FILE_}'!" + " Content: '${content_}'") + endif() + endforeach() +endfunction() diff --git a/Tests/RunCMake/CPack/DEB_EXTRA.cmake b/Tests/RunCMake/CPack/DEB_EXTRA.cmake new file mode 100644 index 0000000..46d848d --- /dev/null +++ b/Tests/RunCMake/CPack/DEB_EXTRA.cmake @@ -0,0 +1,20 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) +install(FILES CMakeLists.txt DESTINATION bas COMPONENT bas) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/preinst "echo default_preinst") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/prerm "echo default_prerm") + +set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA + "${CMAKE_CURRENT_BINARY_DIR}/preinst;${CMAKE_CURRENT_BINARY_DIR}/prerm") + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar/preinst "echo bar_preinst") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar/prerm "echo bar_prerm") + +set(CPACK_DEBIAN_BAR_PACKAGE_CONTROL_EXTRA + "${CMAKE_CURRENT_BINARY_DIR}/bar/preinst;${CMAKE_CURRENT_BINARY_DIR}/bar/prerm") + +set(CPACK_PACKAGE_NAME "deb_extra") +set(CPACK_PACKAGE_CONTACT "someone") + +set(CPACK_DEB_COMPONENT_INSTALL ON) diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 308b8cc..97ef238 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -6,3 +6,4 @@ include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") # args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP run_cpack_test(MINIMAL "RPM;DEB" false) run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false) +run_cpack_test(DEB_EXTRA "DEB" false) diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 809011b..e059d9c 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -15,13 +15,13 @@ include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-ExpectedFiles.cmake") if(NOT EXPECTED_FILES_COUNT EQUAL 0) foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT}) - file(GLOB foundFile_ RELATIVE "${bin_dir}" "${EXPECTED_FILE_${file_no_}}") - set(foundFiles_ "${foundFiles_};${foundFile_}") - list(LENGTH foundFile_ foundFilesCount_) + file(GLOB FOUND_FILE_${file_no_} RELATIVE "${bin_dir}" "${EXPECTED_FILE_${file_no_}}") + set(foundFiles_ "${foundFiles_};${FOUND_FILE_${file_no_}}") + list(LENGTH FOUND_FILE_${file_no_} foundFilesCount_) if(foundFilesCount_ EQUAL 1) unset(PACKAGE_CONTENT) - getPackageContent("${bin_dir}/${foundFile_}" "PACKAGE_CONTENT") + getPackageContent("${bin_dir}/${FOUND_FILE_${file_no_}}" "PACKAGE_CONTENT") string(REGEX MATCH "${EXPECTED_FILE_CONTENT_${file_no_}}" expected_content_list "${PACKAGE_CONTENT}") @@ -36,7 +36,7 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) message(FATAL_ERROR "Found more than one file for file No. '${file_no_}'!" " Found files count '${foundFilesCount_}'." - " Files: '${foundFile_}'" + " Files: '${FOUND_FILE_${file_no_}}'" "${output_error_message}") endif() endforeach() |