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

Side by Side Diff: sitescripts/extensions/bin/createNightlies.py

Issue 6270530592178176: Issue 1144 - Generate IE update manifests (Closed)
Patch Set: Import writeIEUpdateManifest as doWrite in the function body Created July 30, 2014, 2:22 p.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 | « .sitescripts.example ('k') | sitescripts/extensions/bin/updateUpdateManifests.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2014 Eyeo GmbH 4 # Copyright (C) 2006-2014 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details. 13 # GNU General Public License for more details.
14 # 14 #
15 # You should have received a copy of the GNU General Public License 15 # You should have received a copy of the GNU General Public License
16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
17 17
18 """ 18 """
19 19
20 Nightly builds generation script 20 Nightly builds generation script
21 ================================ 21 ================================
22 22
23 This script generates nightly builds of extensions, together 23 This script generates nightly builds of extensions, together
24 with changelogs and documentation. 24 with changelogs and documentation.
25 25
26 """ 26 """
27 27
28 import sys, os, os.path, codecs, subprocess, ConfigParser, traceback, json, hash lib 28 import sys, os, os.path, subprocess, ConfigParser, traceback, json, hashlib
29 import tempfile, shutil, urlparse, pipes, time, urllib2, struct 29 import tempfile, shutil, urlparse, pipes, time, urllib2, struct
30 from datetime import datetime 30 from datetime import datetime
31 from urllib import urlencode 31 from urllib import urlencode
32 from xml.dom.minidom import parse as parseXml 32 from xml.dom.minidom import parse as parseXml
33 from sitescripts.utils import get_config, setupStderr, get_template 33 from sitescripts.utils import get_config, setupStderr, get_template
34 from sitescripts.extensions.utils import compareVersions, Configuration, getSafa riCertificateID 34 from sitescripts.extensions.utils import compareVersions, Configuration, getSafa riCertificateID
35 35
36 MAX_BUILDS = 50 36 MAX_BUILDS = 50
37 37
38 38
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 elif self.config.type == 'android': 200 elif self.config.type == 'android':
201 manifestPath = os.path.join(baseDir, "updates.xml") 201 manifestPath = os.path.join(baseDir, "updates.xml")
202 templateName = 'androidUpdateManifest' 202 templateName = 'androidUpdateManifest'
203 else: 203 else:
204 manifestPath = os.path.join(baseDir, "update.rdf") 204 manifestPath = os.path.join(baseDir, "update.rdf")
205 templateName = 'geckoUpdateManifest' 205 templateName = 'geckoUpdateManifest'
206 206
207 template = get_template(get_config().get('extensions', templateName)) 207 template = get_template(get_config().get('extensions', templateName))
208 template.stream({'extensions': [self]}).dump(manifestPath) 208 template.stream({'extensions': [self]}).dump(manifestPath)
209 209
210 def writeLibabpUpdateManifest(self, updates):
211 """
212 Writes update.json file for libadblockplus
213 """
214 baseDir = os.path.join(self.config.nightliesDirectory, self.basename)
215 if not os.path.exists(baseDir):
216 os.makedirs(baseDir)
217 manifestPath = os.path.join(baseDir, "update.json")
218
219 handle = codecs.open(manifestPath, "wb", encoding="UTF-8")
220 json.dump(updates, handle, ensure_ascii=False, indent=2, separators=(",", ": "))
221 handle.close()
222
223 def writeIEUpdateManifest(self, versions): 210 def writeIEUpdateManifest(self, versions):
224 """ 211 """
225 Writes update.json file for the latest IE build 212 Writes update.json file for the latest IE build
226 """ 213 """
227 if len(versions) == 0: 214 if len(versions) == 0:
228 return 215 return
229 216
230 version = versions[0] 217 version = versions[0]
231 packageName = self.basename + '-' + versions[0] + self.config.packageSuffix 218 packageName = self.basename + '-' + version + self.config.packageSuffix
232 updateURL = urlparse.urljoin(self.config.nightliesURL, self.basename + '/' + packageName + '?update') 219 updateURL = urlparse.urljoin(self.config.nightliesURL, self.basename + '/' + packageName + '?update')
233 self.writeLibabpUpdateManifest({ 220 baseDir = os.path.join(self.config.nightliesDirectory, self.basename)
234 "%s/%s" % (self.basename, "msie64"): { 221 manifestPath = os.path.join(baseDir, 'update.json')
235 "url": updateURL.replace(".exe", "-x64.msi"),
236 "version": version,
237 },
238 "%s/%s" % (self.basename, "msie32"): {
239 "url": updateURL.replace(".exe", "-x86.msi"),
240 "version": version,
241 },
242 })
243 222
244 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) 223 from sitescripts.extensions.utils import writeIEUpdateManifest as doWrite
224 doWrite(manifestPath, [{
225 'basename': self.basename,
226 'version': version,
227 'updateURL': updateURL
228 }])
229
245 for suffix in (self.config.packageSuffix, self.config.packageSuffix.replace( "-x64", "-x86")): 230 for suffix in (self.config.packageSuffix, self.config.packageSuffix.replace( "-x64", "-x86")):
246 linkPath = os.path.join(baseDir, '00latest%s' % suffix) 231 linkPath = os.path.join(baseDir, '00latest%s' % suffix)
247 outputPath = os.path.join(baseDir, self.basename + '-' + versions[0] + suf fix) 232 outputPath = os.path.join(baseDir, self.basename + '-' + version + suffix)
248 if hasattr(os, 'symlink'): 233 if hasattr(os, 'symlink'):
249 if os.path.exists(linkPath): 234 if os.path.exists(linkPath):
250 os.remove(linkPath) 235 os.remove(linkPath)
251 os.symlink(os.path.basename(outputPath), linkPath) 236 os.symlink(os.path.basename(outputPath), linkPath)
252 else: 237 else:
253 shutil.copyfile(outputPath, linkPath) 238 shutil.copyfile(outputPath, linkPath)
254 239
255
256 def build(self): 240 def build(self):
257 """ 241 """
258 run the build command in the tempdir 242 run the build command in the tempdir
259 """ 243 """
260 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) 244 baseDir = os.path.join(self.config.nightliesDirectory, self.basename)
261 if not os.path.exists(baseDir): 245 if not os.path.exists(baseDir):
262 os.makedirs(baseDir) 246 os.makedirs(baseDir)
263 outputFile = "%s-%s%s" % (self.basename, self.version, self.config.packageSu ffix) 247 outputFile = "%s-%s%s" % (self.basename, self.version, self.config.packageSu ffix)
264 self.path = os.path.join(baseDir, outputFile) 248 self.path = os.path.join(baseDir, outputFile)
265 self.updateURL = urlparse.urljoin(self.config.nightliesURL, self.basename + '/' + outputFile + '?update') 249 self.updateURL = urlparse.urljoin(self.config.nightliesURL, self.basename + '/' + outputFile + '?update')
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 except Exception, ex: 492 except Exception, ex:
509 print >>sys.stderr, "The build for %s failed:" % repo 493 print >>sys.stderr, "The build for %s failed:" % repo
510 traceback.print_exc() 494 traceback.print_exc()
511 495
512 file = open(nightlyConfigFile, 'wb') 496 file = open(nightlyConfigFile, 'wb')
513 nightlyConfig.write(file) 497 nightlyConfig.write(file)
514 498
515 499
516 if __name__ == '__main__': 500 if __name__ == '__main__':
517 main() 501 main()
OLDNEW
« no previous file with comments | « .sitescripts.example ('k') | sitescripts/extensions/bin/updateUpdateManifests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld