RunCPackVerifyResult-compression.cmake 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. # TODO: currently debian doesn't produce lower cased names
  6. set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib_1.0.2_*.deb")
  7. set(expected_count 1)
  8. set(actual_output)
  9. run_cpack(actual_output
  10. CPack_output
  11. CPack_error
  12. EXPECTED_FILE_MASK "${expected_file_mask}"
  13. CONFIG_ARGS "${config_args}"
  14. CONFIG_VERBOSE "${config_verbose}")
  15. if(NOT actual_output)
  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. message(FATAL_ERROR "error: expected_files do not exist: CPackComponentsDEB test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}")
  20. endif()
  21. list(LENGTH actual_output actual_count)
  22. if(NOT actual_count EQUAL expected_count)
  23. message(STATUS "actual_count='${actual_count}'")
  24. 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})")
  25. endif()
  26. # dpkg-deb checks
  27. find_program(DPKGDEB_EXECUTABLE dpkg-deb)
  28. if(DPKGDEB_EXECUTABLE)
  29. set(dpkgdeb_output_errors_all "")
  30. foreach(_f IN LISTS actual_output)
  31. run_dpkgdeb(dpkg_output
  32. FILENAME "${_f}"
  33. )
  34. # message(FATAL_ERROR "output = '${dpkg_output}'")
  35. if("${dpkg_output}" STREQUAL "")
  36. set(dpkgdeb_output_errors_all "${dpkgdeb_output_errors_all}"
  37. "dpkg-deb: ${_f}: empty content returned by dpkg-deb")
  38. endif()
  39. endforeach()
  40. if(NOT "${dpkgdeb_output_errors_all}" STREQUAL "")
  41. message(FATAL_ERROR "dpkg-deb checks failed:\n${dpkgdeb_output_errors_all}")
  42. endif()
  43. else()
  44. message("dpkg-deb executable not found - skipping dpkg-deb test")
  45. endif()