mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 00:11:07 -06:00
CPack/RPM test for Suggests tag
Suggests tag was not present in older versions of rpmbuild so we test that the rpm package is always generated either with Suggests tag present or skipped if not supported.
This commit is contained in:
committed by
Domen Vrankar
parent
228280d833
commit
cd0423300b
@@ -0,0 +1,5 @@
|
||||
set(whitespaces_ "[\t\n\r ]*")
|
||||
|
||||
set(EXPECTED_FILES_COUNT "1")
|
||||
set(EXPECTED_FILE_1 "rpm_suggests*.rpm")
|
||||
set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
|
||||
31
Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-VerifyResult.cmake
Normal file
31
Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-VerifyResult.cmake
Normal file
@@ -0,0 +1,31 @@
|
||||
execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --querytags
|
||||
OUTPUT_VARIABLE RPMBUILD_CAPS
|
||||
RESULT_VARIABLE RPMBUILD_CAPS_RESULT)
|
||||
|
||||
if(NOT RPMBUILD_CAPS_RESULT)
|
||||
string(REPLACE "\n" ";" RPMBUILD_CAPS "${RPMBUILD_CAPS}")
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
if(SUGGESTS IN_LIST RPMBUILD_CAPS)
|
||||
set(should_contain_suggests_tag_ true)
|
||||
endif()
|
||||
cmake_policy(POP)
|
||||
endif()
|
||||
|
||||
# Only verify that suggests tag is present only if that tag is supported.
|
||||
# If it is not supported the rpm package was corretly generated by ignoring
|
||||
# that tag and that was already checked by expected files test.
|
||||
if(should_contain_suggests_tag_)
|
||||
execute_process(COMMAND ${RPM_EXECUTABLE} -q --suggests -p "${FOUND_FILE_1}"
|
||||
WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
|
||||
RESULT_VARIABLE rpm_result_
|
||||
OUTPUT_VARIABLE rpm_output_
|
||||
ERROR_VARIABLE error_variable_
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(rpm_result_ OR NOT rpm_output_ STREQUAL "libsuggested")
|
||||
message(FATAL_ERROR "RPM_SUGGESTED package error: no suggested packages"
|
||||
" (result: '${rpm_result_}'; output: '${rpm_output_}';"
|
||||
" error: '${error_variable_}')")
|
||||
endif()
|
||||
endif()
|
||||
4
Tests/RunCMake/CPack/RPM_SUGGESTS.cmake
Normal file
4
Tests/RunCMake/CPack/RPM_SUGGESTS.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
install(FILES CMakeLists.txt DESTINATION foo)
|
||||
|
||||
set(CPACK_RPM_PACKAGE_SUGGESTS "libsuggested")
|
||||
set(CPACK_PACKAGE_NAME "rpm_suggests")
|
||||
@@ -15,6 +15,7 @@ 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(RPM_SUGGESTS "RPM" false)
|
||||
run_cpack_test(INSTALL_SCRIPTS "RPM" false)
|
||||
run_cpack_test(DEB_GENERATE_SHLIBS "DEB" true)
|
||||
run_cpack_test(DEB_GENERATE_SHLIBS_LDCONFIG "DEB" true)
|
||||
|
||||
Reference in New Issue
Block a user