Chromium Code Reviews| Index: scripts/slave/recipe_modules/cipd/api.py |
| diff --git a/scripts/slave/recipe_modules/cipd/api.py b/scripts/slave/recipe_modules/cipd/api.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b1d6fa5f609c2a0e8e5bbc91ab36f6d536873037 |
| --- /dev/null |
| +++ b/scripts/slave/recipe_modules/cipd/api.py |
| @@ -0,0 +1,45 @@ |
| +# Copyright 2015 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +from recipe_engine import recipe_api |
| + |
| +class CIPDApi(recipe_api.RecipeApi): |
| + """CIPDApi provides support for CIPD.""" |
| + CLIENT_VERSIONS = { |
| + 'linux-amd64': '9579504cec0336688292f5b0b68c3ed4e288e273', |
| + } |
| + |
| + def install_client(self, step_name): |
| + self.bin_path = self.m.path['slave_build'].join('cipd/cipd_%s' % self.CLIENT_VERSIONS[self.platform_tag()]) |
|
Vadim Sh.
2015/06/30 23:14:29
80 cols limit, split in two lines
seanmccullough
2015/06/30 23:48:25
Done.
|
| + package = "infra/tools/cipd/%s" % self.platform_tag() |
| + script_input = { |
| + 'package': package, |
| + 'version': self.CLIENT_VERSIONS[self.platform_tag()], |
|
Vadim Sh.
2015/06/30 23:14:29
'bin_path': self.bin_path
and make bootstrap.py i
seanmccullough
2015/06/30 23:48:25
Done.
|
| + } |
| + |
| + self.m.python( |
| + name=step_name, |
| + script=self.resource('bootstrap.py'), |
| + stdin=self.m.json.input(script_input)) |
| + |
| + # TODO(seanmccullough): clean up older CIPD installations. |
| + |
| + def platform_tag(self): |
| + # TODO(seanmccullough): get the arch from env instead of hardcoding it. |
| + return "linux-amd64" |
| + |
| + def ensure_installed(self, root, pkgs): |
| + pkg_list = [] |
| + for pkg_name in pkgs: |
|
Vadim Sh.
2015/06/30 23:14:29
sorted(pkgs)
seanmccullough
2015/06/30 23:48:25
Done.
|
| + pkg_spec = pkgs[pkg_name] |
| + pkg_list.append("%s %s" % (pkg_name, pkg_spec['version'])) |
| + |
| + list_data = self.m.raw_io.input("\n".join(pkg_list)) |
| + |
| + self.m.step( |
| + "ensure_installed", |
| + [self.m.path['slave_build'].join('cipd'), "ensure", |
|
Vadim Sh.
2015/06/30 23:14:29
Use self.bin_path. Check that it's not None. If it
seanmccullough
2015/06/30 23:48:25
Added this, but raising StepFailure in this condit
Vadim Sh.
2015/07/01 00:10:56
Dunno.. Based on this log, no steps were called at
|
| + "--root", root, "--list", list_data], |
| + ) |
| + |