Optimized kvasd download in build

The kvasd binary  need only be downloaded  if the MD5 hash  for it has
changed.

Also fixed a defect in the status check of the MD5 hash download.

Also switched to HTTP protocol as  it is quick and gives clearer error
messages.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4830 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2014-12-16 17:58:01 +00:00
parent 65d6d9d071
commit e83513f155
2 changed files with 27 additions and 20 deletions

View File

@ -1,34 +1,41 @@
#
# CMake script to fetch kvasd binary for the current platform
#
set (kvasd_NAME ${URL}/${SYSTEM_NAME}/kvasd${EXECUTABLE_SUFFIX})
message (STATUS "file: ${kvasd_NAME}")
set (kvasd_NAME "${URL}/${SYSTEM_NAME}/kvasd${EXECUTABLE_SUFFIX}")
set (kvasd_target "contrib/kvasd${EXECUTABLE_SUFFIX}")
message (STATUS "downloading file: ${kvasd_NAME}.md5")
file (
DOWNLOAD ${kvasd_NAME}.md5 contrib/kvasd${EXECUTABLE_SUFFIX}.md5
DOWNLOAD "${kvasd_NAME}.md5" "${kvasd_target}.md5"
TIMEOUT 120
STATUS status
LOG log
SHOW_PROGRESS
)
list (GET staus 0 rc)
if (rc)
message (WARNING "${status}")
message (FATAL_ERROR "${log}")
endif (rc)
file (READ contrib/kvasd${EXECUTABLE_SUFFIX}.md5 md5sum)
string (REGEX MATCH "[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]" md5sum "${md5sum}")
file (
DOWNLOAD ${kvasd_NAME} contrib/kvasd${EXECUTABLE_SUFFIX}
TIMEOUT 120
STATUS status
LOG log
SHOW_PROGRESS
EXPECTED_MD5 "${md5sum}"
)
list (GET status 0 rc)
if (rc)
message (WARNING "${status}")
message (FATAL_ERROR "${log}")
endif (rc)
file (READ "${kvasd_target}.md5" md5sum)
string (REGEX MATCH "[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]" md5sum "${md5sum}")
file (MD5 "${kvasd_target}" current_md5sum)
if (NOT "${md5sum}" STREQUAL "${current_md5sum}")
message (STATUS "downloading file: ${kvasd_NAME}")
file (
DOWNLOAD ${kvasd_NAME} contrib/kvasd${EXECUTABLE_SUFFIX}
TIMEOUT 120
STATUS status
LOG log
SHOW_PROGRESS
EXPECTED_MD5 "${md5sum}"
)
list (GET status 0 rc)
if (rc)
message (WARNING "${status}")
message (FATAL_ERROR "${log}")
endif (rc)
else (NOT "${md5sum}" STREQUAL "${current_md5sum}")
message (STATUS "file: ${kvasd_NAME} up to date")
endif (NOT "${md5sum}" STREQUAL "${current_md5sum}")

View File

@ -49,7 +49,7 @@ set (PROJECT_DESCRIPTION "${PROJECT_SUMMARY_DESCRIPTION}
standard SSB-width IF filters, switching between JT65 and JT9 modes
is quick and convenient. Be sure to read the online ${PROJECT_NAME} User's
Guide.")
set (PROJECT_KVASD_URL https://svn.code.sf.net/p/wsjt/wsjt/trunk/kvasd-binary)
set (PROJECT_KVASD_URL http://svn.code.sf.net/p/wsjt/wsjt/trunk/kvasd-binary)
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake/Modules ${CMAKE_MODULE_PATH})