OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Set of utilities to add commands to a buildbot factory (BuildFactory). | 5 """Set of utilities to add commands to a buildbot factory (BuildFactory). |
6 | 6 |
7 All the utility functions to add steps to a build factory here are not | 7 All the utility functions to add steps to a build factory here are not |
8 project-specific. See the other *_commands.py for project-specific commands. | 8 project-specific. See the other *_commands.py for project-specific commands. |
9 """ | 9 """ |
10 | 10 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 WithProperties.__init__(self, fmtstring, *args, **kwargs) | 209 WithProperties.__init__(self, fmtstring, *args, **kwargs) |
210 self.transform = transform | 210 self.transform = transform |
211 if not self.transform: | 211 if not self.transform: |
212 self.transform = lambda x: x | 212 self.transform = lambda x: x |
213 | 213 |
214 def getRenderingFor(self, build): | 214 def getRenderingFor(self, build): |
215 ret = build.getProperties().asDict() | 215 ret = build.getProperties().asDict() |
216 # asDict returns key -> (value, source), so get the values, and convert | 216 # asDict returns key -> (value, source), so get the values, and convert |
217 # empty values to blank strings. | 217 # empty values to blank strings. |
218 for k in ret: | 218 for k in ret: |
219 ret[k] = ret[k][0] or '' | 219 ret[k] = ret[k][0] if ret[k][0] is not None else '' |
220 for k, v in self.lambda_subs.iteritems(): | 220 for k, v in self.lambda_subs.iteritems(): |
221 ret[k] = v(build) | 221 ret[k] = v(build) |
222 return self.fmtstring % self.transform(ret) | 222 return self.fmtstring % self.transform(ret) |
223 | 223 |
224 | 224 |
225 class FactoryCommands(object): | 225 class FactoryCommands(object): |
226 # Use this to prevent steps which cannot be run on the same | 226 # Use this to prevent steps which cannot be run on the same |
227 # slave from being done together (in the case where slaves are | 227 # slave from being done together (in the case where slaves are |
228 # shared by multiple builds). | 228 # shared by multiple builds). |
229 slave_exclusive_lock = SlaveLock('slave_exclusive', maxCount=1) | 229 slave_exclusive_lock = SlaveLock('slave_exclusive', maxCount=1) |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1348 | 1348 |
1349 def commandComplete(self, cmd): | 1349 def commandComplete(self, cmd): |
1350 out = cmd.logs['stdio'].getText() | 1350 out = cmd.logs['stdio'].getText() |
1351 build_properties = re.findall('BUILD_PROPERTY ([^=]*)=(.*)', out) | 1351 build_properties = re.findall('BUILD_PROPERTY ([^=]*)=(.*)', out) |
1352 for propname, value in build_properties: | 1352 for propname, value in build_properties: |
1353 # findall can return strings containing CR characters, remove with strip. | 1353 # findall can return strings containing CR characters, remove with strip. |
1354 self.build.setProperty(propname, value.strip(), 'Step') | 1354 self.build.setProperty(propname, value.strip(), 'Step') |
1355 | 1355 |
1356 def getText(self, cmd, results): | 1356 def getText(self, cmd, results): |
1357 return self.describe(True) + self.messages | 1357 return self.describe(True) + self.messages |
OLD | NEW |