Restore Cinder's codesigning Support
This commit is contained in:
@@ -412,6 +412,21 @@ class WindowsManifest(ViewerManifest):
|
|||||||
mask = "%s_%s_Setup.exe"
|
mask = "%s_%s_Setup.exe"
|
||||||
return mask % (self.channel_oneword(), '-'.join(self.args['version']))
|
return mask % (self.channel_oneword(), '-'.join(self.args['version']))
|
||||||
|
|
||||||
|
def sign_command(self, *argv):
|
||||||
|
return [
|
||||||
|
"signtool.exe",
|
||||||
|
"sign", "/v",
|
||||||
|
"/f",os.environ['VIEWER_SIGNING_KEY'],
|
||||||
|
"/p",os.environ['VIEWER_SIGNING_PASSWORD'],
|
||||||
|
"/d","%s" % self.channel(),
|
||||||
|
"/du",os.environ['VIEWER_SIGNING_URL'],
|
||||||
|
"/t","http://timestamp.comodoca.com/authenticode"
|
||||||
|
] + list(argv)
|
||||||
|
|
||||||
|
|
||||||
|
def sign(self, *argv):
|
||||||
|
subprocess.check_call(self.sign_command(*argv))
|
||||||
|
|
||||||
def package_finish(self):
|
def package_finish(self):
|
||||||
# a standard map of strings for replacing in the templates
|
# a standard map of strings for replacing in the templates
|
||||||
substitution_strings = {
|
substitution_strings = {
|
||||||
@@ -458,6 +473,15 @@ class WindowsManifest(ViewerManifest):
|
|||||||
installer_file = installer_file % substitution_strings
|
installer_file = installer_file % substitution_strings
|
||||||
substitution_strings['installer_file'] = installer_file
|
substitution_strings['installer_file'] = installer_file
|
||||||
|
|
||||||
|
# Sign the binaries
|
||||||
|
if 'VIEWER_SIGNING_PASSWORD' in os.environ:
|
||||||
|
try:
|
||||||
|
self.sign(self.args['configuration']+"\\"+self.final_exe())
|
||||||
|
self.sign(self.args['configuration']+"\\SLPlugin.exe")
|
||||||
|
self.sign(self.args['configuration']+"\\SLVoice.exe")
|
||||||
|
except Exception, e:
|
||||||
|
print "Couldn't sign binaries. Tried to sign %s" % self.args['configuration'] + "\\" + self.final_exe() + "\nException: %s" % e
|
||||||
|
|
||||||
tempfile = "secondlife_setup_tmp.nsi"
|
tempfile = "secondlife_setup_tmp.nsi"
|
||||||
# the following replaces strings in the nsi template
|
# the following replaces strings in the nsi template
|
||||||
# it also does python-style % substitution
|
# it also does python-style % substitution
|
||||||
@@ -485,14 +509,24 @@ class WindowsManifest(ViewerManifest):
|
|||||||
NSIS_path = os.environ['ProgramFiles(X86)'] + '\\NSIS\\Unicode\\makensis.exe'
|
NSIS_path = os.environ['ProgramFiles(X86)'] + '\\NSIS\\Unicode\\makensis.exe'
|
||||||
self.run_command([proper_windows_path(NSIS_path),self.dst_path_of(tempfile)])
|
self.run_command([proper_windows_path(NSIS_path),self.dst_path_of(tempfile)])
|
||||||
# self.remove(self.dst_path_of(tempfile))
|
# 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_PY}")
|
# Sign the installer
|
||||||
if sign_py == "" or sign_py == "{SIGN_PY}":
|
# We're probably not on a build machine, but maybe we want to sign
|
||||||
sign_py = 'C:\\buildscripts\\code-signing\\sign.py'
|
if 'VIEWER_SIGNING_PASSWORD' in os.environ:
|
||||||
if os.path.exists(sign_py):
|
try:
|
||||||
self.run_command('python ' + sign_py + ' ' + self.dst_path_of(installer_file))
|
self.sign(self.args['configuration'] + "\\" + substitution_strings['installer_file'])
|
||||||
|
except Exception, e:
|
||||||
|
print "Couldn't sign windows installer. Tried to sign %s" % self.args['configuration'] + "\\" + substitution_strings['installer_file'] + "\nException: %s" % e
|
||||||
else:
|
else:
|
||||||
print "Skipping code signing,", sign_py, "does not exist"
|
# If we're on a build machine, sign the code using our Authenticode certificate. JC
|
||||||
|
sign_py = os.path.expandvars("{SIGN_PY}")
|
||||||
|
if sign_py == "" or sign_py == "{SIGN_PY}":
|
||||||
|
sign_py = 'C:\\buildscripts\\code-signing\\sign.py'
|
||||||
|
if os.path.exists(sign_py):
|
||||||
|
self.run_command('python ' + sign_py + ' ' + self.dst_path_of(installer_file))
|
||||||
|
else:
|
||||||
|
print "Skipping code signing,", sign_py, "does not exist"
|
||||||
|
|
||||||
self.created_path(self.dst_path_of(installer_file))
|
self.created_path(self.dst_path_of(installer_file))
|
||||||
self.package_file = installer_file
|
self.package_file = installer_file
|
||||||
|
|
||||||
@@ -640,6 +674,37 @@ class DarwinManifest(ViewerManifest):
|
|||||||
if not self.default_channel_for_brand():
|
if not self.default_channel_for_brand():
|
||||||
channel_standin = self.channel()
|
channel_standin = self.channel()
|
||||||
|
|
||||||
|
# Sign the app if we have a key.
|
||||||
|
try:
|
||||||
|
signing_password = os.environ['VIEWER_SIGNING_PASSWORD']
|
||||||
|
except KeyError:
|
||||||
|
print "Skipping code signing"
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
home_path = os.environ['HOME']
|
||||||
|
|
||||||
|
self.run_command('security unlock-keychain -p "%s" "%s/Library/Keychains/viewer.keychain"' % (signing_password, home_path))
|
||||||
|
signed=False
|
||||||
|
sign_attempts=3
|
||||||
|
sign_retry_wait=15
|
||||||
|
while (not signed) and (sign_attempts > 0):
|
||||||
|
try:
|
||||||
|
sign_attempts-=1;
|
||||||
|
self.run_command('codesign --verbose --force --timestamp --keychain "%(home_path)s/Library/Keychains/viewer.keychain" -s %(identity)r -f %(bundle)r' % {
|
||||||
|
'home_path' : home_path,
|
||||||
|
'identity': os.environ['VIEWER_SIGNING_KEY'],
|
||||||
|
'bundle': self.get_dst_prefix()
|
||||||
|
})
|
||||||
|
signed=True
|
||||||
|
except:
|
||||||
|
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
|
||||||
|
|
||||||
imagename=self.installer_prefix() + '_'.join(self.args['version'])
|
imagename=self.installer_prefix() + '_'.join(self.args['version'])
|
||||||
|
|
||||||
# See Ambroff's Hack comment further down if you want to create new bundles and dmg
|
# See Ambroff's Hack comment further down if you want to create new bundles and dmg
|
||||||
|
|||||||
Reference in New Issue
Block a user