Commit cb5cadf3 authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'cpack-rpm-single-debuginfo'

bb8cf521 CPack/RPM single debuginfo packaging
758f58b4 CPack/RPM learned defining main component
parents 9c4d1056 bb8cf521
cpack-rpm-single-debuginfo
--------------------------
* The :module:`CPackRPM` module learned to generate main component package
which forces generation of a rpm for defined component without component
suffix in filename and package name.
See :variable:`CPACK_RPM_MAIN_COMPONENT` variable.
* The :module:`CPackRPM` module learned to generate a single debuginfo package
on demand even if components packagin is used.
See :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` variable.
This diff is collapsed.
This diff is collapsed.
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)
if(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid")
set(CPACK_RPM_MAIN_COMPONENT "")
else()
set(CPACK_RPM_MAIN_COMPONENT "applications")
set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT")
endif()
set(CPACK_PACKAGE_NAME "main_component")
set(whitespaces_ "[\t\n\r ]*")
set(EXPECTED_FILES_COUNT "0")
if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "invalid")
set(EXPECTED_FILES_COUNT "3")
set(EXPECTED_FILE_1 "main_component-0.1.1-1.*.rpm")
set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
set(EXPECTED_FILE_2 "main_component*-headers.rpm")
set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$")
set(EXPECTED_FILE_3 "main_component*-libs.rpm")
set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/CMakeLists.txt$")
endif()
^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component-headers.spec
CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component-libs.spec
CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component.spec$
CPACK_RPM_MAIN_COMPONENT set to non existing component.
set(whitespaces_ "[\t\n\r ]*")
set(EXPECTED_FILES_COUNT "0")
if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo")
set(EXPECTED_FILES_COUNT "4")
set(EXPECTED_FILE_1 "single_debuginfo-0.1.1-1.*.rpm")
set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$")
set(EXPECTED_FILE_2 "single_debuginfo*-headers.rpm")
set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$")
set(EXPECTED_FILE_3 "single_debuginfo*-libs.rpm")
set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/libtest_lib.so$")
set(EXPECTED_FILE_4 "single_debuginfo-debuginfo*.rpm")
set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp${whitespaces_}/src/src_1/test_lib.cpp.*")
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo")
set(EXPECTED_FILES_COUNT "2")
set(EXPECTED_FILE_1 "single_debuginfo-0*-applications.rpm")
set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$")
set(EXPECTED_FILE_2 "single_debuginfo-applications-debuginfo*.rpm")
set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*")
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_components")
set(EXPECTED_FILES_COUNT "2")
set(EXPECTED_FILE_1 "single_debuginfo-0*.rpm")
set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$")
set(EXPECTED_FILE_2 "single_debuginfo-debuginfo*.rpm")
set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*")
endif()
^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_components-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$
^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-headers.spec
CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-libs.spec
CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$
CPack Error: CPACK_RPM_MAIN_COMPONENT not set but it is mandatory with CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE being set.
^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-applications.spec$
^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component_main-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$
^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component_no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-applications.spec$
^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-headers.spec
CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-libs.spec
CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$
......@@ -12,11 +12,13 @@ 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(RPM_DIST "RPM" false)
run_cpack_test(INSTALL_SCRIPTS "RPM" false)
run_cpack_test(DEB_GENERATE_SHLIBS "DEB" true)
run_cpack_test(DEB_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" "TGZ" false)
set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
# PGI compiler doesn't add build id to binaries by default
if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI")
string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id")
string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id")
endif()
if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "no_components")
set(CPACK_RPM_COMPONENT_INSTALL "ON")
endif()
set(CMAKE_BUILD_TYPE Debug)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp"
"int test_lib();\n")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp"
"#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n")
add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
"#include \"test_lib.hpp\"\nint main() {return test_lib();}\n")
add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
target_link_libraries(test_prog test_lib)
install(TARGETS test_prog DESTINATION foo COMPONENT applications)
if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid"
OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component"
OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo")
install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers)
install(TARGETS test_lib DESTINATION bas COMPONENT libs)
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component"
OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo")
set(CPACK_COMPONENTS_ALL applications)
endif()
set(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE ON)
if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid"
OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main"
OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo")
set(CPACK_RPM_MAIN_COMPONENT "applications")
set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT")
endif()
if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid"
OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component"
OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component")
set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON)
set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON)
endif()
set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/src")
set(CPACK_PACKAGE_NAME "single_debuginfo")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment