OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
rpm: add RHEL dist tag (#37469)
Artyom Anokhov28aebfe8e1aa
diff --git a/cmake/developer_package/packaging/rpm/rpm.cmake b/cmake/developer_package/packaging/rpm/rpm.cmakeindex 25f43d04ae2..92fd33adde5 100644--- a/cmake/developer_package/packaging/rpm/rpm.cmake+++ b/cmake/developer_package/packaging/rpm/rpm.cmake@@ -140,6 +140,8 @@ macro(ov_rpm_specific_settings)set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")# need to update this version once we rebuild the same package with additional fixesset(CPACK_RPM_PACKAGE_RELEASE "1")+ # append distribution-specific release tag (e.g. .el8, .el9) using rpm's native %{?dist} macro+ set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)# enable this if someday we change the version scheme# set(CPACK_RPM_PACKAGE_EPOCH "2")@@ -228,7 +230,29 @@ function(ov_rpm_add_rpmlint_suppression comp)message(FATAL_ERROR "RPM: Unsupported architecture ${CMAKE_SYSTEM_PROCESSOR}")endif()- set(package_file_name "${package_name}-${CPACK_PACKAGE_VERSION}-1.${arch}.rpm")+ # resolve rpm's native distribution release tag (e.g. .el8, .el9) once, so the computed+ # rpmlint override file name matches the actual RPM file name produced by CPack+ if(CPACK_RPM_PACKAGE_RELEASE_DIST AND NOT DEFINED OV_RPM_DIST_TAG)+ find_program(rpm_PROGRAM NAMES rpm)+ if(rpm_PROGRAM)+ execute_process(COMMAND "${rpm_PROGRAM}" --eval "%{?dist}"+ OUTPUT_VARIABLE rpm_dist_tag+ OUTPUT_STRIP_TRAILING_WHITESPACE)+ else()+ message(FATAL_ERROR+ "RPM: cannot determine %{?dist}: rpmbuild was not found. "+ "Set OV_RPM_DIST_TAG explicitly or disable distribution tagging.")+ endif()+ set(OV_RPM_DIST_TAG "${rpm_dist_tag}" CACHE INTERNAL "RPM distribution release tag (%{?dist})")+ endif()+ set(package_release "${CPACK_RPM_PACKAGE_RELEASE}${OV_RPM_DIST_TAG}")++ # some package names (e.g. python bindings) embed cpack_full_ver, which itself+ # contains a literal '%{?dist}' macro to keep RPM dependencies consistent with the+ # real package EVR; replace it here with the already resolved dist tag as well+ string(REPLACE "%{?dist}" "${OV_RPM_DIST_TAG}" package_name "${package_name}")++ set(package_file_name "${package_name}-${CPACK_PACKAGE_VERSION}-${package_release}.${arch}.rpm")set(rpmlint_override_file "${OpenVINO_BINARY_DIR}/_CPack_Packages/rpmlint/${package_file_name}.rpmlintrc")file(REMOVE ${rpmlint_override_file})file(WRITE ${rpmlint_override_file} ${content})diff --git a/cmake/packaging/rpm.cmake b/cmake/packaging/rpm.cmakeindex e7d7b269c11..5c75e22213c 100644--- a/cmake/packaging/rpm.cmake+++ b/cmake/packaging/rpm.cmake@@ -63,6 +63,12 @@ macro(ov_cpack_settings)# take release version into accountif(DEFINED CPACK_RPM_PACKAGE_RELEASE)set(cpack_full_ver "${cpack_full_ver}-${CPACK_RPM_PACKAGE_RELEASE}")++ # rpm's native distribution release tag (e.g. .el8, .el9) is appended by rpmbuild+ # itself when CPACK_RPM_PACKAGE_RELEASE_DIST is enabled, so reflect it here as well+ if(CPACK_RPM_PACKAGE_RELEASE_DIST)+ string(APPEND cpack_full_ver "%{?dist}")+ endif()endif()# take epoch version into account