summaryrefslogtreecommitdiffstats
path: root/Modules/CPackRPM.cmake
diff options
context:
space:
mode:
authorEvgeny Kalishenko <ydginster@gmail.com>2014-10-09 17:29:18 (GMT)
committerBrad King <brad.king@kitware.com>2014-10-27 16:36:20 (GMT)
commit9ed546ff499b452a0266ab6c1c53e3131a67fd9b (patch)
tree95274eaa074a5f353fc0d9c2ba0c139b4ad75fd8 /Modules/CPackRPM.cmake
parentadd4e50dea4afffd53853dfa5cbbcb172f86a99b (diff)
downloadCMake-9ed546ff499b452a0266ab6c1c53e3131a67fd9b.zip
CMake-9ed546ff499b452a0266ab6c1c53e3131a67fd9b.tar.gz
CMake-9ed546ff499b452a0266ab6c1c53e3131a67fd9b.tar.bz2
CPackRPM: Support PREUN and POSTUN requirements
Diffstat (limited to 'Modules/CPackRPM.cmake')
-rw-r--r--Modules/CPackRPM.cmake37
1 files changed, 33 insertions, 4 deletions
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 6deb4c0..56d9b66 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -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\@