summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CPack/tests/VERSION/VerifyResult.cmake
blob: eed9696cd13c0d34f55b90eaace19f2297e3abd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function(checkPackageInfo_ TYPE FILE REGEX)
  getPackageInfo("${FILE}" "FILE_INFO_")
  if(NOT FILE_INFO_ MATCHES "${REGEX}")
    message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}' ${EXPECTED_FILE_1_VERSION} ${EXPECTED_FILE_1_REVISION}; file info: '${FILE_INFO_}'")
  endif()
endfunction()

set(whitespaces_ "[\t\n\r ]*")

if(GENERATOR_TYPE STREQUAL "RPM")
  checkPackageInfo_("package version" "${FOUND_FILE_1}" "Version${whitespaces_}:${whitespaces_}${EXPECTED_FILE_1_VERSION}")
  checkPackageInfo_("package revision" "${FOUND_FILE_1}" "Release${whitespaces_}:${whitespaces_}${EXPECTED_FILE_1_REVISION}")
  checkPackageInfo_("epoch version" "${FOUND_FILE_1}" "Epoch${whitespaces_}:${whitespaces_}3")
else() # DEB
  checkPackageInfo_("version" "${FOUND_FILE_1}"
    ".*Version${whitespaces_}:${whitespaces_}3:${EXPECTED_FILE_1_VERSION}-${EXPECTED_FILE_1_REVISION}")
endif()