RunCPackVerifyResult.cmake 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. # prevent older policies from interfearing with this script
  2. cmake_policy(PUSH)
  3. cmake_policy(VERSION ${CMAKE_VERSION})
  4. message(STATUS "=============================================================================")
  5. message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
  6. message(STATUS "")
  7. if(NOT CPackComponentsForAll_BINARY_DIR)
  8. message(FATAL_ERROR "CPackComponentsForAll_BINARY_DIR not set")
  9. endif()
  10. if(NOT CPackGen)
  11. message(FATAL_ERROR "CPackGen not set")
  12. endif()
  13. message("CMAKE_CPACK_COMMAND = ${CMAKE_CPACK_COMMAND}")
  14. if(NOT CMAKE_CPACK_COMMAND)
  15. message(FATAL_ERROR "CMAKE_CPACK_COMMAND not set")
  16. endif()
  17. if(NOT CPackComponentWay)
  18. message(FATAL_ERROR "CPackComponentWay not set")
  19. endif()
  20. set(expected_file_mask "")
  21. # The usual default behavior is to expect a single file
  22. # Then some specific generators (Archive, RPM, ...)
  23. # May produce several numbers of files depending on
  24. # CPACK_COMPONENT_xxx values
  25. set(expected_count 1)
  26. set(config_type $ENV{CMAKE_CONFIG_TYPE})
  27. set(config_args )
  28. if(config_type)
  29. set(config_args -C ${config_type})
  30. endif()
  31. set(config_verbose )
  32. if(CPackGen MATCHES "ZIP")
  33. set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.zip")
  34. if (${CPackComponentWay} STREQUAL "default")
  35. set(expected_count 1)
  36. elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup")
  37. set(expected_count 3)
  38. elseif (${CPackComponentWay} STREQUAL "IgnoreGroup")
  39. set(expected_count 4)
  40. elseif (${CPackComponentWay} STREQUAL "AllInOne")
  41. set(expected_count 1)
  42. endif ()
  43. elseif (CPackGen MATCHES "RPM")
  44. set(config_verbose -D "CPACK_RPM_PACKAGE_DEBUG=1")
  45. set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.rpm")
  46. if (${CPackComponentWay} STREQUAL "default")
  47. set(expected_count 1)
  48. elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup")
  49. set(expected_count 3)
  50. elseif (${CPackComponentWay} STREQUAL "IgnoreGroup")
  51. set(expected_count 4)
  52. elseif (${CPackComponentWay} STREQUAL "AllInOne")
  53. set(expected_count 1)
  54. endif ()
  55. elseif (CPackGen MATCHES "DEB")
  56. set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/mylib*_1.0.2_*.deb")
  57. if (${CPackComponentWay} STREQUAL "default")
  58. set(expected_count 1)
  59. elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup")
  60. set(expected_count 3)
  61. elseif (${CPackComponentWay} STREQUAL "IgnoreGroup")
  62. set(expected_count 4)
  63. elseif (${CPackComponentWay} STREQUAL "AllInOne")
  64. set(expected_count 1)
  65. endif ()
  66. endif()
  67. if(CPackGen MATCHES "DragNDrop")
  68. set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.dmg")
  69. if (${CPackComponentWay} STREQUAL "default")
  70. set(expected_count 1)
  71. elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup")
  72. set(expected_count 3)
  73. elseif (${CPackComponentWay} STREQUAL "IgnoreGroup")
  74. set(expected_count 4)
  75. elseif (${CPackComponentWay} STREQUAL "AllInOne")
  76. set(expected_count 1)
  77. endif ()
  78. endif()
  79. # clean-up previously CPack generated files
  80. if(expected_file_mask)
  81. file(GLOB expected_file "${expected_file_mask}")
  82. if (expected_file)
  83. file(REMOVE ${expected_file})
  84. endif()
  85. endif()
  86. message("config_args = ${config_args}")
  87. message("config_verbose = ${config_verbose}")
  88. execute_process(COMMAND ${CMAKE_CPACK_COMMAND} ${config_verbose} -G ${CPackGen} ${config_args}
  89. RESULT_VARIABLE CPack_result
  90. OUTPUT_VARIABLE CPack_output
  91. ERROR_VARIABLE CPack_error
  92. WORKING_DIRECTORY ${CPackComponentsForAll_BINARY_DIR})
  93. if (CPack_result)
  94. message(FATAL_ERROR "error: CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}")
  95. else ()
  96. message(STATUS "CPack_output=${CPack_output}")
  97. endif()
  98. # Now verify if the number of expected file is OK
  99. # - using expected_file_mask and
  100. # - expected_count
  101. if(expected_file_mask)
  102. file(GLOB expected_file "${expected_file_mask}")
  103. message(STATUS "expected_count='${expected_count}'")
  104. message(STATUS "expected_file='${expected_file}'")
  105. message(STATUS "expected_file_mask='${expected_file_mask}'")
  106. if(NOT expected_file)
  107. message(FATAL_ERROR "error: expected_file does not exist: CPackComponentsForAll test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}")
  108. endif()
  109. list(LENGTH expected_file actual_count)
  110. message(STATUS "actual_count='${actual_count}'")
  111. if(NOT actual_count EQUAL expected_count)
  112. message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})")
  113. endif()
  114. endif()
  115. # Validate content
  116. if(CPackGen MATCHES "RPM")
  117. find_program(RPM_EXECUTABLE rpm)
  118. if(NOT RPM_EXECUTABLE)
  119. message(FATAL_ERROR "error: missing rpm executable required by the test")
  120. endif()
  121. set(CPACK_RPM_PACKAGE_SUMMARY "default summary")
  122. set(CPACK_RPM_HEADERS_PACKAGE_SUMMARY "headers summary")
  123. set(CPACK_RPM_HEADERS_PACKAGE_DESCRIPTION "headers description")
  124. set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION
  125. "An extremely useful application that makes use of MyLib")
  126. set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION
  127. "Static libraries used to build programs with MyLib")
  128. set(LIB_SUFFIX "6?4?")
  129. # test package info
  130. if(${CPackComponentWay} STREQUAL "IgnoreGroup")
  131. # set gnu install prefixes to what they are set during rpm creation
  132. # CMAKE_SIZEOF_VOID_P is not set here but lib is prefix of lib64 so
  133. # relocation path test won't fail on OSes with lib64 library location
  134. include(GNUInstallDirs)
  135. set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/foo/bar")
  136. foreach(check_file ${expected_file})
  137. string(REGEX MATCH ".*libraries.*" check_file_libraries_match ${check_file})
  138. string(REGEX MATCH ".*headers.*" check_file_headers_match ${check_file})
  139. string(REGEX MATCH ".*applications.*" check_file_applications_match ${check_file})
  140. string(REGEX MATCH ".*Unspecified.*" check_file_Unspecified_match ${check_file})
  141. execute_process(COMMAND ${RPM_EXECUTABLE} -pqi ${check_file}
  142. OUTPUT_VARIABLE check_file_content
  143. ERROR_QUIET
  144. OUTPUT_STRIP_TRAILING_WHITESPACE)
  145. execute_process(COMMAND ${RPM_EXECUTABLE} -pqa ${check_file}
  146. RESULT_VARIABLE check_package_architecture_result
  147. OUTPUT_VARIABLE check_package_architecture
  148. ERROR_QUIET
  149. OUTPUT_STRIP_TRAILING_WHITESPACE)
  150. execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${check_file}
  151. OUTPUT_VARIABLE check_package_content
  152. ERROR_QUIET
  153. OUTPUT_STRIP_TRAILING_WHITESPACE)
  154. set(whitespaces "[\\t\\n\\r ]*")
  155. if(check_file_libraries_match)
  156. set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*")
  157. set(check_file_match_expected_description ".*${CPACK_COMPONENT_LIBRARIES_DESCRIPTION}.*")
  158. set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/other_relocatable${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable")
  159. set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it
  160. set(spec_regex "*libraries*")
  161. set(check_content_list "^/usr/foo/bar/lib${LIB_SUFFIX}
  162. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one
  163. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two
  164. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three
  165. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three/symlink_parentdir_path
  166. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_outside_package
  167. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_outside_wdr
  168. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_relocatable_subpath
  169. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path
  170. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path_current_dir
  171. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path_longer
  172. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/symlink_subdir_path
  173. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two
  174. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two
  175. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable
  176. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable/bar
  177. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/symlink_other_relocatable_path
  178. /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/symlink_to_non_relocatable_path
  179. /usr/foo/bar/lib${LIB_SUFFIX}/libmylib.a
  180. /usr/foo/bar/non_relocatable
  181. /usr/foo/bar/non_relocatable/depth_two
  182. /usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path
  183. /usr/foo/bar/other_relocatable
  184. /usr/foo/bar/other_relocatable/depth_two(\n.*\.build-id.*)*$")
  185. elseif(check_file_headers_match)
  186. set(check_file_match_expected_summary ".*${CPACK_RPM_HEADERS_PACKAGE_SUMMARY}.*")
  187. set(check_file_match_expected_description ".*${CPACK_RPM_HEADERS_PACKAGE_DESCRIPTION}.*")
  188. set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
  189. set(check_file_match_expected_architecture "noarch")
  190. set(spec_regex "*headers*")
  191. set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/include\n/usr/foo/bar/include/mylib.h(\n.*\.build-id.*)*$")
  192. elseif(check_file_applications_match)
  193. set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*")
  194. set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*")
  195. set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
  196. set(check_file_match_expected_architecture "armv7hf")
  197. set(spec_regex "*applications*")
  198. set(check_content_list "^/usr/foo/bar
  199. /usr/foo/bar/bin
  200. /usr/foo/bar/bin/mylibapp(\n.*\.build-id.*)*$")
  201. elseif(check_file_Unspecified_match)
  202. set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*")
  203. set(check_file_match_expected_description ".*DESCRIPTION.*")
  204. set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
  205. set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it
  206. set(spec_regex "*Unspecified*")
  207. set(check_content_list "^/usr/foo/bar
  208. /usr/foo/bar/bin
  209. /usr/foo/bar/bin/@in@_@path@@with
  210. /usr/foo/bar/bin/@in@_@path@@with/@and
  211. /usr/foo/bar/bin/@in@_@path@@with/@and/@
  212. /usr/foo/bar/bin/@in@_@path@@with/@and/@/@in_path@
  213. /usr/foo/bar/bin/@in@_@path@@with/@and/@/@in_path@/mylibapp2
  214. /usr/foo/bar/share
  215. /usr/foo/bar/share/man
  216. /usr/foo/bar/share/man/mylib
  217. /usr/foo/bar/share/man/mylib/man3
  218. /usr/foo/bar/share/man/mylib/man3/mylib.1
  219. /usr/foo/bar/share/man/mylib/man3/mylib.1/mylib
  220. /usr/foo/bar/share/man/mylib/man3/mylib.1/mylib2(\n.*\.build-id.*)*$")
  221. else()
  222. message(FATAL_ERROR "error: unexpected rpm package '${check_file}'")
  223. endif()
  224. #######################
  225. # test package info
  226. #######################
  227. string(REGEX MATCH ${check_file_match_expected_summary} check_file_match_summary ${check_file_content})
  228. if(NOT check_file_match_summary)
  229. message(FATAL_ERROR "error: '${check_file}' rpm package summary does not match expected value - regex '${check_file_match_expected_summary}'; RPM output: '${check_file_content}'")
  230. endif()
  231. string(REGEX MATCH ${check_file_match_expected_description} check_file_match_description ${check_file_content})
  232. if(NOT check_file_match_description)
  233. message(FATAL_ERROR "error: '${check_file}' rpm package description does not match expected value - regex '${check_file_match_expected_description}'; RPM output: '${check_file_content}'")
  234. endif()
  235. string(REGEX MATCH ${check_file_match_expected_relocation_path} check_file_match_relocation_path ${check_file_content})
  236. if(NOT check_file_match_relocation_path)
  237. file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/${spec_regex}.spec")
  238. if(spec_file)
  239. file(READ ${spec_file} spec_file_content)
  240. endif()
  241. message(FATAL_ERROR "error: '${check_file}' rpm package relocation path does not match expected value - regex '${check_file_match_expected_relocation_path}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'")
  242. endif()
  243. #######################
  244. # test package architecture
  245. #######################
  246. string(REGEX MATCH "Architecture${whitespaces}:" check_info_contains_arch ${check_file_content})
  247. if(check_info_contains_arch) # test for rpm versions that contain architecture in package info (e.g. 4.11.x)
  248. string(REGEX MATCH "Architecture${whitespaces}:${whitespaces}${check_file_match_expected_architecture}" check_file_match_architecture ${check_file_content})
  249. if(NOT check_file_match_architecture)
  250. message(FATAL_ERROR "error: '${check_file}' Architecture does not match expected value - '${check_file_match_expected_architecture}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'")
  251. endif()
  252. elseif(NOT check_package_architecture_result) # test result only on platforms that support -pqa rpm query
  253. # test for rpm versions that do not contain architecture in package info (e.g. 4.8.x)
  254. string(REGEX MATCH ".*${check_file_match_expected_architecture}" check_file_match_architecture "${check_package_architecture}")
  255. if(NOT check_file_match_architecture)
  256. message(FATAL_ERROR "error: '${check_file}' Architecture does not match expected value - '${check_file_match_expected_architecture}'; RPM output: '${check_package_architecture}'; generated spec file: '${spec_file_content}'")
  257. endif()
  258. # else rpm version too old (e.g. 4.4.x) - skip test
  259. endif()
  260. #######################
  261. # test package content
  262. #######################
  263. string(REGEX MATCH "${check_content_list}" expected_content_list "${check_package_content}")
  264. if(NOT expected_content_list)
  265. file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/${spec_regex}.spec")
  266. if(spec_file)
  267. file(READ ${spec_file} spec_file_content)
  268. endif()
  269. message(FATAL_ERROR "error: '${check_file}' rpm package content does not match expected value - regex '${check_content_list}'; RPM output: '${check_package_content}'; generated spec file: '${spec_file_content}'")
  270. endif()
  271. # validate permissions user and group
  272. execute_process(COMMAND ${RPM_EXECUTABLE} -pqlv ${check_file}
  273. OUTPUT_VARIABLE check_file_content
  274. ERROR_QUIET
  275. OUTPUT_STRIP_TRAILING_WHITESPACE)
  276. if(check_file_libraries_match)
  277. set(check_file_match_expected_permissions ".*-rwx------.*user.*defgrp.*")
  278. elseif(check_file_headers_match)
  279. set(check_file_match_expected_permissions ".*-rwxr--r--.*defusr.*defgrp.*")
  280. elseif(check_file_applications_match)
  281. set(check_file_match_expected_permissions ".*-rwxr--r--.*defusr.*group.*")
  282. elseif(check_file_Unspecified_match)
  283. set(check_file_match_expected_permissions ".*-rwxr--r--.*defusr.*defgrp.*")
  284. else()
  285. message(FATAL_ERROR "error: unexpected rpm package '${check_file}'")
  286. endif()
  287. string(REGEX MATCH "${check_file_match_expected_permissions}" check_file_match_permissions "${check_file_content}")
  288. if(NOT check_file_match_permissions)
  289. message(FATAL_ERROR "error: '${check_file}' rpm package permissions do not match expected value - regex '${check_file_match_expected_permissions}'")
  290. endif()
  291. endforeach()
  292. #######################
  293. # verify generated symbolic links
  294. #######################
  295. file(GLOB_RECURSE symlink_files RELATIVE "${CPackComponentsForAll_BINARY_DIR}" "${CPackComponentsForAll_BINARY_DIR}/*/symlink_*")
  296. foreach(check_symlink IN LISTS symlink_files)
  297. get_filename_component(symlink_name "${check_symlink}" NAME)
  298. execute_process(COMMAND ls -la "${check_symlink}"
  299. WORKING_DIRECTORY "${CPackComponentsForAll_BINARY_DIR}"
  300. OUTPUT_VARIABLE SYMLINK_POINT_
  301. OUTPUT_STRIP_TRAILING_WHITESPACE)
  302. if("${symlink_name}" STREQUAL "symlink_samedir_path"
  303. OR "${symlink_name}" STREQUAL "symlink_samedir_path_current_dir"
  304. OR "${symlink_name}" STREQUAL "symlink_samedir_path_longer")
  305. string(REGEX MATCH "^.*${whitespaces}->${whitespaces}depth_three$" check_symlink "${SYMLINK_POINT_}")
  306. elseif("${symlink_name}" STREQUAL "symlink_subdir_path")
  307. string(REGEX MATCH "^.*${whitespaces}->${whitespaces}depth_two/depth_three$" check_symlink "${SYMLINK_POINT_}")
  308. elseif("${symlink_name}" STREQUAL "symlink_parentdir_path")
  309. string(REGEX MATCH "^.*${whitespaces}->${whitespaces}../$" check_symlink "${SYMLINK_POINT_}")
  310. elseif("${symlink_name}" STREQUAL "symlink_to_non_relocatable_path")
  311. string(REGEX MATCH "^.*${whitespaces}->${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/non_relocatable/depth_two$" check_symlink "${SYMLINK_POINT_}")
  312. elseif("${symlink_name}" STREQUAL "symlink_outside_package")
  313. string(REGEX MATCH "^.*${whitespaces}->${whitespaces}outside_package$" check_symlink "${SYMLINK_POINT_}")
  314. elseif("${symlink_name}" STREQUAL "symlink_outside_wdr")
  315. string(REGEX MATCH "^.*${whitespaces}->${whitespaces}/outside_package_wdr$" check_symlink "${SYMLINK_POINT_}")
  316. elseif("${symlink_name}" STREQUAL "symlink_other_relocatable_path"
  317. OR "${symlink_name}" STREQUAL "symlink_from_non_relocatable_path"
  318. OR "${symlink_name}" STREQUAL "symlink_relocatable_subpath")
  319. # these links were not canged - post install script only - ignore them
  320. else()
  321. message(FATAL_ERROR "error: unexpected rpm symbolic link '${check_symlink}'")
  322. endif()
  323. if(NOT check_symlink)
  324. message(FATAL_ERROR "symlink points to unexpected location '${SYMLINK_POINT_}'")
  325. endif()
  326. endforeach()
  327. # verify post install symlink relocation script
  328. file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/*libraries*.spec")
  329. file(READ ${spec_file} spec_file_content)
  330. file(READ "${CMAKE_CURRENT_LIST_DIR}/symlink_postinstall_expected.txt" symlink_postinstall_expected)
  331. # prepare regex
  332. string(STRIP "${symlink_postinstall_expected}" symlink_postinstall_expected)
  333. string(REPLACE "[" "\\[" symlink_postinstall_expected "${symlink_postinstall_expected}")
  334. string(REPLACE "$" "\\$" symlink_postinstall_expected "${symlink_postinstall_expected}")
  335. string(REPLACE "lib" "lib${LIB_SUFFIX}" symlink_postinstall_expected "${symlink_postinstall_expected}")
  336. # compare
  337. string(REGEX MATCH ".*${symlink_postinstall_expected}.*" symlink_postinstall_expected_matches "${spec_file_content}")
  338. if(NOT symlink_postinstall_expected_matches)
  339. message(FATAL_ERROR "error: unexpected rpm symbolic link postinstall script! generated spec file: '${spec_file_content}'")
  340. endif()
  341. endif()
  342. endif()
  343. cmake_policy(POP)