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

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

Issue 288843003: Let bot_update recipe api force usage of bot_update. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 6 years, 7 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 | « scripts/slave/bot_update.py ('k') | scripts/slave/recipe_modules/bot_update/test_api.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 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 def __call__(self, name, cmd, **kwargs): 50 def __call__(self, name, cmd, **kwargs):
51 """Wrapper for easy calling of bot_update.""" 51 """Wrapper for easy calling of bot_update."""
52 assert isinstance(cmd, (list, tuple)) 52 assert isinstance(cmd, (list, tuple))
53 kwargs.setdefault('abort_on_failure', True) 53 kwargs.setdefault('abort_on_failure', True)
54 bot_update_path = self.m.path['build'].join( 54 bot_update_path = self.m.path['build'].join(
55 'scripts', 'slave', 'bot_update.py') 55 'scripts', 'slave', 'bot_update.py')
56 return self.m.python(name, bot_update_path, cmd, **kwargs) 56 return self.m.python(name, bot_update_path, cmd, **kwargs)
57 57
58 def ensure_checkout(self, gclient_config=None, suffix=None, 58 def ensure_checkout(self, gclient_config=None, suffix=None,
59 patch=True, ref=None, update_presentation=True, 59 patch=True, ref=None, update_presentation=True,
60 **kwargs): 60 force=False, **kwargs):
61 # We can re-use the gclient spec from the gclient module, since all the 61 # We can re-use the gclient spec from the gclient module, since all the
62 # data bot_update needs is already configured into the gclient spec. 62 # data bot_update needs is already configured into the gclient spec.
63 cfg = gclient_config or self.m.gclient.c 63 cfg = gclient_config or self.m.gclient.c
64 spec_string = jsonish_to_python(cfg.as_jsonish(), True) 64 spec_string = jsonish_to_python(cfg.as_jsonish(), True)
65 65
66 # Used by bot_update to determine if we want to run or not. 66 # Used by bot_update to determine if we want to run or not.
67 master = self.m.properties['mastername'] 67 master = self.m.properties['mastername']
68 builder = self.m.properties['buildername'] 68 builder = self.m.properties['buildername']
69 slave = self.m.properties['slavename'] 69 slave = self.m.properties['slavename']
70 70
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 ['--patchset', patchset], 111 ['--patchset', patchset],
112 ['--patch_url', patch_url], 112 ['--patch_url', patch_url],
113 113
114 # 4. Hookups to JSON output back into recipes. 114 # 4. Hookups to JSON output back into recipes.
115 ['--output_json', self.m.json.output()],] 115 ['--output_json', self.m.json.output()],]
116 116
117 # Filter out flags that are None. 117 # Filter out flags that are None.
118 cmd = [item for flag_set in flags 118 cmd = [item for flag_set in flags
119 for item in flag_set if flag_set[1] is not None] 119 for item in flag_set if flag_set[1] is not None]
120 120
121 if force: # pragma: no cover
hinoka 2014/05/16 23:33:48 Lets actually add coverage for this, via a fake bu
agable 2014/05/19 16:25:19 Done, PTAL.
122 cmd.append('--force')
123
121 # Inject Json output for testing. 124 # Inject Json output for testing.
122 git_mode = self.m.properties.get('mastername') in GIT_MASTERS 125 git_mode = self.m.properties.get('mastername') in GIT_MASTERS
123 first_sln = cfg.solutions[0].name 126 first_sln = cfg.solutions[0].name
124 step_test_data = lambda: self.test_api.output_json( 127 step_test_data = lambda: self.test_api.output_json(
125 master, builder, slave, root, first_sln, rev_map, git_mode) 128 master, builder, slave, root, first_sln, rev_map, git_mode)
126 129
127 def followup_fn(step_result): 130 def followup_fn(step_result):
128 if update_presentation: 131 if update_presentation:
129 # Set properties such as got_revision. 132 # Set properties such as got_revision.
130 if 'properties' in step_result.json.output: 133 if 'properties' in step_result.json.output:
(...skipping 19 matching lines...) Expand all
150 # Set the "checkout" path for the main solution. 153 # Set the "checkout" path for the main solution.
151 # This is used by the Chromium module to figure out where to look for 154 # This is used by the Chromium module to figure out where to look for
152 # the checkout. 155 # the checkout.
153 bot_update_step = self.m.step_history.last_step() 156 bot_update_step = self.m.step_history.last_step()
154 # bot_update actually just sets root to be the folder name of the 157 # bot_update actually just sets root to be the folder name of the
155 # first solution. 158 # first solution.
156 if bot_update_step.json.output['did_run']: 159 if bot_update_step.json.output['did_run']:
157 co_root = bot_update_step.json.output['root'] 160 co_root = bot_update_step.json.output['root']
158 cwd = kwargs.get('cwd', self.m.path['slave_build']) 161 cwd = kwargs.get('cwd', self.m.path['slave_build'])
159 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) 162 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep))
OLDNEW
« no previous file with comments | « scripts/slave/bot_update.py ('k') | scripts/slave/recipe_modules/bot_update/test_api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698