Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: releaseAutomation.py

Issue 29562614: Issue 5752 - Removing safari support (Closed)
Patch Set: Created Oct. 2, 2017, 10:35 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « packagerSafari.py ('k') | templates/safariInfo.js.tmpl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This Source Code Form is subject to the terms of the Mozilla Public 1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 4
5 from __future__ import print_function 5 from __future__ import print_function
6 6
7 import os 7 import os
8 import re 8 import re
9 import codecs 9 import codecs
10 import subprocess 10 import subprocess
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 if repo_has_outgoing(): 112 if repo_has_outgoing():
113 return continue_with_outgoing() 113 return continue_with_outgoing()
114 return True 114 return True
115 115
116 116
117 def run(baseDir, type, version, keyFile, downloadsRepo): 117 def run(baseDir, type, version, keyFile, downloadsRepo):
118 if not can_safely_release(baseDir, downloadsRepo): 118 if not can_safely_release(baseDir, downloadsRepo):
119 print('Aborting release.') 119 print('Aborting release.')
120 return 1 120 return 1
121 121
122 if type == 'safari': 122 if type == 'edge':
123 import buildtools.packagerSafari as packager
124 elif type == 'edge':
125 import buildtools.packagerEdge as packager 123 import buildtools.packagerEdge as packager
126 elif type == 'chrome': 124 elif type == 'chrome':
127 import buildtools.packagerChrome as packager 125 import buildtools.packagerChrome as packager
128 126
129 # Replace version number in metadata file "manually", ConfigParser will mess 127 # Replace version number in metadata file "manually", ConfigParser will mess
130 # up the order of lines. 128 # up the order of lines.
131 metadata = readMetadata(baseDir, type) 129 metadata = readMetadata(baseDir, type)
132 with open(metadata.option_source('general', 'version'), 'r+b') as file: 130 with open(metadata.option_source('general', 'version'), 'r+b') as file:
133 rawMetadata = file.read() 131 rawMetadata = file.read()
134 rawMetadata = re.sub( 132 rawMetadata = re.sub(
(...skipping 10 matching lines...) Expand all
145 143
146 with open(os.path.join(locales_base, 'chrome', 'locale', 144 with open(os.path.join(locales_base, 'chrome', 'locale',
147 packager.defaultLocale.replace('_', '-'), 145 packager.defaultLocale.replace('_', '-'),
148 'meta.json'), 146 'meta.json'),
149 'r') as fp: 147 'r') as fp:
150 extensionName = json.load(fp)['name'] 148 extensionName = json.load(fp)['name']
151 149
152 # Now commit the change and tag it 150 # Now commit the change and tag it
153 subprocess.check_call(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s ' % (extensionName, version)]) 151 subprocess.check_call(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s ' % (extensionName, version)])
154 tag_name = version 152 tag_name = version
155 if type in {'safari', 'edge'}: 153 if type == 'edge':
156 tag_name = '{}-{}'.format(tag_name, type) 154 tag_name = '{}-{}'.format(tag_name, type)
157 subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', tag_name]) 155 subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', tag_name])
158 156
159 # Create a release build 157 # Create a release build
160 downloads = [] 158 downloads = []
161 if type == 'chrome': 159 if type == 'chrome':
162 # Create both signed and unsigned Chrome builds (the latter for Chrome W eb Store). 160 # Create both signed and unsigned Chrome builds (the latter for Chrome W eb Store).
163 buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, ver sion, 'crx')) 161 buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, ver sion, 'crx'))
164 packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild =True, keyFile=keyFile) 162 packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild =True, keyFile=keyFile)
165 downloads.append(buildPath) 163 downloads.append(buildPath)
166 164
167 buildPathUnsigned = os.path.join(baseDir, getDefaultFileName(metadata, v ersion, 'zip')) 165 buildPathUnsigned = os.path.join(baseDir, getDefaultFileName(metadata, v ersion, 'zip'))
168 packager.createBuild(baseDir, type=type, outFile=buildPathUnsigned, rele aseBuild=True, keyFile=None) 166 packager.createBuild(baseDir, type=type, outFile=buildPathUnsigned, rele aseBuild=True, keyFile=None)
169 elif type == 'safari':
170 buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, ver sion, 'safariextz'))
171 packager.createBuild(baseDir, type='safari', outFile=buildPath, releaseB uild=True, keyFile=keyFile)
172 downloads.append(buildPath)
173 elif type == 'edge': 167 elif type == 'edge':
174 # We only offer the Edge extension for use through the Windows Store 168 # We only offer the Edge extension for use through the Windows Store
175 buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, ver sion, 'appx')) 169 buildPath = os.path.join(downloadsRepo, getDefaultFileName(metadata, ver sion, 'appx'))
176 packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild =True) 170 packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild =True)
177 downloads.append(buildPath) 171 downloads.append(buildPath)
178 172
179 # Create source archive 173 # Create source archive
180 archivePath = os.path.splitext(buildPath)[0] + '-source.tgz' 174 archivePath = os.path.splitext(buildPath)[0] + '-source.tgz'
181 create_sourcearchive(baseDir, archivePath) 175 create_sourcearchive(baseDir, archivePath)
182 downloads.append(archivePath) 176 downloads.append(archivePath)
183 177
184 # Now add the downloads and commit 178 # Now add the downloads and commit
185 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) 179 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads)
186 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)]) 180 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)])
187 181
188 # Push all changes 182 # Push all changes
189 subprocess.check_call(['hg', 'push', '-R', baseDir]) 183 subprocess.check_call(['hg', 'push', '-R', baseDir])
190 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) 184 subprocess.check_call(['hg', 'push', '-R', downloadsRepo])
OLDNEW
« no previous file with comments | « packagerSafari.py ('k') | templates/safariInfo.js.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld