add retry when sign program failed (#2253)

* add retry when sign program failed

* change after review
This commit is contained in:
sun20121818 2019-10-08 15:32:16 +08:00 committed by Shuai Lin
parent 5e16bbb7fe
commit 08481ac117

View File

@ -44,6 +44,9 @@ error_exit = False
# command line configuartion
conf = {}
# The retry times when sign programs
RETRY_COUNT = 3
# key names in the conf dictionary.
CONF_VERSION = 'version'
CONF_LIBSEARPC_VERSION = 'libsearpc_version'
@ -840,10 +843,16 @@ def do_sign(certfile, fn, desc=None):
desc_flags = ''
# https://support.comodo.com/index.php?/Knowledgebase/Article/View/68/0/time-stamping-server
time.sleep(16)
signcmd = 'signtool.exe sign -fd sha256 -t http://timestamp.comodoca.com -f {} {} {}'.format(certfile, desc_flags, fn)
if run(signcmd, cwd=os.path.dirname(fn)) != 0:
error('Failed to sign file "{}"'.format(fn))
i = 0
while i < RETRY_COUNT:
time.sleep(30)
ret = run(signcmd, cwd=os.path.dirname(fn))
if ret == 0:
break
i = i + 1
if i == RETRY_COUNT:
error('Failed to sign file "{}"'.format(fn))
def strip_symbols():
bin_dir = os.path.join(conf[CONF_BUILDDIR], 'pack', 'bin')