CPackRPM: Support PREUN and POSTUN requirements

This commit is contained in:
Evgeny Kalishenko 2014-10-09 21:29:18 +04:00 committed by Brad King
parent add4e50dea
commit 9ed546ff49
1 changed files with 33 additions and 4 deletions

View File

@ -163,6 +163,31 @@
# set(CPACK_RPM_PACKAGE_REQUIRES_POST "shadow-utils, initscripts")
#
#
# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POSTUN
#
# RPM spec requires(postun) field.
#
# * Mandatory : NO
# * Default : -
#
# May be used to set RPM postuninstall dependencies (requires(postun)). Note that you must enclose
# the complete requires string between quotes, for example::
#
# set(CPACK_RPM_PACKAGE_REQUIRES_POSTUN "shadow-utils, initscripts")
#
#
# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PREUN
#
# RPM spec requires(preun) field.
#
# * Mandatory : NO
# * Default : -
#
# May be used to set RPM preuninstall dependencies (requires(preun)). Note that you must enclose
# the complete requires string between quotes, for example::
#
# set(CPACK_RPM_PACKAGE_REQUIRES_PREUN "shadow-utils, initscripts")
#
# .. variable:: CPACK_RPM_PACKAGE_SUGGESTS
#
# RPM spec suggest field.
@ -412,7 +437,7 @@ if(CPACK_RPM_PACKAGE_DEBUG)
OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "\n" ", "
string(REGEX REPLACE "\n" ", "
LSB_RELEASE_OUTPUT
${_TMP_LSB_RELEASE_OUTPUT})
else ()
@ -425,7 +450,7 @@ endif()
# to shut down warning about space in buildtree
# some recent RPM version should support space in different places.
# not checked [yet].
if(CPACK_TOPLEVEL_DIRECTORY MATCHES " ")
if(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*")
message(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.")
endif()
@ -625,7 +650,7 @@ endif()
# There may be some COMPONENT specific variables as well
# If component specific var is not provided we use the global one
# for each component
foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV REQUIRES_PRE REQUIRES_POST)
foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN)
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}")
endif()
@ -665,7 +690,9 @@ foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLIC
string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME)
set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}")
# The following keywords require parentheses around the "pre" or "post" suffix in the final RPM spec file.
if("${_RPM_SPEC_HEADER}" MATCHES "REQUIRES_PRE" OR "${_RPM_SPEC_HEADER}" MATCHES "REQUIRES_POST")
set(SCRIPTS_REQUIREMENTS_LIST REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN)
list(FIND SCRIPTS_REQUIREMENTS_LIST ${_RPM_SPEC_HEADER} IS_SCRIPTS_REQUIREMENT_FOUND)
if(NOT ${IS_SCRIPTS_REQUIREMENT_FOUND} EQUAL -1)
string(REPLACE "_" "(" _PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}")
set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME})")
endif()
@ -1067,6 +1094,8 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@TMP_RPM_REQUIRES\@
\@TMP_RPM_REQUIRES_PRE\@
\@TMP_RPM_REQUIRES_POST\@
\@TMP_RPM_REQUIRES_PREUN\@
\@TMP_RPM_REQUIRES_POSTUN\@
\@TMP_RPM_PROVIDES\@
\@TMP_RPM_OBSOLETES\@
\@TMP_RPM_CONFLICTS\@