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

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

Issue 29345508: Issue 4098 - Get rid of special build setup for development builds (Closed)
Left Patch Set: Addressed comments Created June 3, 2016, 1:46 p.m.
Right Patch Set: Improved ensure_dependencies call Created June 6, 2016, 11:49 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 | « .sitescripts.example ('k') | sitescripts/extensions/utils.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 Eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 def copyRepository(self): 116 def copyRepository(self):
117 """ 117 """
118 Create a repository copy in a temporary directory 118 Create a repository copy in a temporary directory
119 """ 119 """
120 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) 120 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName)
121 command = ['hg', 'clone', '-q', self.config.repository, '-u', 'default', self.tempdir] 121 command = ['hg', 'clone', '-q', self.config.repository, '-u', 'default', self.tempdir]
122 subprocess.check_call(command) 122 subprocess.check_call(command)
123 123
124 # Make sure to run ensure_dependencies.py if present 124 # Make sure to run ensure_dependencies.py if present
125 command = [ 125 depscript = os.path.join(self.tempdir, 'ensure_dependencies.py')
126 sys.executable, 126 if os.path.isfile(depscript):
127 os.path.join(self.tempdir, 'ensure_dependencies.py'), '-q' 127 subprocess.check_call([sys.executable, depscript, '-q'])
128 ]
129 if os.path.isfile(command[0]):
Vasily Kuznetsov 2016/06/03 16:04:49 Should not this become `command[1]` now that we've
Wladimir Palant 2016/06/06 11:47:46 Ouch, you are right. In fact, I had a better idea
Vasily Kuznetsov 2016/06/06 12:48:16 Lovely!
130 subprocess.check_call(command)
131 128
132 def writeChangelog(self, changes): 129 def writeChangelog(self, changes):
133 """ 130 """
134 write the changelog file into the cloned repository 131 write the changelog file into the cloned repository
135 """ 132 """
136 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) 133 baseDir = os.path.join(self.config.nightliesDirectory, self.basename)
137 if not os.path.exists(baseDir): 134 if not os.path.exists(baseDir):
138 os.makedirs(baseDir) 135 os.makedirs(baseDir)
139 changelogFile = '%s-%s.changelog.xhtml' % (self.basename, self.version) 136 changelogFile = '%s-%s.changelog.xhtml' % (self.basename, self.version)
140 changelogPath = os.path.join(baseDir, changelogFile) 137 changelogPath = os.path.join(baseDir, changelogFile)
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 '/home/android/bin/makedebugbuild.py', '--revision', 306 '/home/android/bin/makedebugbuild.py', '--revision',
310 self.buildNum, '--version', self.version, '--stdout' 307 self.buildNum, '--version', self.version, '--stdout'
311 ])) 308 ]))
312 subprocess.check_call(buildCommand, stdout=apkFile, close_fds=Tr ue) 309 subprocess.check_call(buildCommand, stdout=apkFile, close_fds=Tr ue)
313 except: 310 except:
314 # clear broken output if any 311 # clear broken output if any
315 if os.path.exists(self.path): 312 if os.path.exists(self.path):
316 os.remove(self.path) 313 os.remove(self.path)
317 raise 314 raise
318 else: 315 else:
316 env = os.environ
317 spiderMonkeyBinary = self.config.spiderMonkeyBinary
318 if spiderMonkeyBinary:
319 env = dict(env, SPIDERMONKEY_BINARY=spiderMonkeyBinary)
320
319 buildCommand = [ 321 buildCommand = [
320 os.path.join(self.tempdir, 'build.py'), '-t', self.config.type, 322 os.path.join(self.tempdir, 'build.py'), '-t', self.config.type,
321 'build', '-b', self.buildNum, '-k', self.config.keyFile, 323 'build', '-b', self.buildNum, '-k', self.config.keyFile,
322 self.path 324 self.path
323 ] 325 ]
324 subprocess.check_call(buildCommand) 326 subprocess.check_call(buildCommand, env=env)
325 327
326 if not os.path.exists(self.path): 328 if not os.path.exists(self.path):
327 raise Exception("Build failed, output file hasn't been created") 329 raise Exception("Build failed, output file hasn't been created")
328 330
329 linkPath = os.path.join(baseDir, '00latest%s' % self.config.packageSuffi x) 331 linkPath = os.path.join(baseDir, '00latest%s' % self.config.packageSuffi x)
330 if hasattr(os, 'symlink'): 332 if hasattr(os, 'symlink'):
331 if os.path.exists(linkPath): 333 if os.path.exists(linkPath):
332 os.remove(linkPath) 334 os.remove(linkPath)
333 os.symlink(os.path.basename(self.path), linkPath) 335 os.symlink(os.path.basename(self.path), linkPath)
334 else: 336 else:
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 except Exception, ex: 630 except Exception, ex:
629 logging.error('The build for %s failed:', repo) 631 logging.error('The build for %s failed:', repo)
630 logging.exception(ex) 632 logging.exception(ex)
631 633
632 file = open(nightlyConfigFile, 'wb') 634 file = open(nightlyConfigFile, 'wb')
633 nightlyConfig.write(file) 635 nightlyConfig.write(file)
634 636
635 637
636 if __name__ == '__main__': 638 if __name__ == '__main__':
637 main() 639 main()
LEFTRIGHT

Powered by Google App Engine
This is Rietveld