| OLD | NEW | 
|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 from recipe_engine import recipe_api | 5 from recipe_engine import recipe_api | 
| 6 | 6 | 
| 7 class GomaApi(recipe_api.RecipeApi): | 7 class GomaApi(recipe_api.RecipeApi): | 
| 8   """GomaApi contains helper functions for using goma.""" | 8   """GomaApi contains helper functions for using goma.""" | 
| 9 | 9 | 
| 10   @property | 10   @property | 
| 11   def service_account_json_path(self): | 11   def service_account_json_path(self): | 
| 12     if self.m.platform.is_win: | 12     if self.m.platform.is_win: | 
| 13       return 'C:\\creds\\service_accounts\\service-account-goma-client.json' | 13       return 'C:\\creds\\service_accounts\\service-account-goma-client.json' | 
| 14     return '/creds/service_accounts/service-account-goma-client.json' | 14     return '/creds/service_accounts/service-account-goma-client.json' | 
| 15 | 15 | 
| 16   def update_goma_canary(self): | 16   def update_goma_canary(self): | 
| 17     """Returns a step for updating goma canary.""" | 17     """Returns a step for updating goma canary.""" | 
| 18     # deprecated? switch to use ensure_goma with canary=True. | 18     # deprecated? switch to use ensure_goma with canary=True. | 
| 19     # for git checkout, should use @refs/heads/master to use head. | 19     # for git checkout, should use @refs/heads/master to use head. | 
| 20     head = 'refs/heads/master' | 20     head = 'refs/heads/master' | 
| 21     # TODO(phajdan.jr): Remove infra_paths['build'] usage, http://crbug.com/4372
    64 . | 21     # TODO(phajdan.jr): Remove path['build'] usage, http://crbug.com/437264 . | 
| 22     self.m.gclient('update goma canary', | 22     self.m.gclient('update goma canary', | 
| 23                    ['sync', '--verbose', '--force', | 23                    ['sync', '--verbose', '--force', | 
| 24                     '--revision', 'build/goma@%s' % head], | 24                     '--revision', 'build/goma@%s' % head], | 
| 25                    cwd=self.m.infra_paths['build']) | 25                    cwd=self.m.path['build']) | 
| 26 | 26 | 
| 27   def ensure_goma(self): | 27   def ensure_goma(self): | 
| 28     with self.m.step.nest('ensure_goma'): | 28     with self.m.step.nest('ensure_goma'): | 
| 29       try: | 29       try: | 
| 30         self.m.cipd.set_service_account_credentials( | 30         self.m.cipd.set_service_account_credentials( | 
| 31             self.service_account_json_path) | 31             self.service_account_json_path) | 
| 32 | 32 | 
| 33         self.m.cipd.install_client() | 33         self.m.cipd.install_client() | 
| 34         goma_package = ('infra_internal/goma/client/%s' % | 34         goma_package = ('infra_internal/goma/client/%s' % | 
| 35             self.m.cipd.platform_suffix()) | 35             self.m.cipd.platform_suffix()) | 
| 36         # For Windows there's only 64-bit goma client. | 36         # For Windows there's only 64-bit goma client. | 
| 37         if self.m.platform.is_win: | 37         if self.m.platform.is_win: | 
| 38           goma_package = goma_package.replace('386', 'amd64') | 38           goma_package = goma_package.replace('386', 'amd64') | 
| 39         goma_dir = self.m.infra_paths['cache'].join('cipd', 'goma') | 39         goma_dir = self.m.path['cache'].join('cipd', 'goma') | 
| 40         self.m.cipd.ensure(goma_dir, {goma_package: 'release'}) | 40         self.m.cipd.ensure(goma_dir, {goma_package: 'release'}) | 
| 41         return goma_dir | 41         return goma_dir | 
| 42       except self.m.step.StepFailure:  # pragma: no cover | 42       except self.m.step.StepFailure:  # pragma: no cover | 
| 43         # TODO(phajdan.jr): make failures fatal after experiment. | 43         # TODO(phajdan.jr): make failures fatal after experiment. | 
| 44         return None | 44         return None | 
| OLD | NEW | 
|---|