diff options
author | Alex Sweet <asweet@ss8.com> | 2021-06-29 14:13:20 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-06-29 15:14:54 (GMT) |
commit | 9b53eca317e52dffa1ba8972981af7b40392e323 (patch) | |
tree | 0a04b9e5d3462fa3e89fe17f2800beb6ce8bbc01 /Modules/Internal | |
parent | fb02657b6a4f66cfb1b1673c170136f07945eda2 (diff) | |
download | CMake-9b53eca317e52dffa1ba8972981af7b40392e323.zip CMake-9b53eca317e52dffa1ba8972981af7b40392e323.tar.gz CMake-9b53eca317e52dffa1ba8972981af7b40392e323.tar.bz2 |
CPack/RPM: Fix weak dep support
RPM 4.11.3 for el7 contains backported support for the RPM weak dep tags.
It only supports querying those tags, but rpmbuild can not make use of them.
Since CPack relies on rpmbuild --querytags to check for support, this
commit switches to rpm --suggests to check for support of weak
dependencies.
Fixes: #22350
Diffstat (limited to 'Modules/Internal')
-rw-r--r-- | Modules/Internal/CPack/CPackRPM.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake index bece2dd..47d2a5c 100644 --- a/Modules/Internal/CPack/CPackRPM.cmake +++ b/Modules/Internal/CPack/CPackRPM.cmake @@ -1074,6 +1074,21 @@ function(cpack_rpm_generate_package) OUTPUT_STRIP_TRAILING_WHITESPACE) string(REPLACE "\n" ";" RPMBUILD_TAG_LIST "${RPMBUILD_TAG_LIST}") + # In some versions of RPM, weak dependency tags are present in the --querytags + # list, but unsupported by rpmbuild. A different method must be used to check + # if they are supported. + + execute_process( + COMMAND ${RPM_EXECUTABLE} --suggests + ERROR_QUIET + RESULT_VARIABLE RPMBUILD_SUGGESTS_RESULT) + + if(NOT RPMBUILD_SUGGESTS_RESULT EQUAL 0) + foreach(_WEAK_DEP SUGGESTS RECOMMENDS SUPPLEMENTS ENHANCES) + list(REMOVE_ITEM RPMBUILD_TAG_LIST ${_WEAK_DEP}) + endforeach() + endif() + if(CPACK_RPM_PACKAGE_EPOCH) set(TMP_RPM_EPOCH "Epoch: ${CPACK_RPM_PACKAGE_EPOCH}") endif() |