Skip to content

Commit 694f436

Browse files
committed
CPackRPM support for Recommends:
this breaks support for Suggests: but we don't use it anyway
1 parent 2b856ec commit 694f436

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

cmake/Internal/CPack/CPackRPM.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
# Wrapper for CPackRPM.cmake
33
#
44

5+
IF(NOT DEFINED RPM_RECOMMENDS)
6+
EXECUTE_PROCESS(COMMAND rpm --recommends ERROR_QUIET RESULT_VARIABLE RPM_RECOMMENDS)
7+
MESSAGE("CPackRPM:Debug: Testing rpm --recommends: ${RPM_RECOMMENDS}")
8+
ENDIF()
9+
510
#
611
# Support for per-component LICENSE and VENDOR
712
#
@@ -47,6 +52,20 @@ if (acc)
4752
file(WRITE ${${base_var}} "${acc}")
4853
endif()
4954

55+
#
56+
# Support for the Recommends: tag.
57+
# We don't use Suggests: so here he hijack Suggests: variable
58+
# to implement Recommends:
59+
#
60+
IF (CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_RECOMMENDS)
61+
IF (RPM_RECOMMENDS EQUAL 0) # exit code 0 means ok
62+
SET(TMP_RPM_SUGGESTS "Recommends: ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_RECOMMENDS}")
63+
ELSE() # rpm is too old to recommend
64+
SET(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_REQUIRES
65+
"${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_REQUIRES} ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_RECOMMENDS}")
66+
ENDIF()
67+
ENDIF()
68+
5069
# load the original CPackRPM.cmake
5170
set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
5271
unset(CMAKE_MODULE_PATH)

0 commit comments

Comments
 (0)