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

Side by Side Diff: scripts/slave/recipe_modules/cipd/api.py

Issue 1193813004: cipd recipe_module (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: removed ensure.py, unused gce-specific code Created 5 years, 5 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
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 from recipe_engine import recipe_api
6
7 class CIPDApi(recipe_api.RecipeApi):
8 """CIPDApi provides support for CIPD."""
9 CLIENT_VERSIONS = {
10 'linux-amd64': '9579504cec0336688292f5b0b68c3ed4e288e273',
11 }
12
13 def install_client(self, step_name):
14 self.bin_path = self.m.path['slave_build'].join('cipd/cipd_%s' % self.CLIENT _VERSIONS[self.platform_tag()])
Vadim Sh. 2015/06/30 17:58:35 nit: 80 cols
15 package = "infra/tools/cipd/%s" % self.platform_tag()
16 script_input = {
17 'package': package,
18 'version': self.CLIENT_VERSIONS[self.platform_tag()],
19 }
20
21 self.m.python(
22 name=step_name,
23 script=self.resource('bootstrap.py'),
24 stdin=self.m.json.input(script_input))
25
26 # TODO(seanmccullough): clean up older CIPD installations.
27
28 def platform_tag(self):
29 # TODO(seanmccullough): get the arch from env instead of hardcoding it.
30 return "linux-amd64"
Vadim Sh. 2015/06/30 17:58:35 nit: use " or ' consistently. Now some strings are
31
32 def ensure_installed(self, root):
33 pkg_list = []
34 for pkg_name in sorted(self.c.packages):
35 pkg_spec = self.c.packages[pkg_name]
36 pkg_list.append("%s %s" % (pkg_name, pkg_spec['version']))
37
38 list_data = self.m.raw_io.input("\n".join(pkg_list))
39
40 self.m.step(
41 "ensure_installed",
42 [self.m.path['slave_build'].join('cipd'), "ensure",
Vadim Sh. 2015/06/30 17:58:35 the binary is cipd/cipd_<version>
43 "--root", root, "--list", list_data],
44 )
45
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698