| 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 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 command=cmd) | 928 command=cmd) |
| 929 | 929 |
| 930 def AddBotUpdateStep(self, env, gclient_specs, revision_mapping, server=None): | 930 def AddBotUpdateStep(self, env, gclient_specs, revision_mapping, server=None): |
| 931 """Add a step to force checkout to some state. | 931 """Add a step to force checkout to some state. |
| 932 | 932 |
| 933 This is meant to replace all gclient revert/sync steps. | 933 This is meant to replace all gclient revert/sync steps. |
| 934 """ | 934 """ |
| 935 cmd = ['python', self._bot_update_tool, '--specs', gclient_specs] | 935 cmd = ['python', self._bot_update_tool, '--specs', gclient_specs] |
| 936 | 936 |
| 937 PROPERTIES = { | 937 PROPERTIES = { |
| 938 'root': '%(root:~src)s', | 938 'root': '%(root:-)s', |
| 939 'issue': '%(issue:-)s', | 939 'issue': '%(issue:-)s', |
| 940 'patchset': '%(patchset:-)s', | 940 'patchset': '%(patchset:-)s', |
| 941 'master': '%(mastername:-)s' | 941 'master': '%(mastername:-)s', |
| 942 'revision': '%(revision:-)s', |
| 943 'patch_url': '%(patch_url:-)s' |
| 942 } | 944 } |
| 943 | 945 |
| 944 for property_name, property_expr in PROPERTIES.iteritems(): | 946 for property_name, property_expr in PROPERTIES.iteritems(): |
| 945 property_value = WithProperties(property_expr) | 947 property_value = WithProperties(property_expr) |
| 946 if property_value: | 948 if property_value: |
| 947 cmd.extend(['--%s' % property_name, property_value]) | 949 cmd.extend(['--%s' % property_name, property_value]) |
| 948 | 950 |
| 949 if server: | 951 if server: |
| 950 cmd.extend(['--server', server]) | 952 cmd.extend(['--rietveld_server', server]) |
| 951 | 953 |
| 952 if revision_mapping: | 954 if revision_mapping: |
| 953 cmd.extend(['--revision-mapping=%s' % json.dumps(revision_mapping)]) | 955 cmd.extend(['--revision-mapping=%s' % json.dumps(revision_mapping)]) |
| 954 | 956 |
| 955 self._factory.addStep( | 957 self._factory.addStep( |
| 956 chromium_step.AnnotatedCommand, | 958 chromium_step.AnnotatedCommand, |
| 957 name='bot update', | 959 name='bot update', |
| 958 haltOnFailure=True, | 960 haltOnFailure=True, |
| 959 flunkOnFailure=True, | 961 flunkOnFailure=True, |
| 960 timeout=600, | 962 timeout=600, |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 | 1297 |
| 1296 def commandComplete(self, cmd): | 1298 def commandComplete(self, cmd): |
| 1297 out = cmd.logs['stdio'].getText() | 1299 out = cmd.logs['stdio'].getText() |
| 1298 build_properties = re.findall('BUILD_PROPERTY ([^=]*)=(.*)', out) | 1300 build_properties = re.findall('BUILD_PROPERTY ([^=]*)=(.*)', out) |
| 1299 for propname, value in build_properties: | 1301 for propname, value in build_properties: |
| 1300 # findall can return strings containing CR characters, remove with strip. | 1302 # findall can return strings containing CR characters, remove with strip. |
| 1301 self.build.setProperty(propname, value.strip(), 'Step') | 1303 self.build.setProperty(propname, value.strip(), 'Step') |
| 1302 | 1304 |
| 1303 def getText(self, cmd, results): | 1305 def getText(self, cmd, results): |
| 1304 return self.describe(True) + self.messages | 1306 return self.describe(True) + self.messages |
| OLD | NEW |