Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(831)

Side by Side Diff: scripts/slave/recipe_modules/bot_update/api.py

Issue 475683003: Revert of Re-land r289084 - "Make telemetry*_unittests upload to test-results.appspot.com" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/chromium/__init__.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 5
6 """Recipe module to ensure a checkout is consistant on a bot.""" 6 """Recipe module to ensure a checkout is consistant on a bot."""
7 7
8 8
9 from slave import recipe_api 9 from slave import recipe_api
10 from slave import recipe_util 10 from slave import recipe_util
(...skipping 30 matching lines...) Expand all
41 ret += ']' 41 ret += ']'
42 elif isinstance(spec, basestring): 42 elif isinstance(spec, basestring):
43 ret = repr(str(spec)) 43 ret = repr(str(spec))
44 else: 44 else:
45 ret = repr(spec) 45 ret = repr(spec)
46 return ret 46 return ret
47 47
48 48
49 class BotUpdateApi(recipe_api.RecipeApi): 49 class BotUpdateApi(recipe_api.RecipeApi):
50 50
51 def __init__(self, *args, **kwargs):
52 self._properties = {}
53 super(BotUpdateApi, self).__init__(*args, **kwargs)
54
55 def __call__(self, name, cmd, **kwargs): 51 def __call__(self, name, cmd, **kwargs):
56 """Wrapper for easy calling of bot_update.""" 52 """Wrapper for easy calling of bot_update."""
57 assert isinstance(cmd, (list, tuple)) 53 assert isinstance(cmd, (list, tuple))
58 bot_update_path = self.m.path['build'].join( 54 bot_update_path = self.m.path['build'].join(
59 'scripts', 'slave', 'bot_update.py') 55 'scripts', 'slave', 'bot_update.py')
60 return self.m.python(name, bot_update_path, cmd, **kwargs) 56 return self.m.python(name, bot_update_path, cmd, **kwargs)
61 57
62 @property
63 def properties(self):
64 return self._properties
65
66 def ensure_checkout(self, gclient_config=None, suffix=None, 58 def ensure_checkout(self, gclient_config=None, suffix=None,
67 patch=True, update_presentation=True, 59 patch=True, update_presentation=True,
68 force=False, patch_root=None, no_shallow=False, 60 force=False, patch_root=None, no_shallow=False,
69 **kwargs): 61 **kwargs):
70 # We can re-use the gclient spec from the gclient module, since all the 62 # We can re-use the gclient spec from the gclient module, since all the
71 # data bot_update needs is already configured into the gclient spec. 63 # data bot_update needs is already configured into the gclient spec.
72 cfg = gclient_config or self.m.gclient.c 64 cfg = gclient_config or self.m.gclient.c
73 spec_string = jsonish_to_python(cfg.as_jsonish(), True) 65 spec_string = jsonish_to_python(cfg.as_jsonish(), True)
74 66
75 # Used by bot_update to determine if we want to run or not. 67 # Used by bot_update to determine if we want to run or not.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 name += ' (without patch)' 151 name += ' (without patch)'
160 if suffix: 152 if suffix:
161 name += ' - %s' % suffix 153 name += ' - %s' % suffix
162 154
163 # Ah hah! Now that everything is in place, lets run bot_update! 155 # Ah hah! Now that everything is in place, lets run bot_update!
164 try: 156 try:
165 self(name, cmd, step_test_data=step_test_data, **kwargs) 157 self(name, cmd, step_test_data=step_test_data, **kwargs)
166 finally: 158 finally:
167 step_result = self.m.step.active_result 159 step_result = self.m.step.active_result
168 160
169 self._properties = step_result.json.output.get('properties', {})
170
171 if update_presentation: 161 if update_presentation:
172 # Set properties such as got_revision. 162 # Set properties such as got_revision.
173 for prop_name, prop_value in self.properties.iteritems(): 163 if 'properties' in step_result.json.output:
174 step_result.presentation.properties[prop_name] = prop_value 164 properties = step_result.json.output['properties']
165 for prop_name, prop_value in properties.iteritems():
166 step_result.presentation.properties[prop_name] = prop_value
175 # Add helpful step description in the step UI. 167 # Add helpful step description in the step UI.
176 if 'step_text' in step_result.json.output: 168 if 'step_text' in step_result.json.output:
177 step_text = step_result.json.output['step_text'] 169 step_text = step_result.json.output['step_text']
178 step_result.presentation.step_text = step_text 170 step_result.presentation.step_text = step_text
179 # Add log line output. 171 # Add log line output.
180 if 'log_lines' in step_result.json.output: 172 if 'log_lines' in step_result.json.output:
181 for log_name, log_lines in step_result.json.output['log_lines']: 173 for log_name, log_lines in step_result.json.output['log_lines']:
182 step_result.presentation.logs[log_name] = log_lines.splitlines() 174 step_result.presentation.logs[log_name] = log_lines.splitlines()
183 # Abort the build on failure, if its not a patch failure. 175 # Abort the build on failure, if its not a patch failure.
184 if step_result.presentation.status == self.m.step.FAILURE: 176 if step_result.presentation.status == self.m.step.FAILURE:
(...skipping 17 matching lines...) Expand all
202 step_test_data=self.test_api.patch_error_data) 194 step_test_data=self.test_api.patch_error_data)
203 195
204 # bot_update actually just sets root to be the folder name of the 196 # bot_update actually just sets root to be the folder name of the
205 # first solution. 197 # first solution.
206 if step_result.json.output['did_run']: 198 if step_result.json.output['did_run']:
207 co_root = step_result.json.output['root'] 199 co_root = step_result.json.output['root']
208 cwd = kwargs.get('cwd', self.m.path['slave_build']) 200 cwd = kwargs.get('cwd', self.m.path['slave_build'])
209 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) 201 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep))
210 202
211 return step_result 203 return step_result
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/chromium/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698