OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 import re | 5 import re |
6 | 6 |
7 from slave import recipe_api | 7 from slave import recipe_api |
8 from slave import recipe_util | 8 from slave import recipe_util |
9 | 9 |
10 from . import builders | 10 from . import builders |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 "MAJOR=37\nMINOR=0\nBUILD=2021\nPATCH=0\n"))).stdout | 106 "MAJOR=37\nMINOR=0\nBUILD=2021\nPATCH=0\n"))).stdout |
107 return self.version | 107 return self.version |
108 | 108 |
109 def set_build_properties(self, props): | 109 def set_build_properties(self, props): |
110 self._build_properties = props | 110 self._build_properties = props |
111 | 111 |
112 def add_builders(self, builders): | 112 def add_builders(self, builders): |
113 """Adds builders to our builder map""" | 113 """Adds builders to our builder map""" |
114 self._builders.update(builders) | 114 self._builders.update(builders) |
115 | 115 |
| 116 def configure_bot(self, builders_dict, additional_configs=None): |
| 117 """Sets up the configurations and gclient to be ready for bot update. |
| 118 |
| 119 builders_dict is a dict of mastername -> 'builders' -> buildername -> |
| 120 bot_config. |
| 121 |
| 122 The current mastername and buildername are looked up from the |
| 123 build properties; we then apply the configs specified in bot_config |
| 124 as appropriate. |
| 125 |
| 126 Returns a tuple of (buildername, bot_config) for subsequent use in |
| 127 the recipe. |
| 128 """ |
| 129 additional_configs = additional_configs or [] |
| 130 |
| 131 # TODO: crbug.com/358481 . The build_config should probably be a property |
| 132 # passed in from the slave config, but that doesn't exist today, so we |
| 133 # need a lookup mechanism to map bot name to build_config. |
| 134 mastername = self.m.properties.get('mastername') |
| 135 buildername = self.m.properties.get('buildername') |
| 136 master_dict = builders_dict.get(mastername, {}) |
| 137 bot_config = master_dict.get('builders', {}).get(buildername) |
| 138 |
| 139 self.set_config('chromium', **bot_config.get('chromium_config_kwargs', {})) |
| 140 |
| 141 for c in bot_config.get('chromium_apply_config', []): |
| 142 self.apply_config(c) |
| 143 |
| 144 for c in additional_configs: |
| 145 self.apply_config(c) |
| 146 |
| 147 # Note that we have to call gclient.set_config() and apply_config() *after* |
| 148 # calling chromium.set_config(), above, because otherwise the chromium |
| 149 # call would reset the gclient config to its defaults. |
| 150 self.m.gclient.set_config('chromium') |
| 151 for c in bot_config.get('gclient_apply_config', []): |
| 152 self.m.gclient.apply_config(c) |
| 153 |
| 154 if bot_config.get('set_component_rev'): |
| 155 # If this is a component build and the main revision is e.g. blink, |
| 156 # webrtc, or v8, the custom deps revision of this component must be |
| 157 # dynamically set to either: |
| 158 # (1) 'revision' from the waterfall, or |
| 159 # (2) 'HEAD' for forced builds with unspecified 'revision'. |
| 160 component_rev = self.m.properties.get('revision') or 'HEAD' |
| 161 dep = bot_config.get('set_component_rev') |
| 162 self.m.gclient.c.revisions[dep['name']] = dep['rev_str'] % component_rev |
| 163 |
| 164 if self.m.tryserver.is_tryserver: |
| 165 self.m.step.auto_resolve_conflicts = True |
| 166 |
| 167 return (buildername, bot_config) |
| 168 |
116 def compile(self, targets=None, name=None, | 169 def compile(self, targets=None, name=None, |
117 force_clobber=False, **kwargs): | 170 force_clobber=False, **kwargs): |
118 """Return a compile.py invocation.""" | 171 """Return a compile.py invocation.""" |
119 targets = targets or self.c.compile_py.default_targets.as_jsonish() | 172 targets = targets or self.c.compile_py.default_targets.as_jsonish() |
120 assert isinstance(targets, (list, tuple)) | 173 assert isinstance(targets, (list, tuple)) |
121 | 174 |
122 args = [ | 175 args = [ |
123 '--target', self.c.build_config_fs, | 176 '--target', self.c.build_config_fs, |
124 '--src-dir', self.m.path['checkout'], | 177 '--src-dir', self.m.path['checkout'], |
125 ] | 178 ] |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 def get_compile_targets_for_scripts(self): | 728 def get_compile_targets_for_scripts(self): |
676 return self.m.python( | 729 return self.m.python( |
677 name='get compile targets for scripts', | 730 name='get compile targets for scripts', |
678 script=self.m.path['checkout'].join( | 731 script=self.m.path['checkout'].join( |
679 'testing', 'scripts', 'get_compile_targets.py'), | 732 'testing', 'scripts', 'get_compile_targets.py'), |
680 args=[ | 733 args=[ |
681 '--output', self.m.json.output(), | 734 '--output', self.m.json.output(), |
682 '--', | 735 '--', |
683 ] + self.get_common_args_for_scripts(), | 736 ] + self.get_common_args_for_scripts(), |
684 step_test_data=lambda: self.m.json.test_api.output({})) | 737 step_test_data=lambda: self.m.json.test_api.output({})) |
OLD | NEW |