CPack: Added tests for package name and group controll fields
This commit is contained in:
parent
c926efa139
commit
27e6f74f29
|
@ -0,0 +1,7 @@
|
||||||
|
cpack-rpm-percomponent-group-and-name
|
||||||
|
-------------------------------------
|
||||||
|
|
||||||
|
* The :module:`CPackRPM` module learned to set Name and Group
|
||||||
|
control fields per-component.
|
||||||
|
See :variable:`CPACK_RPM_<component>_PACKAGE_NAME`
|
||||||
|
and :variable:`CPACK_RPM_<component>_PACKAGE_GROUP`.
|
|
@ -0,0 +1,9 @@
|
||||||
|
set(whitespaces_ "[\t\n\r ]*")
|
||||||
|
|
||||||
|
set(EXPECTED_FILES_COUNT "3")
|
||||||
|
set(EXPECTED_FILE_1 "per_component*-pkg_1.deb")
|
||||||
|
set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$")
|
||||||
|
set(EXPECTED_FILE_2 "per_component*-pkg_2.deb")
|
||||||
|
set(EXPECTED_FILE_CONTENT_2 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$")
|
||||||
|
set(EXPECTED_FILE_3 "per_component*-pkg_3.deb")
|
||||||
|
set(EXPECTED_FILE_CONTENT_3 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$")
|
|
@ -0,0 +1,18 @@
|
||||||
|
function(checkPackageInfo_ TYPE FILE REGEX)
|
||||||
|
set(whitespaces_ "[\t\n\r ]*")
|
||||||
|
|
||||||
|
getPackageInfo("${FILE}" "FILE_INFO_")
|
||||||
|
if(NOT FILE_INFO_ MATCHES "${REGEX}")
|
||||||
|
message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# check package name
|
||||||
|
checkPackageInfo_("name" "${FOUND_FILE_1}" ".*Package${whitespaces_}:${whitespaces_}per_component-pkg_1")
|
||||||
|
checkPackageInfo_("name" "${FOUND_FILE_2}" ".*Package${whitespaces_}:${whitespaces_}second")
|
||||||
|
checkPackageInfo_("name" "${FOUND_FILE_3}" ".*Package${whitespaces_}:${whitespaces_}per_component-pkg_3")
|
||||||
|
|
||||||
|
# check package group
|
||||||
|
checkPackageInfo_("group" "${FOUND_FILE_1}" ".*Section${whitespaces_}:${whitespaces_}default")
|
||||||
|
checkPackageInfo_("group" "${FOUND_FILE_2}" ".*Section${whitespaces_}:${whitespaces_}second_group")
|
||||||
|
checkPackageInfo_("group" "${FOUND_FILE_3}" ".*Section${whitespaces_}:${whitespaces_}default")
|
|
@ -0,0 +1,6 @@
|
||||||
|
set(CPACK_PACKAGE_CONTACT "someone")
|
||||||
|
set(CPACK_DEB_COMPONENT_INSTALL "ON")
|
||||||
|
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_SECTION "default")
|
||||||
|
set(CPACK_DEBIAN_PKG_2_PACKAGE_NAME "second")
|
||||||
|
set(CPACK_DEBIAN_PKG_2_PACKAGE_SECTION "second_group")
|
|
@ -0,0 +1,5 @@
|
||||||
|
install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1)
|
||||||
|
install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_2)
|
||||||
|
install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_3)
|
||||||
|
|
||||||
|
set(CPACK_PACKAGE_NAME "per_component")
|
|
@ -8,3 +8,12 @@ function(getPackageContent FILE RESULT_VAR)
|
||||||
|
|
||||||
set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE)
|
set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(getPackageInfo FILE RESULT_VAR)
|
||||||
|
execute_process(COMMAND ${RPM_EXECUTABLE} -pqi ${FILE}
|
||||||
|
OUTPUT_VARIABLE info_content
|
||||||
|
ERROR_QUIET
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
set(${RESULT_VAR} "${info_content}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
set(whitespaces_ "[\t\n\r ]*")
|
||||||
|
|
||||||
|
set(EXPECTED_FILES_COUNT "3")
|
||||||
|
set(EXPECTED_FILE_1 "per_component*-pkg_1.rpm")
|
||||||
|
set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
|
||||||
|
set(EXPECTED_FILE_2 "per_component*-pkg_2.rpm")
|
||||||
|
set(EXPECTED_FILE_CONTENT_2 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
|
||||||
|
set(EXPECTED_FILE_3 "per_component*-pkg_3.rpm")
|
||||||
|
set(EXPECTED_FILE_CONTENT_3 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
|
|
@ -0,0 +1,18 @@
|
||||||
|
function(checkPackageInfo_ TYPE FILE REGEX)
|
||||||
|
set(whitespaces_ "[\t\n\r ]*")
|
||||||
|
|
||||||
|
getPackageInfo("${FILE}" "FILE_INFO_")
|
||||||
|
if(NOT FILE_INFO_ MATCHES "${REGEX}")
|
||||||
|
message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# check package name
|
||||||
|
checkPackageInfo_("name" "${FOUND_FILE_1}" ".*Name${whitespaces_}:${whitespaces_}per_component-pkg_1")
|
||||||
|
checkPackageInfo_("name" "${FOUND_FILE_2}" ".*Name${whitespaces_}:${whitespaces_}second")
|
||||||
|
checkPackageInfo_("name" "${FOUND_FILE_3}" ".*Name${whitespaces_}:${whitespaces_}per_component-pkg_3")
|
||||||
|
|
||||||
|
# check package group
|
||||||
|
checkPackageInfo_("group" "${FOUND_FILE_1}" ".*Group${whitespaces_}:${whitespaces_}default")
|
||||||
|
checkPackageInfo_("group" "${FOUND_FILE_2}" ".*Group${whitespaces_}:${whitespaces_}second_group")
|
||||||
|
checkPackageInfo_("group" "${FOUND_FILE_3}" ".*Group${whitespaces_}:${whitespaces_}default")
|
|
@ -0,0 +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")
|
|
@ -10,3 +10,4 @@ run_cpack_test(DEB_EXTRA "DEB" false)
|
||||||
run_cpack_test(DEPENDENCIES "RPM;DEB" true)
|
run_cpack_test(DEPENDENCIES "RPM;DEB" true)
|
||||||
run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true)
|
run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true)
|
||||||
run_cpack_test(COMPONENTS_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)
|
||||||
|
|
Loading…
Reference in New Issue