diff options
author | Domen Vrankar <domen.vrankar@gmail.com> | 2016-11-27 15:33:13 (GMT) |
---|---|---|
committer | Domen Vrankar <domen.vrankar@gmail.com> | 2016-11-27 22:20:35 (GMT) |
commit | d040d1647d2192ab97db9b041599c9e224c93553 (patch) | |
tree | d9ef9808a5652b252186888075f9a97e6c3b3ddb /Tests/RunCMake | |
parent | 2cc479bdac84843d0284573cf801ee526e798c54 (diff) | |
download | CMake-d040d1647d2192ab97db9b041599c9e224c93553.zip CMake-d040d1647d2192ab97db9b041599c9e224c93553.tar.gz CMake-d040d1647d2192ab97db9b041599c9e224c93553.tar.bz2 |
Tests: CPack test set packaging type
CPack tests can now define one or more
packaging types and that test will be
executed once per generator per packaging
type. This also enables us to set default
values per packaging type for each generator
which makes tests shorter.
Diffstat (limited to 'Tests/RunCMake')
25 files changed, 130 insertions, 158 deletions
diff --git a/Tests/RunCMake/CPack/CMakeLists.txt b/Tests/RunCMake/CPack/CMakeLists.txt index e06fa1c..c361af0 100644 --- a/Tests/RunCMake/CPack/CMakeLists.txt +++ b/Tests/RunCMake/CPack/CMakeLists.txt @@ -1,7 +1,13 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) +set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "") + project(${RunCMake_TEST} CXX) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${GENERATOR_TYPE}/packaging_${PACKAGING_TYPE}_default.cmake") + include(${GENERATOR_TYPE}/packaging_${PACKAGING_TYPE}_default.cmake) +endif() + # set default test name (can be overwritten in test.cmake or specifics.cmake) string(TOLOWER "${RunCMake_TEST_FILE_PREFIX}" CPACK_PACKAGE_NAME) diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index 3d80cc6..7e21d22 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -1,6 +1,6 @@ cmake_policy(SET CMP0057 NEW) -function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source) +function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE) if(TEST_TYPE IN_LIST types) set(RunCMake_TEST_NO_CLEAN TRUE) set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") @@ -11,6 +11,8 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source) set(full_test_name_ "${full_test_name_}-${SUBTEST_SUFFIX}-subtest") endif() + string(APPEND full_test_name_ "-${PACKAGING_TYPE}-type") + # TODO this should be executed only once per ctest run (not per generator) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") @@ -31,7 +33,8 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source) # execute cmake set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${TEST_TYPE}" "-DRunCMake_TEST_FILE_PREFIX=${TEST_NAME}" - "-DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX}") + "-DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX}" + "-DPACKAGING_TYPE=${PACKAGING_TYPE}") run_cmake(${full_test_name_}) # execute optional build step @@ -42,7 +45,7 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source) if(source) set(pack_params_ -G ${TEST_TYPE} --config ./CPackSourceConfig.cmake) FILE(APPEND ${RunCMake_TEST_BINARY_DIR}/CPackSourceConfig.cmake - "\nset(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS \"-DRunCMake_TEST:STRING=${full_test_name_}\ -DRunCMake_TEST_FILE_PREFIX:STRING=${TEST_NAME} -DGENERATOR_TYPE=${TEST_TYPE}\")") + "\nset(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS \"-DRunCMake_TEST:STRING=${full_test_name_} -DRunCMake_TEST_FILE_PREFIX:STRING=${TEST_NAME} -DGENERATOR_TYPE:STRING=${TEST_TYPE}\")") else() unset(pack_params_) endif() @@ -74,6 +77,7 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source) -DRunCMake_TEST_FILE_PREFIX=${TEST_NAME} -DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX} -DGENERATOR_TYPE=${TEST_TYPE} + -DPACKAGING_TYPE=${PACKAGING_TYPE} "-Dsrc_dir=${RunCMake_SOURCE_DIR}" "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" "-Dconfig_file=${config_file}" @@ -82,16 +86,20 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source) endif() endfunction() -function(run_cpack_test TEST_NAME types build) - run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false) -endfunction() - -function(run_cpack_source_test TEST_NAME types build) - run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" true) +function(run_cpack_test TEST_NAME types build PACKAGING_TYPES) + foreach(packaging_type_ IN LISTS PACKAGING_TYPES) + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}") + endforeach() endfunction() -function(run_cpack_test_subtests TEST_NAME SUBTEST_SUFFIXES types build) +function(run_cpack_test_subtests TEST_NAME SUBTEST_SUFFIXES types build PACKAGING_TYPES) foreach(suffix_ IN LISTS SUBTEST_SUFFIXES) - run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false) + foreach(packaging_type_ IN LISTS PACKAGING_TYPES) + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}") + endforeach() endforeach() endfunction() + +function(run_cpack_source_test TEST_NAME types build) + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" true "") +endfunction() diff --git a/Tests/RunCMake/CPack/DEB/packaging_COMPONENT_default.cmake b/Tests/RunCMake/CPack/DEB/packaging_COMPONENT_default.cmake new file mode 100644 index 0000000..4219b0c --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/packaging_COMPONENT_default.cmake @@ -0,0 +1,2 @@ +set(CPACK_DEB_COMPONENT_INSTALL "ON") +set(CPACK_PACKAGE_CONTACT "someone") diff --git a/Tests/RunCMake/CPack/DEB/packaging_MONOLITHIC_default.cmake b/Tests/RunCMake/CPack/DEB/packaging_MONOLITHIC_default.cmake new file mode 100644 index 0000000..8821ab9 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/packaging_MONOLITHIC_default.cmake @@ -0,0 +1 @@ +set(CPACK_PACKAGE_CONTACT "someone") diff --git a/Tests/RunCMake/CPack/RPM/packaging_COMPONENT_default.cmake b/Tests/RunCMake/CPack/RPM/packaging_COMPONENT_default.cmake new file mode 100644 index 0000000..c8b93e9 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/packaging_COMPONENT_default.cmake @@ -0,0 +1 @@ +set(CPACK_RPM_COMPONENT_INSTALL "ON") diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 39896ba..fa966c6 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -3,23 +3,22 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) include(RunCMake) include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") -# args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP -run_cpack_test(MINIMAL "RPM;DEB;TGZ" false) +# run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES" +run_cpack_test(CUSTOM_NAMES "RPM;DEB" true "COMPONENT") +run_cpack_test(DEBUGINFO "RPM" true "COMPONENT") +run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT") +run_cpack_test(DIST "RPM" false "MONOLITHIC") +run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true "MONOLITHIC;COMPONENT") +run_cpack_test(EXTRA "DEB" false "COMPONENT") +run_cpack_test(GENERATE_SHLIBS "DEB" true "COMPONENT") +run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT") +run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT") +run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC") +run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false "COMPONENT") +run_cpack_test(MINIMAL "RPM;DEB;TGZ" false "MONOLITHIC") +run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC") +run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false "COMPONENT") +run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false "COMPONENT") +run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM" true "CUSTOM") run_cpack_source_test(SOURCE_PACKAGE "RPM" true) -run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false) -run_cpack_test(EXTRA "DEB" false) -run_cpack_test(DEPENDENCIES "RPM;DEB" true) -run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true) -run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true) -run_cpack_test(CUSTOM_NAMES "RPM;DEB" true) -run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false) -run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false) -run_cpack_test(DIST "RPM" false) -run_cpack_test(SUGGESTS "RPM" false) -run_cpack_test(INSTALL_SCRIPTS "RPM" false) -run_cpack_test(GENERATE_SHLIBS "DEB" true) -run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true) -run_cpack_test(DEBUGINFO "RPM" true) -run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM" true) -run_cpack_test(LONG_FILENAMES "DEB" false) -run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512;SHA3_224;SHA3_256;SHA3_384;SHA3_512" "TGZ" false) +run_cpack_test(SUGGESTS "RPM" false "MONOLITHIC") diff --git a/Tests/RunCMake/CPack/TGZ/Helpers.cmake b/Tests/RunCMake/CPack/TGZ/Helpers.cmake index 8715258..4a194c6 100644 --- a/Tests/RunCMake/CPack/TGZ/Helpers.cmake +++ b/Tests/RunCMake/CPack/TGZ/Helpers.cmake @@ -35,9 +35,15 @@ 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_}") + # component and monolithic packages differ for some reason by either having + # package filename prefix in path or not + if(PACKAGING_TYPE STREQUAL "MONOLITHIC") + get_filename_component(prefix_ "${file_}" NAME) + # NAME_WE removes everything after the dot and dot is in version so replace instead + string(REPLACE ".tar.gz" "/" prefix_ "${prefix_}") + else() + unset(prefix_) + endif() if(NOT DEFINED TEST_MAIN_INSTALL_PREFIX_PATH) set(TEST_MAIN_INSTALL_PREFIX_PATH "/usr") @@ -45,7 +51,7 @@ function(toExpectedContentList FILE_NO CONTENT_VAR) unset(filtered_) foreach(part_ IN LISTS ${CONTENT_VAR}) - string(REPLACE "${TEST_MAIN_INSTALL_PREFIX_PATH}" "" part_ "${part_}") + string(REGEX REPLACE "^${TEST_MAIN_INSTALL_PREFIX_PATH}(/|$)" "" part_ "${part_}") if(part_) list(APPEND filtered_ "${prefix_}${part_}") diff --git a/Tests/RunCMake/CPack/TGZ/packaging_COMPONENT_default.cmake b/Tests/RunCMake/CPack/TGZ/packaging_COMPONENT_default.cmake new file mode 100644 index 0000000..81a5035 --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/packaging_COMPONENT_default.cmake @@ -0,0 +1 @@ +set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON") diff --git a/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/ExpectedFiles.cmake deleted file mode 100644 index 12970cb..0000000 --- a/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/ExpectedFiles.cmake +++ /dev/null @@ -1,9 +0,0 @@ -set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) -set(EXPECTED_FILE_1_COMPONENT "test") - -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/empty") - -if(GENERATOR_TYPE STREQUAL "TGZ") - set(EXPECTED_FILE_CONTENT_1 "^[^\n]*empty/$") -endif() diff --git a/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake b/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake deleted file mode 100644 index 1f35b80..0000000 --- a/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake +++ /dev/null @@ -1,14 +0,0 @@ -if(GENERATOR_TYPE STREQUAL "DEB") - set(CPACK_PACKAGE_CONTACT "someone") - set(CPACK_DEB_COMPONENT_INSTALL "ON") - set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") -elseif(GENERATOR_TYPE STREQUAL "RPM") - set(CPACK_RPM_COMPONENT_INSTALL "ON") - set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") -elseif(GENERATOR_TYPE STREQUAL "TGZ") - set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON") -endif() - -set(CPACK_COMPONENTS_ALL test) -install(DIRECTORY DESTINATION empty - COMPONENT test) diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake index 3185e9f..0c2b37b 100644 --- a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake +++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake @@ -1,16 +1,12 @@ -if(GENERATOR_TYPE STREQUAL "DEB") - set(CPACK_PACKAGE_CONTACT "someone") - set(CPACK_DEB_COMPONENT_INSTALL "ON") +if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM") + if(GENERATOR_TYPE STREQUAL "DEB") + set(generator_type_suffix_ "IAN") # not entirely compatible... + endif() - set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") - set(CPACK_DEBIAN_PKG_2_PACKAGE_NAME "second") - set(CPACK_DEBIAN_PKG_3_FILE_NAME "pkg_3_abc.deb") -elseif(GENERATOR_TYPE STREQUAL "RPM") - set(CPACK_RPM_COMPONENT_INSTALL "ON") - - set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") - set(CPACK_RPM_PKG_2_PACKAGE_NAME "second") - set(CPACK_RPM_PKG_3_FILE_NAME "pkg_3_abc.rpm") + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_FILE_NAME "${GENERATOR_TYPE}-DEFAULT") + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_NAME "second") + string(TOLOWER "${GENERATOR_TYPE}" file_extension_) + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_3_FILE_NAME "pkg_3_abc.${file_extension_}") endif() install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1) diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake index 70b3cb3..0642d83 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake @@ -6,8 +6,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id") endif() -set(CPACK_RPM_COMPONENT_INSTALL "ON") - set(CMAKE_BUILD_TYPE Debug) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" diff --git a/Tests/RunCMake/CPack/tests/DEPENDENCIES/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DEPENDENCIES/VerifyResult.cmake index 1c7ff5e..7923148 100644 --- a/Tests/RunCMake/CPack/tests/DEPENDENCIES/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/VerifyResult.cmake @@ -68,11 +68,11 @@ elseif(GENERATOR_TYPE STREQUAL "RPM") checkDependencies_("${FOUND_FILE_4}" "requires" "depend-default;depend-default-b") checkDependencies_("${FOUND_FILE_5}" "requires" "depend-default;depend-default-b") - checkDependencies_("${FOUND_FILE_1}" "conflicts" "conflict-application;conflict-application-b") - checkDependencies_("${FOUND_FILE_2}" "conflicts" "conflict-application;conflict-application-b") - checkDependencies_("${FOUND_FILE_3}" "conflicts" "conflict-headers") - checkDependencies_("${FOUND_FILE_4}" "conflicts" "conflict-default;conflict-default-b") - checkDependencies_("${FOUND_FILE_5}" "conflicts" "conflict-default;conflict-default-b") + checkDependencies_("${FOUND_FILE_1}" "conflicts" "conflicts-application;conflicts-application-b") + checkDependencies_("${FOUND_FILE_2}" "conflicts" "conflicts-application;conflicts-application-b") + checkDependencies_("${FOUND_FILE_3}" "conflicts" "conflicts-headers") + checkDependencies_("${FOUND_FILE_4}" "conflicts" "conflicts-default;conflicts-default-b") + checkDependencies_("${FOUND_FILE_5}" "conflicts" "conflicts-default;conflicts-default-b") checkDependencies_("${FOUND_FILE_1}" "provides" "provided-default;provided-default-b") checkDependencies_("${FOUND_FILE_2}" "provides" "provided-default;provided-default-b") diff --git a/Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake b/Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake index cabbba8..fbd786e 100644 --- a/Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake +++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake @@ -1,50 +1,43 @@ -if(GENERATOR_TYPE STREQUAL "DEB") - set(CPACK_PACKAGE_CONTACT "someone") - set(CPACK_DEB_COMPONENT_INSTALL "ON") - #intentionaly commented out to test old file naming - #set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") - - # false by default - set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS FALSE) - # FIXME can not be tested as libraries first have to be part of a package in order - # to determine their dependencies and we can not be certain if there will be any - set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_SHLIBDEPS TRUE) - - foreach(dependency_type_ DEPENDS CONFLICTS PREDEPENDS ENHANCES BREAKS REPLACES RECOMMENDS SUGGESTS) - string(TOLOWER "${dependency_type_}" lower_dependency_type_) - - set(CPACK_DEBIAN_PACKAGE_${dependency_type_} "${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b") - set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b") - set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b") - set(CPACK_DEBIAN_HEADERS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-headers") - endforeach() - - set(CPACK_DEBIAN_PACKAGE_PROVIDES "provided-default, provided-default-b") - set(CPACK_DEBIAN_LIBS_PACKAGE_PROVIDES "provided-lib") - set(CPACK_DEBIAN_LIBS_AUTO_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b") -elseif(GENERATOR_TYPE STREQUAL "RPM") - set(CPACK_RPM_COMPONENT_INSTALL "ON") - - # FIXME auto autoprov is not tested at the moment as Ubuntu 15.04 rpmbuild - # does not use them correctly: https://bugs.launchpad.net/rpm/+bug/1475755 - set(CPACK_RPM_PACKAGE_AUTOREQ "no") - set(CPACK_RPM_PACKAGE_AUTOPROV "no") - set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_AUTOREQPROV "yes") - set(CPACK_RPM_LIBS_AUTO_PACKAGE_AUTOREQPROV "yes") - - set(CPACK_RPM_PACKAGE_REQUIRES "depend-default, depend-default-b") - set(CPACK_RPM_APPLICATIONS_PACKAGE_REQUIRES "depend-application, depend-application-b") - set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_REQUIRES "depend-application, depend-application-b") - set(CPACK_RPM_HEADERS_PACKAGE_REQUIRES "depend-headers") - - set(CPACK_RPM_PACKAGE_CONFLICTS "conflict-default, conflict-default-b") - set(CPACK_RPM_APPLICATIONS_PACKAGE_CONFLICTS "conflict-application, conflict-application-b") - set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_CONFLICTS "conflict-application, conflict-application-b") - set(CPACK_RPM_HEADERS_PACKAGE_CONFLICTS "conflict-headers") - - set(CPACK_RPM_PACKAGE_PROVIDES "provided-default, provided-default-b") - set(CPACK_RPM_LIBS_PACKAGE_PROVIDES "provided-lib") - set(CPACK_RPM_LIBS_AUTO_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b") +if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM") + if(GENERATOR_TYPE STREQUAL "DEB") + # false by default + set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS FALSE) + # FIXME can not be tested as libraries first have to be part of a package in order + # to determine their dependencies and we can not be certain if there will be any + set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_SHLIBDEPS TRUE) + + foreach(dependency_type_ DEPENDS PREDEPENDS ENHANCES BREAKS REPLACES RECOMMENDS SUGGESTS) + string(TOLOWER "${dependency_type_}" lower_dependency_type_) + + set(CPACK_DEBIAN_PACKAGE_${dependency_type_} "${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b") + set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b") + set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b") + set(CPACK_DEBIAN_HEADERS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-headers") + endforeach() + + set(generator_type_suffix_ "IAN") # not entirely compatible... + else() # RPM + # FIXME auto autoprov is not tested at the moment as Ubuntu 15.04 rpmbuild + # does not use them correctly: https://bugs.launchpad.net/rpm/+bug/1475755 + set(CPACK_RPM_PACKAGE_AUTOREQ "no") + set(CPACK_RPM_PACKAGE_AUTOPROV "no") + set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_AUTOREQPROV "yes") + set(CPACK_RPM_LIBS_AUTO_PACKAGE_AUTOREQPROV "yes") + + set(CPACK_RPM_PACKAGE_REQUIRES "depend-default, depend-default-b") + set(CPACK_RPM_APPLICATIONS_PACKAGE_REQUIRES "depend-application, depend-application-b") + set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_REQUIRES "depend-application, depend-application-b") + set(CPACK_RPM_HEADERS_PACKAGE_REQUIRES "depend-headers") + endif() + + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PACKAGE_CONFLICTS "conflicts-default, conflicts-default-b") + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_APPLICATIONS_PACKAGE_CONFLICTS "conflicts-application, conflicts-application-b") + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_APPLICATIONS_AUTO_PACKAGE_CONFLICTS "conflicts-application, conflicts-application-b") + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_HEADERS_PACKAGE_CONFLICTS "conflicts-headers") + + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PACKAGE_PROVIDES "provided-default, provided-default-b") + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_LIBS_PACKAGE_PROVIDES "provided-lib") + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_LIBS_AUTO_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b") endif() set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) diff --git a/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake index 858a496..650687c 100644 --- a/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake @@ -1,3 +1,7 @@ set(EXPECTED_FILES_COUNT "1") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/empty") + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(EXPECTED_FILE_1_COMPONENT "test") +endif() diff --git a/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake b/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake index 049c4a4..cd2c9fd 100644 --- a/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake +++ b/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake @@ -1,7 +1,3 @@ -if(GENERATOR_TYPE STREQUAL "DEB") - set(CPACK_PACKAGE_CONTACT "someone") -endif() - if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM") if(GENERATOR_TYPE STREQUAL "DEB") set(generator_type_suffix_ "IAN") # not entirely compatible... @@ -12,3 +8,7 @@ endif() install(DIRECTORY DESTINATION empty COMPONENT test) + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(CPACK_COMPONENTS_ALL test) +endif() diff --git a/Tests/RunCMake/CPack/tests/EXTRA/test.cmake b/Tests/RunCMake/CPack/tests/EXTRA/test.cmake index 754561d..efa6dac 100644 --- a/Tests/RunCMake/CPack/tests/EXTRA/test.cmake +++ b/Tests/RunCMake/CPack/tests/EXTRA/test.cmake @@ -32,7 +32,4 @@ endforeach() set(CPACK_DEBIAN_BAR_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_BINARY_DIR}/bar/preinst;${CMAKE_CURRENT_BINARY_DIR}/bar/prerm") -set(CPACK_PACKAGE_CONTACT "someone") set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") - -set(CPACK_DEB_COMPONENT_INSTALL ON) diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake index fa0bc35..90351ba 100644 --- a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake @@ -1,5 +1,3 @@ -set(CPACK_PACKAGE_CONTACT "someone") -set(CPACK_DEB_COMPONENT_INSTALL "ON") set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS "ON") diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/test.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/test.cmake index 2fc9e23..15c496b 100644 --- a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/test.cmake +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/test.cmake @@ -1,5 +1,3 @@ -set(CPACK_PACKAGE_CONTACT "someone") -set(CPACK_DEB_COMPONENT_INSTALL "ON") set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS "ON") diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake index e16f8e1..fb1b8de 100644 --- a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake @@ -1,6 +1,4 @@ if(GENERATOR_TYPE STREQUAL "RPM") - set(CPACK_RPM_COMPONENT_INSTALL "ON") - set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh") set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE diff --git a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake index f6656c6..f235d47 100644 --- a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake +++ b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake @@ -1,5 +1,4 @@ if(GENERATOR_TYPE STREQUAL "DEB") - set(CPACK_PACKAGE_CONTACT "someone") set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") set(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar") endif() diff --git a/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake index f2c4451..791c586 100644 --- a/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake +++ b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake @@ -1,5 +1,3 @@ -set(CPACK_RPM_COMPONENT_INSTALL "ON") - install(FILES CMakeLists.txt DESTINATION foo COMPONENT applications) install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) install(FILES CMakeLists.txt DESTINATION bas COMPONENT libs) diff --git a/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake b/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake index 4441c8e..83ed0f2 100644 --- a/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake +++ b/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake @@ -1,5 +1 @@ -if(GENERATOR_TYPE STREQUAL "DEB") - set(CPACK_PACKAGE_CONTACT "someone") -endif() - install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) diff --git a/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake index 31e729b..4698fb3 100644 --- a/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake +++ b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake @@ -2,5 +2,3 @@ install(FILES CMakeLists.txt DESTINATION /not_relocatable COMPONENT static) set(CPACK_PACKAGE_RELOCATABLE TRUE) set(CPACK_PACKAGING_INSTALL_PREFIX "/opt") - -set(CPACK_RPM_COMPONENT_INSTALL ON) diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake index 3fca2e2..8719c0b 100644 --- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake @@ -1,18 +1,16 @@ -if(GENERATOR_TYPE STREQUAL "DEB") - set(CPACK_PACKAGE_CONTACT "someone") - set(CPACK_DEB_COMPONENT_INSTALL "ON") - set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") +if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM") + if(GENERATOR_TYPE STREQUAL "DEB") + set(generator_type_suffix_ "IAN") # not entirely compatible... + set(group_ "SECTION") + else() + set(group_ "GROUP") + endif() - set(CPACK_DEBIAN_PACKAGE_SECTION "default") - set(CPACK_DEBIAN_PKG_2_PACKAGE_NAME "second") - set(CPACK_DEBIAN_PKG_2_PACKAGE_SECTION "second_group") -elseif(GENERATOR_TYPE STREQUAL "RPM") - set(CPACK_RPM_COMPONENT_INSTALL "ON") - set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_FILE_NAME "${GENERATOR_TYPE}-DEFAULT") - set(CPACK_RPM_PACKAGE_GROUP "default") - set(CPACK_RPM_PKG_2_PACKAGE_NAME "second") - set(CPACK_RPM_PKG_2_PACKAGE_GROUP "second_group") + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PACKAGE_${group_} "default") + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_NAME "second") + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_${group_} "second_group") endif() install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1) |