summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorDomen Vrankar <domen.vrankar@gmail.com>2016-10-04 22:43:28 (GMT)
committerBrad King <brad.king@kitware.com>2016-10-07 13:19:04 (GMT)
commit758f58b4a18fbb512edd1baf520017e816fee20b (patch)
tree5d174c556cf38d0bf9dddc03c1e55b4d880cdb22 /Tests
parent9c4d105680c99e194c6d6063315ee2affd2a7b63 (diff)
downloadCMake-758f58b4a18fbb512edd1baf520017e816fee20b.zip
CMake-758f58b4a18fbb512edd1baf520017e816fee20b.tar.gz
CMake-758f58b4a18fbb512edd1baf520017e816fee20b.tar.bz2
CPack/RPM learned defining main component
Main component rpm package is generated without component suffix in filename and package name.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CPack/MAIN_COMPONENT.cmake14
-rw-r--r--Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake13
-rw-r--r--Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt3
-rw-r--r--Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake1
5 files changed, 32 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake b/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake
new file mode 100644
index 0000000..99c6cae
--- /dev/null
+++ b/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake
@@ -0,0 +1,14 @@
+set(CPACK_RPM_COMPONENT_INSTALL "ON")
+
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT applications)
+install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers)
+install(FILES CMakeLists.txt DESTINATION bas COMPONENT libs)
+
+if(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid")
+ set(CPACK_RPM_MAIN_COMPONENT "")
+else()
+ set(CPACK_RPM_MAIN_COMPONENT "applications")
+ set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT")
+endif()
+
+set(CPACK_PACKAGE_NAME "main_component")
diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake
new file mode 100644
index 0000000..69603dd
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake
@@ -0,0 +1,13 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "0")
+
+if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "invalid")
+ set(EXPECTED_FILES_COUNT "3")
+ set(EXPECTED_FILE_1 "main_component-0.1.1-1.*.rpm")
+ set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
+ set(EXPECTED_FILE_2 "main_component*-headers.rpm")
+ set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$")
+ set(EXPECTED_FILE_3 "main_component*-libs.rpm")
+ set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/CMakeLists.txt$")
+endif()
diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt
new file mode 100644
index 0000000..dff163d
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt
@@ -0,0 +1,3 @@
+^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component-headers.spec
+CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component-libs.spec
+CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component.spec$
diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt
new file mode 100644
index 0000000..4d8ac6e
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt
@@ -0,0 +1 @@
+CPACK_RPM_MAIN_COMPONENT set to non existing component.
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 60d42ac..45dbcea 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -12,6 +12,7 @@ run_cpack_test(DEPENDENCIES "RPM;DEB" true)
run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true)
run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true)
run_cpack_test(CUSTOM_NAMES "RPM;DEB" true)
+run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false)
run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false)
run_cpack_test(RPM_DIST "RPM" false)
run_cpack_test(INSTALL_SCRIPTS "RPM" false)