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

Delta Between Two Patch Sets: sitescripts/extensions/bin/createNightlies.py

Issue 9044061: Nightly builds: prepared for the change in the Chrome build process (Closed)
Left Patch Set: Current build tools Created Dec. 29, 2012, 8:10 p.m.
Right Patch Set: Replaced hg archive by hg clone Created Jan. 2, 2013, 7:36 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « .hgsubstate ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2012 Eyeo GmbH 4 # Copyright (C) 2006-2012 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,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 for change in result.split('\0\0'): 80 for change in result.split('\0\0'):
81 if change: 81 if change:
82 date, author, revision, description = change.split('\0') 82 date, author, revision, description = change.split('\0')
83 yield {'date': date, 'author': author, 'revision': revision, 'descriptio n': description} 83 yield {'date': date, 'author': author, 'revision': revision, 'descriptio n': description}
84 84
85 def copyRepository(self): 85 def copyRepository(self):
86 ''' 86 '''
87 Create a repository copy in a temporary directory 87 Create a repository copy in a temporary directory
88 ''' 88 '''
89 # We cannot use hg archive here due to
90 # http://bz.selenic.com/show_bug.cgi?id=3747, have to clone properly :-(
89 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) 91 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName)
90 command = ['hg', 'archive', '-S', '-R', self.config.repository, '-r', 'defau lt', self.tempdir] 92 command = ['hg', 'clone', '-q', self.config.repository, '-u', 'default', sel f.tempdir]
Felix Dahlke 2013/01/02 07:47:33 Are you sure "-u default" is necessary? Don't thin
Wladimir Palant 2013/01/02 08:13:04 Yes, it is absolutely necessary - otherwise Mercur
91 subprocess.Popen(command).communicate() 93 subprocess.Popen(command).communicate()
92 94
93 def writeChangelog(self, changes): 95 def writeChangelog(self, changes):
94 """ 96 """
95 write the changelog file into the cloned repository 97 write the changelog file into the cloned repository
96 """ 98 """
97 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) 99 baseDir = os.path.join(self.config.nightliesDirectory, self.basename)
98 if not os.path.exists(baseDir): 100 if not os.path.exists(baseDir):
99 os.makedirs(baseDir) 101 os.makedirs(baseDir)
100 changelogFile = "%s-%s.changelog.xhtml" % (self.basename, self.version) 102 changelogFile = "%s-%s.changelog.xhtml" % (self.basename, self.version)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 self.basename = os.path.basename(self.config.repository) 150 self.basename = os.path.basename(self.config.repository)
149 151
150 def readChromeMetadata(self): 152 def readChromeMetadata(self):
151 """ 153 """
152 Read Chrome-specific metadata from metadata file. This will also 154 Read Chrome-specific metadata from metadata file. This will also
153 calculate extension ID from the private key. 155 calculate extension ID from the private key.
154 """ 156 """
155 157
156 # Calculate extension ID from public key 158 # Calculate extension ID from public key
157 # (see http://supercollider.dk/2010/01/calculating-chrome-extension-id-from- your-private-key-233) 159 # (see http://supercollider.dk/2010/01/calculating-chrome-extension-id-from- your-private-key-233)
158 import buildtools.packagerChrome as packager 160 import buildtools.packagerChrome as packager
Felix Dahlke 2013/01/02 07:47:33 Shouldn't this be "buildtools.packagerPorts" or so
Wladimir Palant 2013/01/02 08:13:04 No, not really. I doubt that we will ever have the
159 publicKey = packager.getPublicKey(self.config.keyFile) 161 publicKey = packager.getPublicKey(self.config.keyFile)
160 hash = hashlib.sha256() 162 hash = hashlib.sha256()
161 hash.update(publicKey) 163 hash.update(publicKey)
162 self.extensionID = hash.hexdigest()[0:32] 164 self.extensionID = hash.hexdigest()[0:32]
163 self.extensionID = ''.join(map(lambda c: chr(97 + int(c, 16)), self.extensio nID)) 165 self.extensionID = ''.join(map(lambda c: chr(97 + int(c, 16)), self.extensio nID))
164 166
165 # Now read metadata file 167 # Now read metadata file
166 metadata = packager.readMetadata(self.tempdir) 168 metadata = packager.readMetadata(self.tempdir)
167 self.version = metadata.get("general", "version") 169 self.version = metadata.get("general", "version")
168 while self.version.count('.') < 2: 170 while self.version.count('.') < 2:
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 link['changelog'] = changelogFile 292 link['changelog'] = changelogFile
291 links.append(link) 293 links.append(link)
292 template = get_template(get_config().get('extensions', 'nightlyIndexPage')) 294 template = get_template(get_config().get('extensions', 'nightlyIndexPage'))
293 template.stream({'config': self.config, 'links': links}).dump(outputPath) 295 template.stream({'config': self.config, 'links': links}).dump(outputPath)
294 296
295 def updateDocs(self): 297 def updateDocs(self):
296 if not self.config.type == 'gecko': 298 if not self.config.type == 'gecko':
297 return 299 return
298 300
299 docsdir = tempfile.mkdtemp(prefix='jsdoc') 301 docsdir = tempfile.mkdtemp(prefix='jsdoc')
300 command = ['hg', 'archive', '-S', '-R', get_config().get('extensions', 'jsdo cRepository'), '-r', 'default', docsdir] 302 command = ['hg', 'archive', '-R', get_config().get('extensions', 'jsdocRepos itory'), '-r', 'default', docsdir]
301 subprocess.Popen(command).communicate() 303 subprocess.Popen(command).communicate()
302 304
303 try: 305 try:
304 outputPath = os.path.join(self.config.docsDirectory, self.basename) 306 outputPath = os.path.join(self.config.docsDirectory, self.basename)
305 command = ['perl', os.path.join(docsdir, 'jsrun.pl'), 307 command = ['perl', os.path.join(docsdir, 'jsrun.pl'),
306 '-t=' + os.path.join(docsdir, 'templates', 'jsdoc'), 308 '-t=' + os.path.join(docsdir, 'templates', 'jsdoc'),
307 '-d=' + outputPath, 309 '-d=' + outputPath,
308 '-a', 310 '-a',
309 '-p', 311 '-p',
310 '-x=js', 312 '-x=js',
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 except Exception, ex: 389 except Exception, ex:
388 print >>sys.stderr, "The build for %s failed:" % repo 390 print >>sys.stderr, "The build for %s failed:" % repo
389 traceback.print_exc() 391 traceback.print_exc()
390 392
391 file = open(nightlyConfigFile, 'wb') 393 file = open(nightlyConfigFile, 'wb')
392 nightlyConfig.write(file) 394 nightlyConfig.write(file)
393 395
394 396
395 if __name__ == '__main__': 397 if __name__ == '__main__':
396 main() 398 main()
LEFTRIGHT
« .hgsubstate ('k') | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld