RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 3)
  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. # lintian checks
  27. find_program(LINTIAN_EXECUTABLE lintian)
  28. if(LINTIAN_EXECUTABLE)
  29. set(lintian_output_errors_all "")
  30. foreach(_f IN LISTS actual_output)
  31. set(STRINGS_TO_AVOID "E:([^\r\n]*)control-file-has-bad-permissions" "E:([^\r\n]*)md5sums-lists-nonexistent-file")
  32. lintian_check_specific_errors(lintian_output_errors
  33. FILENAME "${_f}"
  34. ERROR_REGEX_STRINGS "${STRINGS_TO_AVOID}")
  35. string(APPEND lintian_output_errors_all "${lintian_output_errors}")
  36. endforeach()
  37. if(NOT "${lintian_output_errors_all}" STREQUAL "")
  38. message(FATAL_ERROR "Lintian checks failed:\n${lintian_output_errors_all}")
  39. endif()
  40. else()
  41. message("lintian executable not found - skipping lintian test")
  42. endif()
  43. # dpkg-deb checks
  44. find_program(DPKGDEB_EXECUTABLE dpkg-deb)
  45. if(DPKGDEB_EXECUTABLE)
  46. set(dpkgdeb_output_errors_all "")
  47. foreach(_f IN LISTS actual_output)
  48. run_dpkgdeb(dpkg_output
  49. FILENAME "${_f}"
  50. )
  51. dpkgdeb_return_specific_metaentry(dpkgentry
  52. DPKGDEB_OUTPUT "${dpkg_output}"
  53. METAENTRY "Maintainer:")
  54. if(NOT "${dpkgentry}" STREQUAL "None")
  55. set(dpkgdeb_output_errors_all "${dpkgdeb_output_errors_all}"
  56. "dpkg-deb: ${_f}: Incorrect value for Maintainer: ${dpkgentry} != None\n")
  57. endif()
  58. endforeach()
  59. if(NOT "${dpkgdeb_output_errors_all}" STREQUAL "")
  60. message(FATAL_ERROR "dpkg-deb checks failed:\n${dpkgdeb_output_errors_all}")
  61. endif()
  62. else()
  63. message("dpkg-deb executable not found - skipping dpkg-deb test")
  64. endif()