summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-02-16 14:52:30 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-02-16 14:52:30 (GMT)
commitdde82df24c44338f56171e2989729f6b86677900 (patch)
treebebb07d0968daa167ad01c852f8b0f1bdcad3ec1 /Tests
parentc92547e88c64777094f47fbde222f8bd8d3ab41d (diff)
parent7c7efd1ed92e3c423f463c0249e1c05a33ff8049 (diff)
downloadCMake-dde82df24c44338f56171e2989729f6b86677900.zip
CMake-dde82df24c44338f56171e2989729f6b86677900.tar.gz
CMake-dde82df24c44338f56171e2989729f6b86677900.tar.bz2
Merge topic 'cpack-rpm-upper-cased-components'
7c7efd1e CPack/RPM support for upper cased component variables
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in12
-rw-r--r--Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in2
-rw-r--r--Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake8
-rw-r--r--Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake26
-rw-r--r--Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake20
-rw-r--r--Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake7
-rw-r--r--Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-VerifyResult.cmake29
-rw-r--r--Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake19
-rw-r--r--Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake4
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake1
10 files changed, 105 insertions, 23 deletions
diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
index ac9b552..0f2b774 100644
--- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
+++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
@@ -14,24 +14,24 @@ if(CPACK_GENERATOR MATCHES "RPM")
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/foo/bar")
# test requires
- set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries")
+ set(CPACK_RPM_APPLICATIONS_PACKAGE_REQUIRES "mylib-libraries")
# test a "noarch" rpm
- set(CPACK_RPM_headers_PACKAGE_ARCHITECTURE "noarch")
+ set(CPACK_RPM_HEADERS_PACKAGE_ARCHITECTURE "noarch")
# test cross-built rpm
- set(CPACK_RPM_applications_PACKAGE_ARCHITECTURE "armv7hf")
+ set(CPACK_RPM_APPLICATIONS_PACKAGE_ARCHITECTURE "armv7hf")
# test package summary override - headers rpm is generated in the middle
set(CPACK_RPM_PACKAGE_SUMMARY "default summary")
- set(CPACK_RPM_headers_PACKAGE_SUMMARY "headers summary")
+ set(CPACK_RPM_HEADERS_PACKAGE_SUMMARY "headers summary")
# test package description override - headers rpm is generated in the middle
- set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description")
+ set(CPACK_RPM_HEADERS_PACKAGE_DESCRIPTION "headers description")
# test package do not use CPACK_PACKAGING_INSTALL_PREFIX
# as relocation path
- set(CPACK_RPM_NO_libraries_INSTALL_PREFIX_RELOCATION true)
+ set(CPACK_RPM_NO_LIBRARIES_INSTALL_PREFIX_RELOCATION true)
endif()
if(CPACK_GENERATOR MATCHES "DEB")
diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in
index 60bdd06..ac65dc9 100644
--- a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in
+++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in
@@ -7,7 +7,7 @@ endif()
if(CPACK_GENERATOR MATCHES "RPM")
set(CPACK_RPM_COMPONENT_INSTALL "ON")
- set(CPACK_RPM_Development_PACKAGE_REQUIRES "mylib-Runtime")
+ set(CPACK_RPM_DEVELOPMENT_PACKAGE_REQUIRES "mylib-Runtime")
endif()
if(CPACK_GENERATOR MATCHES "DEB")
diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
index d94a477..34b9c82 100644
--- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
+++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
@@ -136,8 +136,8 @@ if(CPackGen MATCHES "RPM")
endif()
set(CPACK_RPM_PACKAGE_SUMMARY "default summary")
- set(CPACK_RPM_headers_PACKAGE_SUMMARY "headers summary")
- set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description")
+ set(CPACK_RPM_HEADERS_PACKAGE_SUMMARY "headers summary")
+ set(CPACK_RPM_HEADERS_PACKAGE_DESCRIPTION "headers description")
set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION
"An extremely useful application that makes use of MyLib")
set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION
@@ -206,8 +206,8 @@ if(CPackGen MATCHES "RPM")
/usr/foo/bar/other_relocatable
/usr/foo/bar/other_relocatable/depth_two$")
elseif(check_file_headers_match)
- set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*")
- set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*")
+ set(check_file_match_expected_summary ".*${CPACK_RPM_HEADERS_PACKAGE_SUMMARY}.*")
+ set(check_file_match_expected_description ".*${CPACK_RPM_HEADERS_PACKAGE_DESCRIPTION}.*")
set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
set(check_file_match_expected_architecture "noarch")
set(spec_regex "*headers*")
diff --git a/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake b/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake
new file mode 100644
index 0000000..13aa77b
--- /dev/null
+++ b/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake
@@ -0,0 +1,26 @@
+set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
+
+# default
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh"
+ "echo \"pre install\"\n")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh"
+ "echo \"post install\"\n")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh"
+ "echo \"pre uninstall\"\n")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh"
+ "echo \"post uninstall\"\n")
+
+# specific
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh"
+ "echo \"pre install foo\"\n")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh"
+ "echo \"post install foo\"\n")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh"
+ "echo \"pre uninstall foo\"\n")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh"
+ "echo \"post uninstall foo\"\n")
+
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo)
+install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar)
+
+set(CPACK_PACKAGE_NAME "install_scripts")
diff --git a/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake b/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake
index 2cdfece..8b7fb1e 100644
--- a/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake
+++ b/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake
@@ -4,19 +4,19 @@ set(CPACK_RPM_COMPONENT_INSTALL "ON")
# does not use them correctly: https://bugs.launchpad.net/rpm/+bug/1475755
set(CPACK_RPM_PACKAGE_AUTOREQ "no")
set(CPACK_RPM_PACKAGE_AUTOPROV "no")
-set(CPACK_RPM_applications_auto_PACKAGE_AUTOREQPROV "yes")
-set(CPACK_RPM_libs_auto_PACKAGE_AUTOREQPROV "yes")
+set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_AUTOREQPROV "yes")
+set(CPACK_RPM_LIBS_AUTO_PACKAGE_AUTOREQPROV "yes")
set(CPACK_RPM_PACKAGE_REQUIRES "depend-default, depend-default-b")
-set(CPACK_RPM_applications_PACKAGE_REQUIRES "depend-application, depend-application-b")
-set(CPACK_RPM_applications_auto_PACKAGE_REQUIRES "depend-application, depend-application-b")
-set(CPACK_RPM_headers_PACKAGE_REQUIRES "depend-headers")
+set(CPACK_RPM_APPLICATIONS_PACKAGE_REQUIRES "depend-application, depend-application-b")
+set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_REQUIRES "depend-application, depend-application-b")
+set(CPACK_RPM_HEADERS_PACKAGE_REQUIRES "depend-headers")
set(CPACK_RPM_PACKAGE_CONFLICTS "conflict-default, conflict-default-b")
-set(CPACK_RPM_applications_PACKAGE_CONFLICTS "conflict-application, conflict-application-b")
-set(CPACK_RPM_applications_auto_PACKAGE_CONFLICTS "conflict-application, conflict-application-b")
-set(CPACK_RPM_headers_PACKAGE_CONFLICTS "conflict-headers")
+set(CPACK_RPM_APPLICATIONS_PACKAGE_CONFLICTS "conflict-application, conflict-application-b")
+set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_CONFLICTS "conflict-application, conflict-application-b")
+set(CPACK_RPM_HEADERS_PACKAGE_CONFLICTS "conflict-headers")
set(CPACK_RPM_PACKAGE_PROVIDES "provided-default, provided-default-b")
-set(CPACK_RPM_libs_PACKAGE_PROVIDES "provided-lib")
-set(CPACK_RPM_libs_auto_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b")
+set(CPACK_RPM_LIBS_PACKAGE_PROVIDES "provided-lib")
+set(CPACK_RPM_LIBS_AUTO_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b")
diff --git a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake
new file mode 100644
index 0000000..033a45d
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake
@@ -0,0 +1,7 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "2")
+set(EXPECTED_FILE_1 "install_scripts*-foo.rpm")
+set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
+set(EXPECTED_FILE_2 "install_scripts*-bar.rpm")
+set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-VerifyResult.cmake b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-VerifyResult.cmake
new file mode 100644
index 0000000..d7d82f2
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-VerifyResult.cmake
@@ -0,0 +1,29 @@
+function(checkScripts_ FILE COMPARE_LIST)
+ set(whitespaces_ "[\t\n\r ]*")
+
+ execute_process(COMMAND ${RPM_EXECUTABLE} -qp --scripts ${FILE}
+ WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
+ OUTPUT_VARIABLE FILE_SCRIPTS_
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ string(REPLACE "\n" ";" FILE_SCRIPTS_LIST_ "${FILE_SCRIPTS_}")
+
+ foreach(COMPARE_REGEX_ IN LISTS COMPARE_LIST)
+ unset(FOUND_)
+
+ foreach(COMPARE_ IN LISTS FILE_SCRIPTS_LIST_)
+ if(COMPARE_ MATCHES "${COMPARE_REGEX_}")
+ set(FOUND_ true)
+ break()
+ endif()
+ endforeach()
+
+ if(NOT FOUND_)
+ message(FATAL_ERROR "Missing scripts in '${FILE}'; file info: '${FILE_SCRIPTS_}'; missing: '${COMPARE_REGEX_}'")
+ endif()
+ endforeach()
+endfunction()
+
+checkScripts_("${FOUND_FILE_1}" "echo \"pre install foo\";echo \"post install foo\";echo \"pre uninstall foo\";echo \"post uninstall foo\"")
+checkScripts_("${FOUND_FILE_2}" "echo \"pre install\";echo \"post install\";echo \"pre uninstall\";echo \"post uninstall\"")
diff --git a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake
new file mode 100644
index 0000000..4eb53c3
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake
@@ -0,0 +1,19 @@
+set(CPACK_RPM_COMPONENT_INSTALL "ON")
+
+set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh")
+set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh")
+set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh")
+set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh")
+
+set(CPACK_RPM_foo_PRE_INSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh")
+set(CPACK_RPM_foo_POST_INSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh")
+set(CPACK_RPM_foo_PRE_UNINSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh")
+set(CPACK_RPM_foo_POST_UNINSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh")
diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake
index d398168..524ef0c 100644
--- a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake
+++ b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake
@@ -1,5 +1,5 @@
set(CPACK_RPM_COMPONENT_INSTALL "ON")
set(CPACK_RPM_PACKAGE_GROUP "default")
-set(CPACK_RPM_pkg_2_PACKAGE_NAME "second")
-set(CPACK_RPM_pkg_2_PACKAGE_GROUP "second_group")
+set(CPACK_RPM_PKG_2_PACKAGE_NAME "second")
+set(CPACK_RPM_PKG_2_PACKAGE_GROUP "second_group")
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index fe2b48b..ee4112d 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -11,3 +11,4 @@ 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(PER_COMPONENT_FIELDS "RPM;DEB" false)
+run_cpack_test(INSTALL_SCRIPTS "RPM" false)