RunCPackVerifyResult-components-shlibdeps1.cmake 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. if(NOT CPackComponentsDEB_SOURCE_DIR)
  2. message(FATAL_ERROR "CPackComponentsDEB_SOURCE_DIR not set")
  3. endif()
  4. include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
  5. # requirements
  6. # debian now produces lower case names
  7. set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
  8. set(expected_count 3)
  9. set(actual_output)
  10. run_cpack(actual_output
  11. CPack_output
  12. CPack_error
  13. EXPECTED_FILE_MASK "${expected_file_mask}"
  14. CONFIG_ARGS ${config_args}
  15. CONFIG_VERBOSE ${config_verbose})
  16. message(STATUS "expected_count='${expected_count}'")
  17. message(STATUS "expected_file_mask='${expected_file_mask}'")
  18. message(STATUS "actual_output_files='${actual_output}'")
  19. if(NOT actual_output)
  20. message(FATAL_ERROR "error: expected_files do not exist: CPackComponentsDEB test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}")
  21. endif()
  22. list(LENGTH actual_output actual_count)
  23. message(STATUS "actual_count='${actual_count}'")
  24. if(NOT actual_count EQUAL expected_count)
  25. message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})")
  26. endif()
  27. # dpkg-deb checks for the summary of the packages
  28. find_program(DPKGDEB_EXECUTABLE dpkg-deb)
  29. if(DPKGDEB_EXECUTABLE)
  30. set(dpkgdeb_output_errors_all)
  31. foreach(_f IN LISTS actual_output)
  32. # extracts the metadata from the package
  33. run_dpkgdeb(dpkg_output
  34. FILENAME ${_f}
  35. )
  36. dpkgdeb_return_specific_metaentry(dpkg_package_name
  37. DPKGDEB_OUTPUT "${dpkg_output}"
  38. METAENTRY "Package:")
  39. message(STATUS "package='${dpkg_package_name}'")
  40. if("${dpkg_package_name}" STREQUAL "mylib-applications")
  41. # pass
  42. elseif("${dpkg_package_name}" STREQUAL "mylib-headers")
  43. # pass
  44. elseif("${dpkg_package_name}" STREQUAL "mylib-libraries")
  45. # pass
  46. else()
  47. set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all}
  48. "dpkg-deb: ${_f}: component name not found: ${dpkg_package_name}\n")
  49. endif()
  50. endforeach()
  51. if(NOT "${dpkgdeb_output_errors_all}" STREQUAL "")
  52. message(FATAL_ERROR "dpkg-deb checks failed:\n${dpkgdeb_output_errors_all}")
  53. endif()
  54. else()
  55. message("dpkg-deb executable not found - skipping dpkg-deb test")
  56. endif()