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

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: coverage -> 100% 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 def __init__(self, *args, **kwargs):
10 super(CIPDApi, self).__init__(*args, **kwargs)
11 self.bin_path = None
12
13 def install_client(self, step_name):
14 bin_path = self.m.path['slave_build'].join('cipd')
15 script_input = {
16 'platform': self.platform_tag(),
17 'bin_path': bin_path,
18 }
19
20 self.m.python(
21 name=step_name,
22 script=self.resource('bootstrap.py'),
23 stdin=self.m.json.input(script_input))
24
25 # TODO(seanmccullough): clean up older CIPD installations.
26
27 def platform_tag(self):
28 # TODO(seanmccullough): get the arch from env instead of hardcoding it.
29 return "linux-amd64"
30
31 def ensure_installed(self, root, pkgs):
32 pkg_list = []
33 for pkg_name in sorted(pkgs):
34 pkg_spec = pkgs[pkg_name]
35 pkg_list.append("%s %s" % (pkg_name, pkg_spec['version']))
36
37 list_data = self.m.raw_io.input("\n".join(pkg_list))
38 bin_path = self.m.path['slave_build'].join('cipd')
39 self.m.step(
40 "ensure_installed",
41 [bin_path.join('cipd'), "ensure",
42 "--root", root, "--list", list_data],
43 )
44
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/cipd/__init__.py ('k') | scripts/slave/recipe_modules/cipd/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698