summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2019-09-12 15:15:33 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2019-09-12 15:15:33 +0200
commit99ecb33389dd675c5c79928c2ac705585b0c467d (patch)
tree98f685541876c4e1344fb8e36e930ffd5e2e5fb8 /cmake
parentbe6beb73e9e6adf2ebd69354a2496817f03ae6ff (diff)
downloadmariadb-git-99ecb33389dd675c5c79928c2ac705585b0c467d.tar.gz
MDEV-20570 : Packaging fails "The specified timestamp server either could not be reached"
On Windows, during packaging step, if signing fails, retry signtool again without timestamp parameter. Fixes sporadic (rare) failures on buildbot
Diffstat (limited to 'cmake')
-rw-r--r--cmake/sign.cmake.in22
1 files changed, 20 insertions, 2 deletions
diff --git a/cmake/sign.cmake.in b/cmake/sign.cmake.in
index 61ae38d152d..50768a3dcc9 100644
--- a/cmake/sign.cmake.in
+++ b/cmake/sign.cmake.in
@@ -1,13 +1,31 @@
+# If timestamping is used, it can (rarely) fail, when public timestamping service has issues.
+#
+# To handle the error gracefully and tranparently, we'll retry the signtool command,
+# second time without "/t URL" parameter
+SET(SIGNTOOL_PARAMETERS_NO_TIMESTAMP "@SIGNTOOL_PARAMETERS@")
+LIST(FIND SIGNTOOL_PARAMETERS_NO_TIMESTAMP /t idx)
+IF(NOT(idx EQUAL -1))
+ LIST(REMOVE_AT SIGNTOOL_PARAMETERS_NO_TIMESTAMP ${idx})
+ #remove the URL following /t , as well
+ LIST(REMOVE_AT SIGNTOOL_PARAMETERS_NO_TIMESTAMP ${idx})
+ENDIF()
+
+GET_FILENAME_COMPONENT(SIGNTOOL_DIR "@SIGNTOOL_EXECUTABLE@" DIRECTORY)
+GET_FILENAME_COMPONENT(SIGNTOOL_NAME "@SIGNTOOL_EXECUTABLE@" NAME)
+
FILE(GLOB_RECURSE files "@CMAKE_BINARY_DIR@/*.signme")
MESSAGE(STATUS "signing files")
+
+
FOREACH(f ${files})
STRING(REPLACE ".signme" "" exe_location "${f}")
string (REPLACE ";" " " params "@SIGNTOOL_PARAMETERS@")
- #MESSAGE("@SIGNTOOL_EXECUTABLE@" sign ${params} "${exe_location}")
EXECUTE_PROCESS(COMMAND
- "@SIGNTOOL_EXECUTABLE@" sign @SIGNTOOL_PARAMETERS@ "${exe_location}"
+ cmd /c "${SIGNTOOL_NAME}" sign @SIGNTOOL_PARAMETERS@ "${exe_location}" 2>NUL
+ || "${SIGNTOOL_NAME}" sign ${SIGNTOOL_PARAMETERS_NO_TIMESTAMP} "${exe_location}"
+ WORKING_DIRECTORY ${SIGNTOOL_DIR}
RESULT_VARIABLE ERR)
IF(NOT ${ERR} EQUAL 0)
MESSAGE( "Error ${ERR} signing ${exe_location}")