diff options
-rw-r--r-- | Modules/CPackDeb.cmake | 10 | ||||
-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_EXTRA.cmake | 20 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/RunCMakeTest.cmake | 1 |
5 files changed, 50 insertions, 1 deletions
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index cbb7c33..75e9966 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -272,6 +272,7 @@ # # # .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA +# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_EXTRA # # This variable allow advanced user to add custom script to the # control.tar.gz. @@ -582,13 +583,20 @@ function(cpack_deb_prepare_package_vars) # - conffiles # - postinst # - postrm - # - prerm" + # - prerm # Usage: # set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA # "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") # Are we packaging components ? if(CPACK_DEB_PACKAGE_COMPONENT) + # override values with per component version if set + foreach(VAR_NAME_ "PACKAGE_CONTROL_EXTRA") + if(CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_}) + set(CPACK_DEBIAN_${VAR_NAME_} "${CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_}}") + endif() + endforeach() + set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}") string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME) else() 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_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) |