[cipd] use "cipd" so recipe engine can find .bat on windows.

BUG=697327

Change-Id: Ie220a09f243da08a24520203b622197be27a396b
Reviewed-on: https://chromium-review.googlesource.com/448658
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
changes/58/448658/2
Robert Iannucci 9 years ago committed by Commit Bot
parent 51104fec03
commit 18bce22197

@ -8,24 +8,14 @@ from recipe_engine import recipe_api
class CIPDApi(recipe_api.RecipeApi): class CIPDApi(recipe_api.RecipeApi):
"""CIPDApi provides basic support for CIPD. """CIPDApi provides basic support for CIPD.
This assumes that `cipd` (or `cipd.exe` on windows) has been installed This assumes that `cipd` (or `cipd.exe` or `cipd.bat` on windows) has been
somewhere in $PATH. This will be true if you use depot_tools, or if your installed somewhere in $PATH. This will be true if you use depot_tools, or if
recipe is running inside of chrome-infrastructure's systems (buildbot, your recipe is running inside of chrome-infrastructure's systems (buildbot,
swarming). swarming).
""" """
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(CIPDApi, self).__init__(*args, **kwargs) super(CIPDApi, self).__init__(*args, **kwargs)
self._cipd_credentials = None self._cipd_credentials = None
self._executable = None
def initialize(self):
self._executable = 'cipd'
if self.m.platform.is_win:
self._executable += '.exe'
@property
def executable(self):
return self._executable
def set_service_account_credentials(self, path): def set_service_account_credentials(self, path):
self._cipd_credentials = path self._cipd_credentials = path
@ -59,7 +49,7 @@ class CIPDApi(recipe_api.RecipeApi):
return self.m.step( return self.m.step(
'build %s' % self.m.path.basename(package_name), 'build %s' % self.m.path.basename(package_name),
[ [
self.executable, 'cipd',
'pkg-build', 'pkg-build',
'-in', input_dir, '-in', input_dir,
'-name', package_name, '-name', package_name,
@ -73,7 +63,7 @@ class CIPDApi(recipe_api.RecipeApi):
def register(self, package_name, package_path, refs=None, tags=None): def register(self, package_name, package_path, refs=None, tags=None):
cmd = [ cmd = [
self.executable, 'cipd',
'pkg-register', package_path, 'pkg-register', package_path,
'-json-output', self.m.json.output(), '-json-output', self.m.json.output(),
] ]
@ -97,7 +87,7 @@ class CIPDApi(recipe_api.RecipeApi):
This builds and uploads the package in one step. This builds and uploads the package in one step.
""" """
cmd = [ cmd = [
self.executable, 'cipd',
'create', 'create',
'-pkg-def', pkg_def, '-pkg-def', pkg_def,
'-json-output', self.m.json.output(), '-json-output', self.m.json.output(),
@ -126,7 +116,7 @@ class CIPDApi(recipe_api.RecipeApi):
for name, version in sorted(packages.items())] for name, version in sorted(packages.items())]
ensure_file = self.m.raw_io.input('\n'.join(package_list)) ensure_file = self.m.raw_io.input('\n'.join(package_list))
cmd = [ cmd = [
self.executable, 'cipd',
'ensure', 'ensure',
'-root', root, '-root', root,
'-ensure-file', ensure_file, '-ensure-file', ensure_file,
@ -141,7 +131,7 @@ class CIPDApi(recipe_api.RecipeApi):
def set_tag(self, package_name, version, tags): def set_tag(self, package_name, version, tags):
cmd = [ cmd = [
self.executable, 'cipd',
'set-tag', package_name, 'set-tag', package_name,
'-version', version, '-version', version,
'-json-output', self.m.json.output(), '-json-output', self.m.json.output(),
@ -161,7 +151,7 @@ class CIPDApi(recipe_api.RecipeApi):
def set_ref(self, package_name, version, refs): def set_ref(self, package_name, version, refs):
cmd = [ cmd = [
self.executable, 'cipd',
'set-ref', package_name, 'set-ref', package_name,
'-version', version, '-version', version,
'-json-output', self.m.json.output(), '-json-output', self.m.json.output(),
@ -183,7 +173,7 @@ class CIPDApi(recipe_api.RecipeApi):
assert ':' in tag, 'tag must be in a form "k:v"' assert ':' in tag, 'tag must be in a form "k:v"'
cmd = [ cmd = [
self.executable, 'cipd',
'search', package_name, 'search', package_name,
'-tag', tag, '-tag', tag,
'-json-output', self.m.json.output(), '-json-output', self.m.json.output(),
@ -200,7 +190,7 @@ class CIPDApi(recipe_api.RecipeApi):
def describe(self, package_name, version, def describe(self, package_name, version,
test_data_refs=None, test_data_tags=None): test_data_refs=None, test_data_tags=None):
cmd = [ cmd = [
self.executable, 'cipd',
'describe', package_name, 'describe', package_name,
'-version', version, '-version', version,
'-json-output', self.m.json.output(), '-json-output', self.m.json.output(),

@ -1,7 +1,7 @@
[ [
{ {
"cmd": [ "cmd": [
"cipd.exe", "cipd",
"ensure", "ensure",
"-root", "-root",
"[START_DIR]\\packages", "[START_DIR]\\packages",
@ -27,7 +27,7 @@
}, },
{ {
"cmd": [ "cmd": [
"cipd.exe", "cipd",
"search", "search",
"public/package/windows-amd64", "public/package/windows-amd64",
"-tag", "-tag",
@ -52,7 +52,7 @@
}, },
{ {
"cmd": [ "cmd": [
"cipd.exe", "cipd",
"describe", "describe",
"public/package/windows-amd64", "public/package/windows-amd64",
"-version", "-version",
@ -103,7 +103,7 @@
}, },
{ {
"cmd": [ "cmd": [
"cipd.exe", "cipd",
"ensure", "ensure",
"-root", "-root",
"[START_DIR]\\packages", "[START_DIR]\\packages",
@ -133,7 +133,7 @@
}, },
{ {
"cmd": [ "cmd": [
"cipd.exe", "cipd",
"search", "search",
"private/package/windows-amd64", "private/package/windows-amd64",
"-tag", "-tag",
@ -158,7 +158,7 @@
}, },
{ {
"cmd": [ "cmd": [
"cipd.exe", "cipd",
"describe", "describe",
"private/package/windows-amd64", "private/package/windows-amd64",
"-version", "-version",
@ -204,7 +204,7 @@
}, },
{ {
"cmd": [ "cmd": [
"cipd.exe", "cipd",
"pkg-build", "pkg-build",
"-in", "-in",
"fake-input-dir", "fake-input-dir",
@ -228,7 +228,7 @@
}, },
{ {
"cmd": [ "cmd": [
"cipd.exe", "cipd",
"pkg-build", "pkg-build",
"-in", "-in",
"fake-input-dir", "fake-input-dir",
@ -254,7 +254,7 @@
}, },
{ {
"cmd": [ "cmd": [
"cipd.exe", "cipd",
"pkg-register", "pkg-register",
"fake-package-path", "fake-package-path",
"-json-output", "-json-output",
@ -283,7 +283,7 @@
}, },
{ {
"cmd": [ "cmd": [
"cipd.exe", "cipd",
"create", "create",
"-pkg-def", "-pkg-def",
"[START_DIR]\\fake-package.yaml", "[START_DIR]\\fake-package.yaml",
@ -308,7 +308,7 @@
}, },
{ {
"cmd": [ "cmd": [
"cipd.exe", "cipd",
"set-tag", "set-tag",
"fake-package", "fake-package",
"-version", "-version",
@ -338,7 +338,7 @@
}, },
{ {
"cmd": [ "cmd": [
"cipd.exe", "cipd",
"set-ref", "set-ref",
"fake-package", "fake-package",
"-version", "-version",
@ -368,7 +368,7 @@
}, },
{ {
"cmd": [ "cmd": [
"cipd.exe", "cipd",
"search", "search",
"fake-package/windows-amd64", "fake-package/windows-amd64",
"-tag", "-tag",

Loading…
Cancel
Save