From 251bf8ceca2af09d7b6aa7dbdc6178bf8f01afff Mon Sep 17 00:00:00 2001
From: JJ Linden <jj@lindenlab.com>
Date: Wed, 19 Feb 2014 14:40:27 -0800
Subject: [PATCH] duplicated the workaround added for darwin codesigning onto
 the windos codesigning

---
 indra/newview/viewer_manifest.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 96b4c7268c5..85d18b7789a 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -622,7 +622,22 @@ def package_finish(self):
         NSIS_path = os.path.expandvars('${ProgramFiles}\\NSIS\\Unicode\\makensis.exe')
         if not os.path.exists(NSIS_path):
             NSIS_path = os.path.expandvars('${ProgramFiles(x86)}\\NSIS\\Unicode\\makensis.exe')
-        self.run_command('"' + proper_windows_path(NSIS_path) + '" ' + self.dst_path_of(tempfile))
+        signed=False
+        sign_attempts=3
+        sign_retry_wait=15
+        while (not signed) and (sign_attempts > 0):
+            try:
+                sign_attempts-=1;
+                self.run_command('"' + proper_windows_path(NSIS_path) + '" ' + self.dst_path_of(tempfile))
+                signed=True # if no exception was raised, the codesign worked
+            except ManifestError, err:
+                if sign_attempts:
+                    print >> sys.stderr, "codesign failed, waiting %d seconds before retrying" % sign_retry_wait
+                    time.sleep(sign_retry_wait)
+                    sign_retry_wait*=2
+                else:
+                    print >> sys.stderr, "Maximum codesign attempts exceeded; giving up"
+                    raise
         # self.remove(self.dst_path_of(tempfile))
         # If we're on a build machine, sign the code using our Authenticode certificate. JC
         sign_py = os.path.expandvars("${SIGN}")
-- 
GitLab