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

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

Issue 6627397512200192: Issue 1362 - createNightlies script should call ensure_dependencies (Closed)
Left Patch Set: Created Sept. 11, 2014, 6:19 p.m.
Right Patch Set: Use set literals Created Sept. 18, 2014, 6:17 p.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 | « no previous file | 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-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,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 self.outputFilename = None 57 self.outputFilename = None
58 self.changelogFilename = None 58 self.changelogFilename = None
59 59
60 def hasChanges(self): 60 def hasChanges(self):
61 return self.revision != self.previousRevision 61 return self.revision != self.previousRevision
62 62
63 def getCurrentRevision(self): 63 def getCurrentRevision(self):
64 """ 64 """
65 retrieves the current revision number from the repository 65 retrieves the current revision number from the repository
66 """ 66 """
67 command = ['hg', 'log', '-R', self.config.repository, '-r', 'default', '--te mplate', '{rev}'] 67 command = ['hg', 'log', '-R', self.config.repository, '-r', 'default',
68 '--template', '{rev}', '--config', 'defaults.log=']
68 return subprocess.check_output(command) 69 return subprocess.check_output(command)
69 70
70 def getChanges(self): 71 def getChanges(self):
71 """ 72 """
72 retrieve changes between the current and previous ("first") revision 73 retrieve changes between the current and previous ("first") revision
73 """ 74 """
74 75
75 command = ['hg', 'log', '-R', self.config.repository, '-r', 'tip:0', 76 command = ['hg', 'log', '-R', self.config.repository, '-r', 'tip:0',
76 '-b', 'default', '-l', '50', '--encoding', 'utf-8', 77 '-b', 'default', '-l', '50', '--encoding', 'utf-8',
77 '--template', '{date|isodate}\\0{author|person}\\0{rev}\\0{desc}\\0\\0'] 78 '--template', '{date|isodate}\\0{author|person}\\0{rev}\\0{desc}\\0\\0',
79 '--config', 'defaults.log=']
78 result = subprocess.check_output(command).decode('utf-8') 80 result = subprocess.check_output(command).decode('utf-8')
79 81
80 for change in result.split('\0\0'): 82 for change in result.split('\0\0'):
81 if change: 83 if change:
82 date, author, revision, description = change.split('\0') 84 date, author, revision, description = change.split('\0')
83 yield {'date': date, 'author': author, 'revision': revision, 'descriptio n': description} 85 yield {'date': date, 'author': author, 'revision': revision, 'descriptio n': description}
84 86
85 def copyRepository(self): 87 def copyRepository(self):
86 ''' 88 '''
87 Create a repository copy in a temporary directory 89 Create a repository copy in a temporary directory
88 ''' 90 '''
89 # We cannot use hg archive here due to 91 # We cannot use hg archive here due to
90 # http://bz.selenic.com/show_bug.cgi?id=3747, have to clone properly :-( 92 # http://bz.selenic.com/show_bug.cgi?id=3747, have to clone properly :-(
91 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) 93 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName)
92 command = ['hg', 'clone', '-q', self.config.repository, '-u', 'default', sel f.tempdir] 94 command = ['hg', 'clone', '-q', self.config.repository, '-u', 'default', sel f.tempdir]
93 subprocess.check_call(command) 95 subprocess.check_call(command)
94 96
95 # Make sure to process the dependencies file if it is present 97 # Make sure to process the dependencies file if it is present
96 import logging 98 import logging
97 logging.disable(logging.WARNING) 99 logging.disable(logging.WARNING)
98 try: 100 try:
99 from buildtools.ensure_dependencies import resolve_deps 101 from buildtools.ensure_dependencies import resolve_deps
100 resolve_deps(self.tempdir, self_update=False, 102 resolve_deps(self.tempdir, self_update=False,
101 overrideroots={"hg": os.path.dirname(self.config.repository)}, 103 overrideroots={"hg": os.path.dirname(self.config.repository)},
102 skipdependencies=set(["buildtools"])) 104 skipdependencies={"buildtools"})
Sebastian Noack 2014/09/18 16:27:46 We don't support Python 2.6 anymore, right? Then y
Wladimir Palant 2014/09/18 18:18:18 Done.
103 finally: 105 finally:
104 logging.disable(logging.NOTSET) 106 logging.disable(logging.NOTSET)
105 107
106 def writeChangelog(self, changes): 108 def writeChangelog(self, changes):
107 """ 109 """
108 write the changelog file into the cloned repository 110 write the changelog file into the cloned repository
109 """ 111 """
110 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) 112 baseDir = os.path.join(self.config.nightliesDirectory, self.basename)
111 if not os.path.exists(baseDir): 113 if not os.path.exists(baseDir):
112 os.makedirs(baseDir) 114 os.makedirs(baseDir)
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 except Exception, ex: 505 except Exception, ex:
504 print >>sys.stderr, "The build for %s failed:" % repo 506 print >>sys.stderr, "The build for %s failed:" % repo
505 traceback.print_exc() 507 traceback.print_exc()
506 508
507 file = open(nightlyConfigFile, 'wb') 509 file = open(nightlyConfigFile, 'wb')
508 nightlyConfig.write(file) 510 nightlyConfig.write(file)
509 511
510 512
511 if __name__ == '__main__': 513 if __name__ == '__main__':
512 main() 514 main()
LEFTRIGHT
« no previous file | 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