mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 20:46:37 +08:00
CPackRPM: Add PRE_/POST_TRANS scripts
Add variables for PRE_TRANS and POST_TRANS scripts. Fixes: #18917
This commit is contained in:
@@ -473,38 +473,42 @@ List of CPack RPM generator specific variables:
|
|||||||
|
|
||||||
.. variable:: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
|
.. variable:: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
|
||||||
CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
|
CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
|
||||||
|
CPACK_RPM_PRE_TRANS_SCRIPT_FILE
|
||||||
|
|
||||||
Path to file containing pre (un)install script.
|
Path to file containing pre install/uninstall/transaction script.
|
||||||
|
|
||||||
* Mandatory : NO
|
* Mandatory : NO
|
||||||
* Default : -
|
* Default : -
|
||||||
|
|
||||||
May be used to embed a pre (un)installation script in the spec file.
|
May be used to embed a pre installation/uninstallation/transaction script in the spec file.
|
||||||
The referred script file (or both) will be read and directly
|
The referred script file (or both) will be read and directly
|
||||||
put after the ``%pre`` or ``%preun`` section
|
put after the ``%pre`` or ``%preun`` section
|
||||||
If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install
|
If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the install/uninstall/transaction
|
||||||
script for each component can be overridden with
|
script for each component can be overridden with
|
||||||
``CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE`` and
|
``CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE``,
|
||||||
``CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE``.
|
``CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE``, and
|
||||||
|
``CPACK_RPM_<COMPONENT>_PRE_TRANS_SCRIPT_FILE``
|
||||||
One may verify which scriptlet has been included with::
|
One may verify which scriptlet has been included with::
|
||||||
|
|
||||||
rpm -qp --scripts package.rpm
|
rpm -qp --scripts package.rpm
|
||||||
|
|
||||||
.. variable:: CPACK_RPM_POST_INSTALL_SCRIPT_FILE
|
.. variable:: CPACK_RPM_POST_INSTALL_SCRIPT_FILE
|
||||||
CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
|
CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
|
||||||
|
CPACK_RPM_POST_TRANS_SCRIPT_FILE
|
||||||
|
|
||||||
Path to file containing post (un)install script.
|
Path to file containing post install/uninstall/transaction script.
|
||||||
|
|
||||||
* Mandatory : NO
|
* Mandatory : NO
|
||||||
* Default : -
|
* Default : -
|
||||||
|
|
||||||
May be used to embed a post (un)installation script in the spec file.
|
May be used to embed a post installation/uninstallation/transaction script in the spec file.
|
||||||
The referred script file (or both) will be read and directly
|
The referred script file (or both) will be read and directly
|
||||||
put after the ``%post`` or ``%postun`` section.
|
put after the ``%post`` or ``%postun`` section.
|
||||||
If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install
|
If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the install/uninstall/transaction
|
||||||
script for each component can be overridden with
|
script for each component can be overridden with
|
||||||
``CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE`` and
|
``CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE``,
|
||||||
``CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE``.
|
``CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE``, and
|
||||||
|
``CPACK_RPM_<COMPONENT>_POST_TRANS_SCRIPT_FILE``
|
||||||
One may verify which scriptlet has been included with::
|
One may verify which scriptlet has been included with::
|
||||||
|
|
||||||
rpm -qp --scripts package.rpm
|
rpm -qp --scripts package.rpm
|
||||||
|
7
Help/release/dev/CPackRPM-trans-scripts.rst
Normal file
7
Help/release/dev/CPackRPM-trans-scripts.rst
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
CPackRPM-trans-scripts
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
* The :cpack_gen:`CPack RPM Generator` gained
|
||||||
|
:variable:`CPACK_RPM_PRE_TRANS_SCRIPT_FILE`
|
||||||
|
:variable:`CPACK_RPM_POST_TRANS_SCRIPT_FILE`
|
||||||
|
variables to specify pre- and post-trans scripts.
|
@@ -1099,16 +1099,18 @@ function(cpack_rpm_generate_package)
|
|||||||
|
|
||||||
# CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE)
|
# CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE)
|
||||||
# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE)
|
# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE)
|
||||||
# May be used to embed a post (un)installation script in the spec file.
|
# CPACK_RPM_POST_TRANS_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_TRANS_SCRIPT_FILE)
|
||||||
|
# May be used to embed a post installation/uninstallation/transaction script in the spec file.
|
||||||
# The referred script file(s) will be read and directly
|
# The referred script file(s) will be read and directly
|
||||||
# put after the %post or %postun section
|
# put after the %post or %postun or %posttrans section
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE)
|
# CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE)
|
||||||
# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE)
|
# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE)
|
||||||
# May be used to embed a pre (un)installation script in the spec file.
|
# CPACK_RPM_PRE_TRANS_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_TRANS_SCRIPT_FILE)
|
||||||
|
# May be used to embed a pre installation/uninstallation/transaction script in the spec file.
|
||||||
# The referred script file(s) will be read and directly
|
# The referred script file(s) will be read and directly
|
||||||
# put after the %pre or %preun section
|
# put after the %pre or %preun or %pretrans section
|
||||||
foreach(RPM_SCRIPT_FILE_TYPE_ "INSTALL" "UNINSTALL")
|
foreach(RPM_SCRIPT_FILE_TYPE_ "INSTALL" "UNINSTALL" "TRANS")
|
||||||
foreach(RPM_SCRIPT_FILE_TIME_ "PRE" "POST")
|
foreach(RPM_SCRIPT_FILE_TIME_ "PRE" "POST")
|
||||||
set("CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE"
|
set("CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE"
|
||||||
"${CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_SCRIPT_FILE}")
|
"${CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_SCRIPT_FILE}")
|
||||||
@@ -1727,12 +1729,18 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
|
|||||||
\@RPM_SYMLINK_POSTINSTALL\@
|
\@RPM_SYMLINK_POSTINSTALL\@
|
||||||
\@CPACK_RPM_SPEC_POSTINSTALL\@
|
\@CPACK_RPM_SPEC_POSTINSTALL\@
|
||||||
|
|
||||||
|
%posttrans
|
||||||
|
\@CPACK_RPM_SPEC_POSTTRANS\@
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
\@CPACK_RPM_SPEC_POSTUNINSTALL\@
|
\@CPACK_RPM_SPEC_POSTUNINSTALL\@
|
||||||
|
|
||||||
%pre
|
%pre
|
||||||
\@CPACK_RPM_SPEC_PREINSTALL\@
|
\@CPACK_RPM_SPEC_PREINSTALL\@
|
||||||
|
|
||||||
|
%pretrans
|
||||||
|
\@CPACK_RPM_SPEC_PRETRANS\@
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
\@CPACK_RPM_SPEC_PREUNINSTALL\@
|
\@CPACK_RPM_SPEC_PREUNINSTALL\@
|
||||||
|
|
||||||
|
@@ -25,5 +25,5 @@ function(checkScripts_ FILE COMPARE_LIST)
|
|||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
checkScripts_("${FOUND_FILE_1}" "echo \"pre install foo\";echo \"post install foo\";echo \"pre uninstall foo\";echo \"post uninstall foo\"")
|
checkScripts_("${FOUND_FILE_1}" "echo \"pre install foo\";echo \"post install foo\";echo \"pre uninstall foo\";echo \"post uninstall foo\";echo \"pre trans foo\";echo \"post trans foo\"")
|
||||||
checkScripts_("${FOUND_FILE_2}" "echo \"pre install\";echo \"post install\";echo \"pre uninstall\";echo \"post uninstall\"")
|
checkScripts_("${FOUND_FILE_2}" "echo \"pre install\";echo \"post install\";echo \"pre uninstall\";echo \"post uninstall\";echo \"pre trans\";echo \"post trans\"")
|
||||||
|
@@ -7,6 +7,10 @@ if(GENERATOR_TYPE STREQUAL "RPM")
|
|||||||
"${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh")
|
"${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh")
|
||||||
set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
|
set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh")
|
"${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh")
|
||||||
|
set(CPACK_RPM_PRE_TRANS_SCRIPT_FILE
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pre_trans.sh")
|
||||||
|
set(CPACK_RPM_POST_TRANS_SCRIPT_FILE
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/post_trans.sh")
|
||||||
|
|
||||||
set(CPACK_RPM_foo_PRE_INSTALL_SCRIPT_FILE
|
set(CPACK_RPM_foo_PRE_INSTALL_SCRIPT_FILE
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh")
|
"${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh")
|
||||||
@@ -16,6 +20,10 @@ if(GENERATOR_TYPE STREQUAL "RPM")
|
|||||||
"${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh")
|
"${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh")
|
||||||
set(CPACK_RPM_foo_POST_UNINSTALL_SCRIPT_FILE
|
set(CPACK_RPM_foo_POST_UNINSTALL_SCRIPT_FILE
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh")
|
"${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh")
|
||||||
|
set(CPACK_RPM_foo_PRE_TRANS_SCRIPT_FILE
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pre_trans_foo.sh")
|
||||||
|
set(CPACK_RPM_foo_POST_TRANS_SCRIPT_FILE
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/post_trans_foo.sh")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
|
||||||
@@ -29,6 +37,10 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh"
|
|||||||
"echo \"pre uninstall\"\n")
|
"echo \"pre uninstall\"\n")
|
||||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh"
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh"
|
||||||
"echo \"post uninstall\"\n")
|
"echo \"post uninstall\"\n")
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_trans.sh"
|
||||||
|
"echo \"pre trans\"\n")
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_trans.sh"
|
||||||
|
"echo \"post trans\"\n")
|
||||||
|
|
||||||
# specific
|
# specific
|
||||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh"
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh"
|
||||||
@@ -39,6 +51,10 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh"
|
|||||||
"echo \"pre uninstall foo\"\n")
|
"echo \"pre uninstall foo\"\n")
|
||||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh"
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh"
|
||||||
"echo \"post uninstall foo\"\n")
|
"echo \"post uninstall foo\"\n")
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_trans_foo.sh"
|
||||||
|
"echo \"pre trans foo\"\n")
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_trans_foo.sh"
|
||||||
|
"echo \"post trans foo\"\n")
|
||||||
|
|
||||||
install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo)
|
install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo)
|
||||||
install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar)
|
install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar)
|
||||||
|
Reference in New Issue
Block a user