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

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: Rebase 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/example.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 revisions=[], 60 revisions=[], force=False, **kwargs):
61 **kwargs):
62 # 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
63 # data bot_update needs is already configured into the gclient spec. 62 # data bot_update needs is already configured into the gclient spec.
64 cfg = gclient_config or self.m.gclient.c 63 cfg = gclient_config or self.m.gclient.c
65 spec_string = jsonish_to_python(cfg.as_jsonish(), True) 64 spec_string = jsonish_to_python(cfg.as_jsonish(), True)
66 65
67 # 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.
68 master = self.m.properties['mastername'] 67 master = self.m.properties['mastername']
69 builder = self.m.properties['buildername'] 68 builder = self.m.properties['buildername']
70 slave = self.m.properties['slavename'] 69 slave = self.m.properties['slavename']
71 70
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 ['--patchset', patchset], 111 ['--patchset', patchset],
113 ['--patch_url', patch_url], 112 ['--patch_url', patch_url],
114 113
115 # 4. Hookups to JSON output back into recipes. 114 # 4. Hookups to JSON output back into recipes.
116 ['--output_json', self.m.json.output()],] 115 ['--output_json', self.m.json.output()],]
117 116
118 # Filter out flags that are None. 117 # Filter out flags that are None.
119 cmd = [item for flag_set in flags 118 cmd = [item for flag_set in flags
120 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]
121 120
121 if force:
122 cmd.append('--force')
123
122 # Inject Json output for testing. 124 # Inject Json output for testing.
123 git_mode = self.m.properties.get('mastername') in GIT_MASTERS 125 git_mode = self.m.properties.get('mastername') in GIT_MASTERS
124 first_sln = cfg.solutions[0].name 126 first_sln = cfg.solutions[0].name
125 step_test_data = lambda: self.test_api.output_json( 127 step_test_data = lambda: self.test_api.output_json(
126 master, builder, slave, root, first_sln, rev_map, git_mode) 128 master, builder, slave, root, first_sln, rev_map, git_mode, force)
127 129
128 def followup_fn(step_result): 130 def followup_fn(step_result):
129 if update_presentation: 131 if update_presentation:
130 # Set properties such as got_revision. 132 # Set properties such as got_revision.
131 if 'properties' in step_result.json.output: 133 if 'properties' in step_result.json.output:
132 properties = step_result.json.output['properties'] 134 properties = step_result.json.output['properties']
133 for prop_name, prop_value in properties.iteritems(): 135 for prop_name, prop_value in properties.iteritems():
134 step_result.presentation.properties[prop_name] = prop_value 136 step_result.presentation.properties[prop_name] = prop_value
135 # Add helpful step description in the step UI. 137 # Add helpful step description in the step UI.
136 if 'step_text' in step_result.json.output: 138 if 'step_text' in step_result.json.output:
(...skipping 14 matching lines...) Expand all
151 # Set the "checkout" path for the main solution. 153 # Set the "checkout" path for the main solution.
152 # 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
153 # the checkout. 155 # the checkout.
154 bot_update_step = self.m.step_history.last_step() 156 bot_update_step = self.m.step_history.last_step()
155 # 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
156 # first solution. 158 # first solution.
157 if bot_update_step.json.output['did_run']: 159 if bot_update_step.json.output['did_run']:
158 co_root = bot_update_step.json.output['root'] 160 co_root = bot_update_step.json.output['root']
159 cwd = kwargs.get('cwd', self.m.path['slave_build']) 161 cwd = kwargs.get('cwd', self.m.path['slave_build'])
160 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/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698