From 1a965bbd80185026264aa5d28b428c2505bd4a5d Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Tue, 16 Aug 2022 16:44:11 +0400 Subject: [PATCH] Added lintian post-build step (#12576) * Added lintian post-build step * Update cmake/developer_package/packaging/debian_post_build.cmake Co-authored-by: Ilya Churaev Co-authored-by: Ilya Churaev --- .../packaging/debian_post_build.cmake | 41 +++++++++++++++++++ cmake/packaging/debian.cmake | 18 ++++---- install_build_dependencies.sh | 1 + 3 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 cmake/developer_package/packaging/debian_post_build.cmake diff --git a/cmake/developer_package/packaging/debian_post_build.cmake b/cmake/developer_package/packaging/debian_post_build.cmake new file mode 100644 index 00000000000..4b2150ff97d --- /dev/null +++ b/cmake/developer_package/packaging/debian_post_build.cmake @@ -0,0 +1,41 @@ +# Copyright (C) 2018-2022 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +find_program(lintian_PROGRAM NAMES lintian DOC "Path to lintian tool") +if(NOT lintian_PROGRAM) + message(WARNING "Failed to find 'lintian' tool, use 'sudo apt-get install lintian' to install it") + return() +endif() + +execute_process(COMMAND "${lintian_PROGRAM}" --version + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + RESULT_VARIABLE lintian_code + OUTPUT_VARIABLE lintian_version) + +if(NOT lintian_code EQUAL 0) + message(FATAL_ERROR "Internal error: Failed to determine lintian version") +else() + message(STATUS "${lintian_version}") +endif() + +set(lintian_passed ON) + +foreach(deb_file IN LISTS CPACK_PACKAGE_FILES) + execute_process(COMMAND "${lintian_PROGRAM}" ${deb_file} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + RESULT_VARIABLE lintian_exit_code + OUTPUT_VARIABLE lintian_output) + + get_filename_component(deb_name "${deb_file}" NAME) + + if(NOT lintian_exit_code EQUAL 0) + message("Package ${deb_name}:") + message("${lintian_output}") + set(lintian_passed OFF) + endif() +endforeach() + +if(NOT lintian_passed) + message(FATAL_ERROR "Lintian has found some mistakes") +endif() diff --git a/cmake/packaging/debian.cmake b/cmake/packaging/debian.cmake index 2bfd174d5b3..13a6b7c7b97 100644 --- a/cmake/packaging/debian.cmake +++ b/cmake/packaging/debian.cmake @@ -91,6 +91,8 @@ macro(ov_cpack_settings) set(CPACK_DEBIAN_CORE_PACKAGE_NAME "libopenvino-${cpack_name_ver}") # we need triggers to run ldconfig for openvino set(CPACK_DEBIAN_CORE_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm};${def_triggers}") + # use lintian to check packages in post-build step + set(CPACK_POST_BUILD_SCRIPTS "${IEDevScripts_DIR}/packaging/debian_post_build.cmake") # We currently don't have versioning for openvino core library ov_debian_add_lintian_suppression(core @@ -279,14 +281,6 @@ macro(ov_cpack_settings) list(APPEND CPACK_COMPONENTS_ALL "libraries;libraries_dev;openvino") - # - # install debian common files - # - - foreach(comp IN LISTS CPACK_COMPONENTS_ALL) - ov_debian_add_changelog_and_copyright("${comp}") - endforeach() - # # Install latest symlink packages # @@ -302,4 +296,12 @@ macro(ov_cpack_settings) # users can manually install specific version of package # e.g. sudo apt-get install openvino=2022.1.0 # even if we have latest package version 2022.2.0 + + # + # install debian common files + # + + foreach(comp IN LISTS CPACK_COMPONENTS_ALL) + ov_debian_add_changelog_and_copyright("${comp}") + endforeach() endmacro() diff --git a/install_build_dependencies.sh b/install_build_dependencies.sh index 9f6d054e20c..52b25923d47 100755 --- a/install_build_dependencies.sh +++ b/install_build_dependencies.sh @@ -45,6 +45,7 @@ if [ -f /etc/lsb-release ]; then unzip \ shellcheck \ patchelf \ + lintian \ `# openvino` \ libtbb-dev \ libpugixml-dev \