summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDomen Vrankar <domen.vrankar@gmail.com>2021-03-28 22:06:05 (GMT)
committerDomen Vrankar <domen.vrankar@gmail.com>2021-03-30 21:24:16 (GMT)
commit31c184ad690be45494cf997df71ad09293a0d4b0 (patch)
tree846bfefb810d13a0658375d765c8da4802fe8a10
parentd9b8acd238ea26477c5f599b323777eaaf63c000 (diff)
downloadCMake-31c184ad690be45494cf997df71ad09293a0d4b0.zip
CMake-31c184ad690be45494cf997df71ad09293a0d4b0.tar.gz
CMake-31c184ad690be45494cf997df71ad09293a0d4b0.tar.bz2
CPackRPM: handle scripts in debuginfo single package mode
Enabling CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE while using rpm install or erase scripts resulted in resulted missing scripts for non default components. Fixes: #21974
-rw-r--r--Modules/Internal/CPack/CPackRPM.cmake19
-rw-r--r--Tests/RunCMake/CPack/RPM/Prerequirements.cmake7
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake7
-rw-r--r--Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-COMPONENT-single_debug_info-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake11
-rw-r--r--Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake6
7 files changed, 51 insertions, 2 deletions
diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake
index 08bbc68..2ee0622 100644
--- a/Modules/Internal/CPack/CPackRPM.cmake
+++ b/Modules/Internal/CPack/CPackRPM.cmake
@@ -1637,6 +1637,25 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
%description -n \@CPACK_RPM_PACKAGE_NAME\@
\@CPACK_RPM_PACKAGE_DESCRIPTION\@
+%post -n \@CPACK_RPM_PACKAGE_NAME\@
+\@RPM_SYMLINK_POSTINSTALL\@
+\@CPACK_RPM_SPEC_POSTINSTALL\@
+
+%posttrans -n \@CPACK_RPM_PACKAGE_NAME\@
+\@CPACK_RPM_SPEC_POSTTRANS\@
+
+%postun -n \@CPACK_RPM_PACKAGE_NAME\@
+\@CPACK_RPM_SPEC_POSTUNINSTALL\@
+
+%pre -n \@CPACK_RPM_PACKAGE_NAME\@
+\@CPACK_RPM_SPEC_PREINSTALL\@
+
+%pretrans -n \@CPACK_RPM_PACKAGE_NAME\@
+\@CPACK_RPM_SPEC_PRETRANS\@
+
+%preun -n \@CPACK_RPM_PACKAGE_NAME\@
+\@CPACK_RPM_SPEC_PREUNINSTALL\@
+
%files -n \@CPACK_RPM_PACKAGE_NAME\@
%defattr(\@TMP_DEFAULT_FILE_PERMISSIONS\@,\@TMP_DEFAULT_USER\@,\@TMP_DEFAULT_GROUP\@,\@TMP_DEFAULT_DIR_PERMISSIONS\@)
\@CPACK_RPM_INSTALL_FILES\@
diff --git a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake
index 3416205..e95cd15 100644
--- a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake
+++ b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake
@@ -13,4 +13,11 @@ function(get_test_prerequirements found_var config_file)
"\nset(RPMBUILD_EXECUTABLE \"${RPMBUILD_EXECUTABLE}\")")
set(${found_var} true PARENT_SCOPE)
endif()
+
+ # optional tool for some tests
+ find_program(OBJDUMP_EXECUTABLE objdump)
+ if(OBJDUMP_EXECUTABLE)
+ file(APPEND "${config_file}"
+ "\nset(OBJDUMP_EXECUTABLE \"${OBJDUMP_EXECUTABLE}\")")
+ endif()
endfunction()
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 15bfb60..48b9c1d 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -16,7 +16,7 @@ run_cpack_test(VERSION "RPM.VERSION;DEB.VERSION" false "MONOLITHIC;COMPONENT")
run_cpack_test(EXTRA "DEB.EXTRA" false "COMPONENT")
run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB.GENERATE_SHLIBS" true "COMPONENT")
run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB.GENERATE_SHLIBS_LDCONFIG" true "COMPONENT")
-run_cpack_test(INSTALL_SCRIPTS "RPM.INSTALL_SCRIPTS" false "COMPONENT")
+run_cpack_test_subtests(INSTALL_SCRIPTS "default;single_debug_info" "RPM.INSTALL_SCRIPTS" false "COMPONENT")
run_cpack_test(LONG_FILENAMES "DEB.LONG_FILENAMES" false "MONOLITHIC")
run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM.MAIN_COMPONENT" false "COMPONENT")
run_cpack_test(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT")
diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake
index de38df9..29e36a3 100644
--- a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake
+++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake
@@ -1,5 +1,10 @@
+if(RunCMake_SUBTEST_SUFFIX STREQUAL "single_debug_info")
+ set(EXPECTED_FILE_1 "install_scripts-0.1.1-1.*.rpm")
+else()
+ set(EXPECTED_FILE_1_COMPONENT "foo")
+endif()
+
set(EXPECTED_FILES_COUNT "2")
-set(EXPECTED_FILE_1_COMPONENT "foo")
set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt")
set(EXPECTED_FILE_2_COMPONENT "bar")
set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt")
diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-COMPONENT-single_debug_info-stderr.txt b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-COMPONENT-single_debug_info-stderr.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-COMPONENT-single_debug_info-stderr.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake
new file mode 100644
index 0000000..c5d20cc
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake
@@ -0,0 +1,11 @@
+function(get_test_prerequirements found_var config_file)
+ if(SUBTEST_SUFFIX STREQUAL "single_debug_info")
+ include(${config_file})
+
+ if(OBJDUMP_EXECUTABLE)
+ set(${found_var} true PARENT_SCOPE)
+ endif()
+ else()
+ set(${found_var} true PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake
index c200fa5..6877c57 100644
--- a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake
+++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake
@@ -24,6 +24,12 @@ if(GENERATOR_TYPE STREQUAL "RPM")
"${CMAKE_CURRENT_BINARY_DIR}/pre_trans_foo.sh")
set(CPACK_RPM_foo_POST_TRANS_SCRIPT_FILE
"${CMAKE_CURRENT_BINARY_DIR}/post_trans_foo.sh")
+
+ if(RunCMake_SUBTEST_SUFFIX STREQUAL "single_debug_info")
+ set(CPACK_RPM_MAIN_COMPONENT "foo")
+ set(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE ON)
+ set(CPACK_RPM_FOO_FILE_NAME "RPM-DEFAULT")
+ endif()
endif()
set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)