| 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 cgi | 5 import cgi |
| 6 import re | 6 import re |
| 7 | 7 |
| 8 from recipe_engine import recipe_api | 8 from recipe_engine import recipe_api |
| 9 | 9 |
| 10 | 10 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 self.cros_sdk('setup board', | 252 self.cros_sdk('setup board', |
| 253 ['./setup_board', '--board', board], | 253 ['./setup_board', '--board', board], |
| 254 args, **kwargs) | 254 args, **kwargs) |
| 255 | 255 |
| 256 def build_packages(self, board, args=None, **kwargs): | 256 def build_packages(self, board, args=None, **kwargs): |
| 257 """Run the build_packages script inside the chroot.""" | 257 """Run the build_packages script inside the chroot.""" |
| 258 self.cros_sdk('build packages', | 258 self.cros_sdk('build packages', |
| 259 ['./build_packages', '--board', board], | 259 ['./build_packages', '--board', board], |
| 260 args, **kwargs) | 260 args, **kwargs) |
| 261 | 261 |
| 262 def configure(self, properties, config_map): | 262 def configure(self, properties, config_map, **KWARGS): |
| 263 """Loads configuration from build properties into this recipe config. | 263 """Loads configuration from build properties into this recipe config. |
| 264 | 264 |
| 265 Args: | 265 Args: |
| 266 properties (Properties): The build properties object. | 266 properties (Properties): The build properties object. |
| 267 config_map (dict): The configuration map to use. | 267 config_map (dict): The configuration map to use. |
| 268 KWARGS: Additional keyword arguments to forward to the configuration. |
| 268 """ | 269 """ |
| 269 master = properties['mastername'] | 270 master = properties['mastername'] |
| 270 variant = properties.get('cbb_variant') | 271 variant = properties.get('cbb_variant') |
| 271 | 272 |
| 272 # Set the master's base configuration. | 273 # Set the master's base configuration. |
| 273 config_map = config_map.get(master, {}) | 274 config_map = config_map.get(master, {}) |
| 274 master_config = config_map.get('master_config') | 275 master_config = config_map.get('master_config') |
| 275 assert master_config, ( | 276 assert master_config, ( |
| 276 "No 'master_config' configuration for '%s'" % (master,)) | 277 "No 'master_config' configuration for '%s'" % (master,)) |
| 277 self.set_config(master_config) | 278 self.set_config(master_config, **KWARGS) |
| 278 | 279 |
| 279 # If we have any specialized build type configurations for this master, | 280 # If we have any specialized build type configurations for this master, |
| 280 # load them. | 281 # load them. |
| 281 self.c.build_type_configs = config_map.get('build_type_configs', {}) | 282 self.c.build_type_configs = config_map.get('build_type_configs', {}) |
| 282 | 283 |
| 283 # Apply any variant configurations. | 284 # Apply any variant configurations. |
| 284 # TODO(dnj): Deprecate variants in favor of build types once all recipes | 285 # TODO(dnj): Deprecate variants in favor of build types once all recipes |
| 285 # using them have moved off of them. | 286 # using them have moved off of them. |
| 286 if variant: | 287 if variant: |
| 287 for config_name in config_map.get('variants', {}).get(variant, ()): | 288 for config_name in config_map.get('variants', {}).get(variant, ()): |
| 288 self.apply_config(config_name) | 289 self.apply_config(config_name) |
| 289 | 290 |
| 290 | 291 |
| 291 def run_cbuildbot(self, args=[]): | 292 def run_cbuildbot(self): |
| 292 """Performs a Chromite repository checkout, then runs cbuildbot. | 293 """Performs a Chromite repository checkout, then runs cbuildbot. |
| 293 | |
| 294 Args: | |
| 295 args (list): Additional arguments to pass to `cbuildbot` invocation. | |
| 296 """ | 294 """ |
| 297 self.checkout_chromite() | 295 self.checkout_chromite() |
| 298 self.run(args=args) | 296 self.run() |
| 299 | 297 |
| 300 def checkout_chromite(self): | 298 def checkout_chromite(self): |
| 301 """Checks out the configured Chromite branch. | 299 """Checks out the configured Chromite branch. |
| 302 """ | 300 """ |
| 303 self.m.bot_update.ensure_checkout( | 301 self.m.bot_update.ensure_checkout( |
| 304 gclient_config=self.gclient_config(), | 302 gclient_config=self.gclient_config(), |
| 305 update_presentation=False) | 303 update_presentation=False) |
| 306 | 304 |
| 307 if self.c.chromite_branch and self.c.cbb.disable_bootstrap: | 305 if self.c.chromite_branch and self.c.cbb.disable_bootstrap: |
| 308 # Chromite auto-detects which branch to build for based on its current | 306 # Chromite auto-detects which branch to build for based on its current |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 if self.c.cbb.git_cache_dir: | 422 if self.c.cbb.git_cache_dir: |
| 425 cbb_args.extend(['--git-cache-dir', self.c.cbb.git_cache_dir]) | 423 cbb_args.extend(['--git-cache-dir', self.c.cbb.git_cache_dir]) |
| 426 elif self.c.repo_cache_dir and self.c.cbb.supports_repo_cache: | 424 elif self.c.repo_cache_dir and self.c.cbb.supports_repo_cache: |
| 427 cbb_args.extend(['--repo-cache', self.c.repo_cache_dir]) | 425 cbb_args.extend(['--repo-cache', self.c.repo_cache_dir]) |
| 428 | 426 |
| 429 # Set the build ID, if specified. | 427 # Set the build ID, if specified. |
| 430 if self.c.cbb.build_id: | 428 if self.c.cbb.build_id: |
| 431 cbb_args.extend(['--master-build-id', self.c.cbb.build_id]) | 429 cbb_args.extend(['--master-build-id', self.c.cbb.build_id]) |
| 432 | 430 |
| 433 # Add custom args, if there are any. | 431 # Add custom args, if there are any. |
| 434 cbb_args.extend(args) | 432 cbb_args.extend(self.c.cbb.extra_args) |
| 435 | 433 |
| 436 # Run cbuildbot. | 434 # Run cbuildbot. |
| 437 return self.cbuildbot(str('cbuildbot [%s]' % (self.c.cbb.config,)), | 435 return self.cbuildbot(str('cbuildbot [%s]' % (self.c.cbb.config,)), |
| 438 self.c.cbb.config, | 436 self.c.cbb.config, |
| 439 args=cbb_args, | 437 args=cbb_args, |
| 440 cwd=self.m.path['slave_build']) | 438 cwd=self.m.path['slave_build']) |
| OLD | NEW |