diff options
author | Domen Vrankar <domen.vrankar@gmail.com> | 2015-01-20 23:29:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-01-29 15:48:58 (GMT) |
commit | 3ec025472735c22cb90b09bc171190005dd28bb1 (patch) | |
tree | ef09aed4a19e40b892c3228fb0f2aa3051c22423 /Tests/CPackComponentsForAll | |
parent | 8c4b7c567bbb47ed9555da2bd50b672304ccb858 (diff) | |
download | CMake-3ec025472735c22cb90b09bc171190005dd28bb1.zip CMake-3ec025472735c22cb90b09bc171190005dd28bb1.tar.gz CMake-3ec025472735c22cb90b09bc171190005dd28bb1.tar.bz2 |
CPackRPM: Allow multiple path relocation prefixes for one package
Diffstat (limited to 'Tests/CPackComponentsForAll')
-rw-r--r-- | Tests/CPackComponentsForAll/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in | 16 | ||||
-rw-r--r-- | Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake | 30 |
3 files changed, 43 insertions, 9 deletions
diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index ff40e30..b55594e 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -110,6 +110,12 @@ set(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Developer Full) set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full) +# set CPACK_RPM_RELOCATION_PATHS here as GNUInstallDirs script +# can not be used in CPack scripts due to CMAKE_SIZEOF_VOID_P +# variable not being set +set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}" + "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}") + # We may use the CPack specific config file in order # to tailor CPack behavior on a CPack generator specific way # (Behavior would be different for RPM or TGZ or DEB ...) diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index 8c01b32..de0ee46 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -6,15 +6,17 @@ if(CPACK_GENERATOR MATCHES "ZIP") endif() if(CPACK_GENERATOR MATCHES "RPM") - set(CPACK_RPM_COMPONENT_INSTALL "ON") - set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries") + set(CPACK_PACKAGING_INSTALL_PREFIX "/usr") - # test package summary override - set(CPACK_RPM_PACKAGE_SUMMARY "default summary") - set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary") + set(CPACK_RPM_COMPONENT_INSTALL "ON") + set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries") - # test package description override - set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description") + # test package summary override + set(CPACK_RPM_PACKAGE_SUMMARY "default summary") + set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary") + + # test package description override + set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description") endif() if(CPACK_GENERATOR MATCHES "DEB") diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 4d56218..68d846f 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -140,6 +140,12 @@ if(CPackGen MATCHES "RPM") "C/C\\+\\+ header files for use with MyLib") if(${CPackComponentWay} STREQUAL "IgnoreGroup") + # set gnu install prefixes to what they are set during rpm creation + # CMAKE_SIZEOF_VOID_P is not set here but lib is prefix of lib64 so + # relocation path test won't fail on OSes with lib64 library location + include(GNUInstallDirs) + set(CPACK_PACKAGING_INSTALL_PREFIX "/usr") + foreach(check_file ${expected_file}) string(REGEX MATCH ".*libraries.*" check_file_libraries_match ${check_file}) string(REGEX MATCH ".*headers.*" check_file_headers_match ${check_file}) @@ -154,15 +160,23 @@ if(CPackGen MATCHES "RPM") if(check_file_libraries_match) set(check_file_match_expected_summary ".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*") + set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(spec_regex "*libraries*") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*") + set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") + set(spec_regex "*headers*") elseif(check_file_applications_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") + set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + set(spec_regex "*applications*") elseif(check_file_Unspecified_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*DESCRIPTION.*") + set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + set(spec_regex "*Unspecified*") else() message(FATAL_ERROR "error: unexpected rpm package '${check_file}'") endif() @@ -170,13 +184,25 @@ if(CPackGen MATCHES "RPM") string(REGEX MATCH ${check_file_match_expected_summary} check_file_match_summary ${check_file_content}) if(NOT check_file_match_summary) - message(FATAL_ERROR "error: '${check_file}' rpm package summary does not match expected value - regex '${check_file_match_expected_summary}'") + message(FATAL_ERROR "error: '${check_file}' rpm package summary does not match expected value - regex '${check_file_match_expected_summary}'; RPM output: '${check_file_content}'") endif() string(REGEX MATCH ${check_file_match_expected_description} check_file_match_description ${check_file_content}) if(NOT check_file_match_description) - message(FATAL_ERROR "error: '${check_file}' rpm package description does not match expected value - regex '${check_file_match_expected_description}'") + message(FATAL_ERROR "error: '${check_file}' rpm package description does not match expected value - regex '${check_file_match_expected_description}'; RPM output: '${check_file_content}'") + endif() + + string(REGEX MATCH ${check_file_match_expected_relocation_path} check_file_match_relocation_path ${check_file_content}) + + if(NOT check_file_match_relocation_path) + file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/${spec_regex}.spec") + + if(spec_file) + file(READ ${spec_file} spec_file_content) + endif() + + message(FATAL_ERROR "error: '${check_file}' rpm package relocation path does not match expected value - regex '${check_file_match_expected_relocation_path}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'") endif() endforeach() elseif(${CPackComponentWay} STREQUAL "IgnoreGroup") |