Remove recipes
These are no longer being used as all the recipes were consolidated
into https://fuchsia.googlesource.com/infra/recipes/
Change-Id: I993a4e50c8ce72476d9d0310cbe13fdcb810ffed
diff --git a/infra/config/recipes.cfg b/infra/config/recipes.cfg
deleted file mode 100644
index db465f8..0000000
--- a/infra/config/recipes.cfg
+++ /dev/null
@@ -1,9 +0,0 @@
-api_version: 1
-project_id: "infra"
-recipes_path: ""
-deps {
- project_id: "recipe_engine"
- url: "https://chromium.googlesource.com/external/github.com/luci/recipes-py.git"
- branch: "master"
- revision: "0e4d4e97edb04696b0b1452522eb26f1dc633e8e"
-}
diff --git a/recipe_modules/cipd/__init__.py b/recipe_modules/cipd/__init__.py
deleted file mode 100644
index c4760bc..0000000
--- a/recipe_modules/cipd/__init__.py
+++ /dev/null
@@ -1,9 +0,0 @@
-DEPS = [
- 'recipe_engine/json',
- 'recipe_engine/path',
- 'recipe_engine/platform',
- 'recipe_engine/properties',
- 'recipe_engine/python',
- 'recipe_engine/raw_io',
- 'recipe_engine/step',
-]
diff --git a/recipe_modules/cipd/api.py b/recipe_modules/cipd/api.py
deleted file mode 100644
index 32984a9..0000000
--- a/recipe_modules/cipd/api.py
+++ /dev/null
@@ -1,201 +0,0 @@
-# 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
-from string import Template
-
-
-class CIPDApi(recipe_api.RecipeApi):
- """CIPDApi provides support for CIPD."""
-
- def __init__(self, *args, **kwargs):
- super(CIPDApi, self).__init__(*args, **kwargs)
- self._cipd_credentials = None
-
- def set_service_account_credentials(self, path):
- self._cipd_credentials = path
-
- @property
- def default_bot_service_account_credentials(self):
- return '/creds/service_accounts/service-account-cipd-builder.json'
-
- def platform_suffix(self):
- """Use to get full package name that is platform indepdent.
-
- Example:
- >>> 'my/package/%s' % api.cipd.platform_suffix()
- 'my/package/linux-amd64'
- """
- return '%s-%s' % (
- self.m.platform.name.replace('win', 'windows'),
- {
- 32: '386',
- 64: 'amd64',
- }[self.m.platform.bits],
- )
-
- def build(self, input_dir, output_package, package_name, install_mode=None):
- assert not install_mode or install_mode in ['copy', 'symlink']
-
- return self.m.step(
- 'build %s' % self.m.path.basename(package_name),
- [
- 'cipd',
- 'pkg-build',
- '--in', input_dir,
- '--name', package_name,
- '--out', output_package,
- '--json-output', self.m.json.output(),
- ] + (
- ['--install-mode', install_mode] if install_mode else []
- ),
- step_test_data=lambda: self.test_api.example_build(package_name)
- )
-
- def register(self, package_name, package_path, refs=None, tags=None):
- cmd = [
- 'cipd',
- 'pkg-register', package_path,
- '--json-output', self.m.json.output(),
- ]
- if self._cipd_credentials:
- cmd.extend(['--service-account-json', self._cipd_credentials])
- if refs:
- for ref in refs:
- cmd.extend(['--ref', ref])
- if tags:
- for tag, value in sorted(tags.items()):
- cmd.extend(['--tag', '%s:%s' % (tag, value)])
- return self.m.step(
- 'register %s' % package_name,
- cmd,
- step_test_data=lambda: self.test_api.example_register(package_name)
- )
-
- def create(self, pkg_def, refs=None, tags=None):
- """Creates a package based on YAML package definition file.
-
- This builds and uploads the package in one step.
- """
- cmd = [
- 'cipd'
- 'create',
- '--pkg-def', pkg_def,
- '--json-output', self.m.json.output(),
- ]
- if self._cipd_credentials:
- cmd.extend(['--service-account-json', self._cipd_credentials])
- if refs:
- for ref in refs:
- cmd.extend(['--ref', ref])
- if tags:
- for tag, value in sorted(tags.items()):
- cmd.extend(['--tag', '%s:%s' % (tag, value)])
- return self.m.step('create %s' % self.m.path.basename(pkg_def), cmd)
-
- def ensure(self, root, packages):
- """Ensures that packages are installed in a given root dir.
-
- packages must be a mapping from package name to its version, where
- * name must be for right platform (see also ``platform_suffix``),
- * version could be either instance_id, or ref, or unique tag.
-
- If installing a package requires credentials, call
- ``set_service_account_credentials`` before calling this function.
- """
- package_list = ['%s %s' % (name, version)
- for name, version in sorted(packages.items())]
- list_data = self.m.raw_io.input('\n'.join(package_list))
- cmd = [
- 'cipd',
- 'ensure',
- '--root', root,
- '--list', list_data,
- '--json-output', self.m.json.output(),
- ]
- if self._cipd_credentials:
- cmd.extend(['--service-account-json', self._cipd_credentials])
- return self.m.step(
- 'ensure_installed', cmd,
- step_test_data=lambda: self.test_api.example_ensure(packages)
- )
-
- def set_tag(self, package_name, version, tags):
- cmd = [
- 'cipd',
- 'set-tag', package_name,
- '--version', version,
- '--json-output', self.m.json.output(),
- ]
- if self._cipd_credentials:
- cmd.extend(['--service-account-json', self._cipd_credentials])
- for tag, value in sorted(tags.items()):
- cmd.extend(['--tag', '%s:%s' % (tag, value)])
-
- return self.m.step(
- 'cipd set-tag %s' % package_name,
- cmd,
- step_test_data=lambda: self.test_api.example_set_tag(
- package_name, version
- )
- )
-
- def set_ref(self, package_name, version, refs):
- cmd = [
- 'cipd',
- 'set-ref', package_name,
- '--version', version,
- '--json-output', self.m.json.output(),
- ]
- if self._cipd_credentials:
- cmd.extend(['--service-account-json', self._cipd_credentials])
- for r in refs:
- cmd.extend(['--ref', r])
-
- return self.m.step(
- 'cipd set-ref %s' % package_name,
- cmd,
- step_test_data=lambda: self.test_api.example_set_ref(
- package_name, version
- )
- )
-
- def search(self, package_name, tag):
- assert ':' in tag, 'tag must be in a form "k:v"'
-
- cmd = [
- 'cipd',
- 'search', package_name,
- '--tag', tag,
- '--json-output', self.m.json.output(),
- ]
- if self._cipd_credentials:
- cmd.extend(['--service-account-json', self._cipd_credentials])
-
- return self.m.step(
- 'cipd search %s %s' % (package_name, tag),
- cmd,
- step_test_data=lambda: self.test_api.example_search(package_name)
- )
-
- def describe(self, package_name, version,
- test_data_refs=None, test_data_tags=None):
- cmd = [
- 'cipd',
- 'describe', package_name,
- '--version', version,
- '--json-output', self.m.json.output(),
- ]
- if self._cipd_credentials:
- cmd.extend(['--service-account-json', self._cipd_credentials])
-
- return self.m.step(
- 'cipd describe %s' % package_name,
- cmd,
- step_test_data=lambda: self.test_api.example_describe(
- package_name, version,
- test_data_refs=test_data_refs,
- test_data_tags=test_data_tags
- )
- )
diff --git a/recipe_modules/cipd/example.expected/basic.json b/recipe_modules/cipd/example.expected/basic.json
deleted file mode 100644
index 6e5a168..0000000
--- a/recipe_modules/cipd/example.expected/basic.json
+++ /dev/null
@@ -1,398 +0,0 @@
-[
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/packages",
- "--list",
- "public/package/linux-amd64 7f751b2237df2fdf3c1405be00590fefffbaea2d",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-cipd-builder.json"
- ],
- "name": "ensure_installed",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"7f751b2237df2fdf3c1405be00590fefffbaea2d\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "search",
- "public/package/linux-amd64",
- "--tag",
- "git_revision:40-chars-long-hash",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-cipd-builder.json"
- ],
- "name": "cipd search public/package/linux-amd64 git_revision:40-chars-long-hash",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "describe",
- "public/package/linux-amd64",
- "--version",
- "40-chars-fake-of-the-package-instance_id",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-cipd-builder.json"
- ],
- "name": "cipd describe public/package/linux-amd64",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"pin\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"refs\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"modified_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"modified_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"ref\": \"latest\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ], @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tags\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"buildbot_build:some.waterfall/builder/1234\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"git_repository:https://chromium.googlesource.com/some/repo\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"git_revision:397a2597cdc237f3026e6143b683be4b9ab60540\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/packages",
- "--list",
- "private/package/linux-amd64 latest\npublic/package/linux-amd64 7f751b2237df2fdf3c1405be00590fefffbaea2d",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json"
- ],
- "name": "ensure_installed (2)",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"private/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"7f751b2237df2fdf3c1405be00590fefffbaea2d\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "search",
- "private/package/linux-amd64",
- "--tag",
- "key:value",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json"
- ],
- "name": "cipd search private/package/linux-amd64 key:value",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"private/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "describe",
- "private/package/linux-amd64",
- "--version",
- "40-chars-fake-of-the-package-instance_id",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json"
- ],
- "name": "cipd describe private/package/linux-amd64",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"pin\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"private/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"refs\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"modified_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"modified_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"ref\": \"latest\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ], @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tags\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"custom:tagged\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"key:value\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "pkg-build",
- "--in",
- "fake-input-dir",
- "--name",
- "infra/fake-package",
- "--out",
- "fake-package-path",
- "--json-output",
- "/path/to/tmp/json"
- ],
- "name": "build fake-package",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "pkg-build",
- "--in",
- "fake-input-dir",
- "--name",
- "infra/fake-package",
- "--out",
- "fake-package-path",
- "--json-output",
- "/path/to/tmp/json",
- "--install-mode",
- "copy"
- ],
- "name": "build fake-package (2)",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "pkg-register",
- "fake-package-path",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json",
- "--ref",
- "fake-ref-1",
- "--ref",
- "fake-ref-2",
- "--tag",
- "fake_tag_1:fake_value_1",
- "--tag",
- "fake_tag_2:fake_value_2"
- ],
- "name": "register infra/fake-package",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipdcreate",
- "--pkg-def",
- "[START_DIR]/fake-package.yaml",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json",
- "--ref",
- "fake-ref-1",
- "--ref",
- "fake-ref-2",
- "--tag",
- "fake_tag_1:fake_value_1",
- "--tag",
- "fake_tag_2:fake_value_2"
- ],
- "name": "create fake-package.yaml",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output (invalid)@null@@@",
- "@@@STEP_LOG_END@json.output (invalid)@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "set-tag",
- "fake-package",
- "--version",
- "long/weird/ref/which/doesn/not/fit/into/40chars",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json",
- "--tag",
- "dead:beaf",
- "--tag",
- "more:value"
- ],
- "name": "cipd set-tag fake-package",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"pin\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-long/weird/ref/w\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "set-ref",
- "fake-package",
- "--version",
- "latest",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json",
- "--ref",
- "any",
- "--ref",
- "some"
- ],
- "name": "cipd set-ref fake-package",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"pin\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "search",
- "fake-package/linux-amd64",
- "--tag",
- "dead:beaf",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json"
- ],
- "name": "cipd search fake-package/linux-amd64 dead:beaf",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "name": "$result",
- "recipe_result": null,
- "status_code": 0
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/cipd/example.expected/describe-failed.json b/recipe_modules/cipd/example.expected/describe-failed.json
deleted file mode 100644
index 8a7a572..0000000
--- a/recipe_modules/cipd/example.expected/describe-failed.json
+++ /dev/null
@@ -1,82 +0,0 @@
-[
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/packages",
- "--list",
- "public/package/linux-amd64 7f751b2237df2fdf3c1405be00590fefffbaea2d",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-cipd-builder.json"
- ],
- "name": "ensure_installed",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"7f751b2237df2fdf3c1405be00590fefffbaea2d\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "search",
- "public/package/linux-amd64",
- "--tag",
- "git_revision:40-chars-long-hash",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-cipd-builder.json"
- ],
- "name": "cipd search public/package/linux-amd64 git_revision:40-chars-long-hash",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "describe",
- "public/package/linux-amd64",
- "--version",
- "40-chars-fake-of-the-package-instance_id",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-cipd-builder.json"
- ],
- "name": "cipd describe public/package/linux-amd64",
- "~followup_annotations": [
- "step returned non-zero exit code: 1",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"error\": \"package \\\"public/package/linux-amd64-ubuntu14_04\\\" not registered\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": null@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@",
- "@@@STEP_FAILURE@@@"
- ]
- },
- {
- "name": "$result",
- "reason": "Step('cipd describe public/package/linux-amd64') failed with return_code 1",
- "recipe_result": null,
- "status_code": 1
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/cipd/example.expected/describe-many-instances.json b/recipe_modules/cipd/example.expected/describe-many-instances.json
deleted file mode 100644
index ada18f2..0000000
--- a/recipe_modules/cipd/example.expected/describe-many-instances.json
+++ /dev/null
@@ -1,406 +0,0 @@
-[
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/packages",
- "--list",
- "public/package/linux-amd64 7f751b2237df2fdf3c1405be00590fefffbaea2d",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-cipd-builder.json"
- ],
- "name": "ensure_installed",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"7f751b2237df2fdf3c1405be00590fefffbaea2d\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "search",
- "public/package/linux-amd64",
- "--tag",
- "git_revision:40-chars-long-hash",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-cipd-builder.json"
- ],
- "name": "cipd search public/package/linux-amd64 git_revision:40-chars-long-hash",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "describe",
- "public/package/linux-amd64",
- "--version",
- "40-chars-fake-of-the-package-instance_id",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-cipd-builder.json"
- ],
- "name": "cipd describe public/package/linux-amd64",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"pin\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"refs\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"modified_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"modified_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"ref\": \"latest\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ], @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tags\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"buildbot_build:some.waterfall/builder/1234\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"git_repository:https://chromium.googlesource.com/some/repo\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"git_revision:397a2597cdc237f3026e6143b683be4b9ab60540\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/packages",
- "--list",
- "private/package/linux-amd64 latest\npublic/package/linux-amd64 7f751b2237df2fdf3c1405be00590fefffbaea2d",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json"
- ],
- "name": "ensure_installed (2)",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"private/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"7f751b2237df2fdf3c1405be00590fefffbaea2d\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "search",
- "private/package/linux-amd64",
- "--tag",
- "key:value",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json"
- ],
- "name": "cipd search private/package/linux-amd64 key:value",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"private/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "describe",
- "private/package/linux-amd64",
- "--version",
- "40-chars-fake-of-the-package-instance_id",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json"
- ],
- "name": "cipd describe private/package/linux-amd64",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"pin\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"private/package/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"refs\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"modified_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"modified_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"ref\": \"latest\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ], @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tags\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"custom:tagged\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"key:value\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "pkg-build",
- "--in",
- "fake-input-dir",
- "--name",
- "infra/fake-package",
- "--out",
- "fake-package-path",
- "--json-output",
- "/path/to/tmp/json"
- ],
- "name": "build fake-package",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "pkg-build",
- "--in",
- "fake-input-dir",
- "--name",
- "infra/fake-package",
- "--out",
- "fake-package-path",
- "--json-output",
- "/path/to/tmp/json",
- "--install-mode",
- "copy"
- ],
- "name": "build fake-package (2)",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "pkg-register",
- "fake-package-path",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json",
- "--ref",
- "fake-ref-1",
- "--ref",
- "fake-ref-2",
- "--tag",
- "fake_tag_1:fake_value_1",
- "--tag",
- "fake_tag_2:fake_value_2"
- ],
- "name": "register infra/fake-package",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipdcreate",
- "--pkg-def",
- "[START_DIR]/fake-package.yaml",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json",
- "--ref",
- "fake-ref-1",
- "--ref",
- "fake-ref-2",
- "--tag",
- "fake_tag_1:fake_value_1",
- "--tag",
- "fake_tag_2:fake_value_2"
- ],
- "name": "create fake-package.yaml",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output (invalid)@null@@@",
- "@@@STEP_LOG_END@json.output (invalid)@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "set-tag",
- "fake-package",
- "--version",
- "long/weird/ref/which/doesn/not/fit/into/40chars",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json",
- "--tag",
- "dead:beaf",
- "--tag",
- "more:value"
- ],
- "name": "cipd set-tag fake-package",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"pin\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-long/weird/ref/w\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "set-ref",
- "fake-package",
- "--version",
- "latest",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json",
- "--ref",
- "any",
- "--ref",
- "some"
- ],
- "name": "cipd set-ref fake-package",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"pin\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "search",
- "fake-package/linux-amd64",
- "--tag",
- "dead:beaf",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json"
- ],
- "name": "cipd search fake-package/linux-amd64 dead:beaf",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-instance_id_1---\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/linux-amd64-ubuntu14_04\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-instance_id_2---\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/linux-amd64-ubuntu14_04\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-instance_id_3---\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/linux-amd64-ubuntu14_04\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "name": "$result",
- "recipe_result": null,
- "status_code": 0
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/cipd/example.expected/mac64.json b/recipe_modules/cipd/example.expected/mac64.json
deleted file mode 100644
index 37c797c..0000000
--- a/recipe_modules/cipd/example.expected/mac64.json
+++ /dev/null
@@ -1,398 +0,0 @@
-[
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/packages",
- "--list",
- "public/package/mac-amd64 7f751b2237df2fdf3c1405be00590fefffbaea2d",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-cipd-builder.json"
- ],
- "name": "ensure_installed",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"7f751b2237df2fdf3c1405be00590fefffbaea2d\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/mac-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "search",
- "public/package/mac-amd64",
- "--tag",
- "git_revision:40-chars-long-hash",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-cipd-builder.json"
- ],
- "name": "cipd search public/package/mac-amd64 git_revision:40-chars-long-hash",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/mac-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "describe",
- "public/package/mac-amd64",
- "--version",
- "40-chars-fake-of-the-package-instance_id",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-cipd-builder.json"
- ],
- "name": "cipd describe public/package/mac-amd64",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"pin\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/mac-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"refs\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"modified_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"modified_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"ref\": \"latest\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ], @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tags\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"buildbot_build:some.waterfall/builder/1234\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"git_repository:https://chromium.googlesource.com/some/repo\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"git_revision:397a2597cdc237f3026e6143b683be4b9ab60540\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/packages",
- "--list",
- "private/package/mac-amd64 latest\npublic/package/mac-amd64 7f751b2237df2fdf3c1405be00590fefffbaea2d",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json"
- ],
- "name": "ensure_installed (2)",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"private/package/mac-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"7f751b2237df2fdf3c1405be00590fefffbaea2d\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"public/package/mac-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "search",
- "private/package/mac-amd64",
- "--tag",
- "key:value",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json"
- ],
- "name": "cipd search private/package/mac-amd64 key:value",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"private/package/mac-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "describe",
- "private/package/mac-amd64",
- "--version",
- "40-chars-fake-of-the-package-instance_id",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json"
- ],
- "name": "cipd describe private/package/mac-amd64",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"pin\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"private/package/mac-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"refs\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"modified_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"modified_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"ref\": \"latest\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ], @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tags\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"custom:tagged\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_by\": \"user:44-blablbla@developer.gserviceaccount.com\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"registered_ts\": 1446574210, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"tag\": \"key:value\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "pkg-build",
- "--in",
- "fake-input-dir",
- "--name",
- "infra/fake-package",
- "--out",
- "fake-package-path",
- "--json-output",
- "/path/to/tmp/json"
- ],
- "name": "build fake-package",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "pkg-build",
- "--in",
- "fake-input-dir",
- "--name",
- "infra/fake-package",
- "--out",
- "fake-package-path",
- "--json-output",
- "/path/to/tmp/json",
- "--install-mode",
- "copy"
- ],
- "name": "build fake-package (2)",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "pkg-register",
- "fake-package-path",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json",
- "--ref",
- "fake-ref-1",
- "--ref",
- "fake-ref-2",
- "--tag",
- "fake_tag_1:fake_value_1",
- "--tag",
- "fake_tag_2:fake_value_2"
- ],
- "name": "register infra/fake-package",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipdcreate",
- "--pkg-def",
- "[START_DIR]/fake-package.yaml",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json",
- "--ref",
- "fake-ref-1",
- "--ref",
- "fake-ref-2",
- "--tag",
- "fake_tag_1:fake_value_1",
- "--tag",
- "fake_tag_2:fake_value_2"
- ],
- "name": "create fake-package.yaml",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output (invalid)@null@@@",
- "@@@STEP_LOG_END@json.output (invalid)@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "set-tag",
- "fake-package",
- "--version",
- "long/weird/ref/which/doesn/not/fit/into/40chars",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json",
- "--tag",
- "dead:beaf",
- "--tag",
- "more:value"
- ],
- "name": "cipd set-tag fake-package",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"pin\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-long/weird/ref/w\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "set-ref",
- "fake-package",
- "--version",
- "latest",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json",
- "--ref",
- "any",
- "--ref",
- "some"
- ],
- "name": "cipd set-ref fake-package",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"pin\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "search",
- "fake-package/mac-amd64",
- "--tag",
- "dead:beaf",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "fake-credentials.json"
- ],
- "name": "cipd search fake-package/mac-amd64 dead:beaf",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fake-package/mac-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "name": "$result",
- "recipe_result": null,
- "status_code": 0
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/cipd/example.py b/recipe_modules/cipd/example.py
deleted file mode 100644
index 0b9e761..0000000
--- a/recipe_modules/cipd/example.py
+++ /dev/null
@@ -1,101 +0,0 @@
-# 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.
-
-DEPS = [
- 'cipd',
- 'recipe_engine/path',
- 'recipe_engine/platform',
- 'recipe_engine/properties',
- 'recipe_engine/step',
-]
-
-
-def RunSteps(api):
- # Set the service account credentials if needed.
- api.cipd.set_service_account_credentials(
- api.cipd.default_bot_service_account_credentials)
-
- package_name = 'public/package/%s' % api.cipd.platform_suffix()
- package_instance_id = '7f751b2237df2fdf3c1405be00590fefffbaea2d'
- packages = {package_name: package_instance_id}
-
- cipd_root = api.path['start_dir'].join('packages')
- # Some packages don't require credentials to be installed or queried.
- api.cipd.ensure(cipd_root, packages)
- step = api.cipd.search(package_name, tag='git_revision:40-chars-long-hash')
- api.cipd.describe(package_name,
- version=step.json.output['result'][0]['instance_id'])
-
- # Others do, so provide creds first.
- api.cipd.set_service_account_credentials('fake-credentials.json')
- private_package_name = 'private/package/%s' % api.cipd.platform_suffix()
- packages[private_package_name] = 'latest'
- api.cipd.ensure(cipd_root, packages)
- step = api.cipd.search(private_package_name, tag='key:value')
- api.cipd.describe(private_package_name,
- version=step.json.output['result'][0]['instance_id'],
- test_data_tags=['custom:tagged', 'key:value'],
- test_data_refs=['latest'])
-
- # The rest of commands expect credentials to be set.
-
- # Build & register new package version.
- api.cipd.build('fake-input-dir', 'fake-package-path', 'infra/fake-package')
- api.cipd.build('fake-input-dir', 'fake-package-path', 'infra/fake-package',
- install_mode='copy')
- api.cipd.register('infra/fake-package', 'fake-package-path',
- refs=['fake-ref-1', 'fake-ref-2'],
- tags={'fake_tag_1': 'fake_value_1',
- 'fake_tag_2': 'fake_value_2'})
-
- # Create (build & register).
- api.cipd.create(api.path['start_dir'].join('fake-package.yaml'),
- refs=['fake-ref-1', 'fake-ref-2'],
- tags={'fake_tag_1': 'fake_value_1',
- 'fake_tag_2': 'fake_value_2'})
-
- # Set tag or ref of an already existing package.
- api.cipd.set_tag('fake-package',
- version='long/weird/ref/which/doesn/not/fit/into/40chars',
- tags={'dead': 'beaf', 'more': 'value'})
- api.cipd.set_ref('fake-package', version='latest', refs=['any', 'some'])
- # Search by the new tag.
- api.cipd.search('fake-package/%s' % api.cipd.platform_suffix(),
- tag='dead:beaf')
-
-
-def GenTests(api):
- yield (
- # This is very common dev workstation, but not all devs are on it.
- api.test('basic') +
- api.platform('linux', 64)
- )
-
- yield (
- api.test('mac64') +
- api.platform('mac', 64)
- )
-
- yield (
- api.test('describe-failed') +
- api.platform('linux', 64) +
- api.override_step_data(
- 'cipd describe public/package/linux-amd64',
- api.cipd.example_error(
- 'package "public/package/linux-amd64-ubuntu14_04" not registered',
- )
- )
- )
-
- yield (
- api.test('describe-many-instances') +
- api.platform('linux', 64) +
- api.override_step_data(
- 'cipd search fake-package/linux-amd64 dead:beaf',
- api.cipd.example_search(
- 'public/package/linux-amd64-ubuntu14_04',
- instances=3
- )
- )
- )
diff --git a/recipe_modules/cipd/test_api.py b/recipe_modules/cipd/test_api.py
deleted file mode 100644
index 4448516..0000000
--- a/recipe_modules/cipd/test_api.py
+++ /dev/null
@@ -1,94 +0,0 @@
-# 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_test_api
-
-
-class CIPDTestApi(recipe_test_api.RecipeTestApi):
-
- def make_resolved_version(self, v):
- if not v:
- return '40-chars-fake-of-the-package-instance_id'
- if len(v) == 40:
- return v
- # Truncate or pad to 40 chars.
- prefix = 'resolved-instance_id-of-'
- if len(v) + len(prefix) >= 40:
- return '%s%s' % (prefix, v[:40-len(prefix)])
- return '%s%s%s' % (prefix, v, '-' * (40 - len(prefix) - len(v)))
-
- def make_pin(self, package_name, version=None):
- return {
- 'package': package_name,
- 'instance_id': self.make_resolved_version(version),
- }
-
- def _resultify(self, result, error=None, retcode=None):
- dic = {'result': result}
- if error:
- dic['error'] = error
- return self.m.json.output(dic, retcode=retcode)
-
- def example_error(self, error, retcode=None):
- return self._resultify(
- result=None,
- error=error,
- retcode=1 if retcode is None else retcode)
-
- def example_build(self, package_name, version=None):
- return self._resultify(self.make_pin(package_name, version))
-
- example_register = example_build
-
- def example_ensure(self, packages):
- return self._resultify([self.make_pin(name, version)
- for name, version in sorted(packages.items())])
-
- def example_set_tag(self, package_name, version):
- return self._resultify({
- 'package': package_name,
- 'pin': self.make_pin(package_name, version)
- })
-
- example_set_ref = example_set_tag
-
- def example_search(self, package_name, instances=None):
- if instances is None:
- # Return one instance by default.
- return self._resultify([self.make_pin(package_name)])
- if isinstance(instances, int):
- instances = ['instance_id_%i' % (i+1) for i in xrange(instances)]
- return self._resultify([self.make_pin(package_name, instance)
- for instance in instances])
-
- def example_describe(self, package_name, version=None,
- test_data_refs=None, test_data_tags=None,
- user='user:44-blablbla@developer.gserviceaccount.com',
- tstamp=1446574210):
- assert not test_data_tags or all(':' in tag for tag in test_data_tags)
- return self._resultify({
- 'pin': self.make_pin(package_name, version),
- 'registered_by': user,
- 'registered_ts': tstamp,
- 'refs': [
- {
- 'ref': ref,
- 'modified_by': user,
- 'modified_ts': tstamp,
- }
- for ref in (['latest'] if test_data_refs is None else test_data_refs)
- ],
- 'tags': [
- {
- 'tag': tag,
- 'registered_by': user,
- 'registered_ts': tstamp,
- }
- for tag in ([
- 'buildbot_build:some.waterfall/builder/1234',
- 'git_repository:https://chromium.googlesource.com/some/repo',
- 'git_revision:397a2597cdc237f3026e6143b683be4b9ab60540',
- ] if test_data_tags is None else test_data_tags)
- ],
- })
diff --git a/recipe_modules/git/__init__.py b/recipe_modules/git/__init__.py
deleted file mode 100644
index 8537795..0000000
--- a/recipe_modules/git/__init__.py
+++ /dev/null
@@ -1,9 +0,0 @@
-DEPS = [
- 'recipe_engine/path',
- 'recipe_engine/platform',
- 'recipe_engine/properties',
- 'recipe_engine/python',
- 'recipe_engine/raw_io',
- 'recipe_engine/shutil',
- 'recipe_engine/step',
-]
diff --git a/recipe_modules/git/api.py b/recipe_modules/git/api.py
deleted file mode 100644
index 8072ac0..0000000
--- a/recipe_modules/git/api.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# Copyright 2016 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import itertools
-import re
-
-from recipe_engine import recipe_api
-
-class GitApi(recipe_api.RecipeApi):
- """GitApi provides support for Git."""
-
- _GIT_HASH_RE = re.compile('[0-9a-f]{40}', re.IGNORECASE)
-
- def __init__(self, *args, **kwargs):
- super(GitApi, self).__init__(*args, **kwargs)
-
- def __call__(self, *args, **kwargs):
- """Return a git command step."""
- name = kwargs.pop('name', 'git ' + args[0])
- infra_step = kwargs.pop('infra_step', True)
- if 'cwd' not in kwargs:
- kwargs.setdefault('cwd', self.m.path['checkout'])
- git_cmd = ['git']
- options = kwargs.pop('config_options', {})
- for k, v in sorted(options.iteritems()):
- git_cmd.extend(['-c', '%s=%s' % (k, v)])
- return self.m.step(name, git_cmd + list(args), **kwargs)
-
- def checkout(self, url, path=None, ref=None, remote=None, file=None, **kwargs):
- """Checkout a given ref and return the checked out revision."""
- if not path:
- path = url.rsplit('/', 1)[-1]
- if path.endswith('.git'): # https://host/foobar.git
- path = path[:-len('.git')]
- path = path or path.rsplit('/', 1)[-1] # ssh://host:repo/foobar/.git
- path = self.m.path['start_dir'].join(path)
-
- if 'checkout' not in self.m.path:
- self.m.path['checkout'] = path
-
- if not self.m.path.exists(path):
- self.m.shutil.makedirs('makedirs', path)
-
- if self.m.path.exists(path.join('.git')): # pragma: no cover
- self('config', '--remove-section', 'remote.%s' % remote, **kwargs)
- else:
- self('init', path, **kwargs)
- self('remote', 'add', remote or 'origin', url)
-
- if not ref:
- fetch_ref = self.m.properties.get('branch') or 'master'
- checkout_ref = 'FETCH_HEAD'
- elif self._GIT_HASH_RE.match(ref):
- fetch_ref = ''
- checkout_ref = ref
- elif ref.startswith('refs/heads/'):
- fetch_ref = ref[len('refs/heads/'):]
- checkout_ref = 'FETCH_HEAD'
- else:
- fetch_ref = ref
- checkout_ref = 'FETCH_HEAD'
- fetch_args = [x for x in (remote, fetch_ref) if x]
- self('fetch', *fetch_args, **kwargs)
- if file:
- self('checkout', '-f', checkout_ref, '--', file, **kwargs)
- else:
- self('checkout', '-f', checkout_ref, **kwargs)
- step = self('rev-parse', 'HEAD', stdout=self.m.raw_io.output(),
- step_test_data=lambda:
- self.m.raw_io.test_api.stream_output('deadbeef'))
- self('clean', '-f', '-d', '-x', **kwargs)
- return step.stdout.strip()
-
- def get_hash(self, commit='HEAD', **kwargs):
- """Find and return the hash of the given commit."""
- return self('show', commit, '--format=%H', '-s',
- step_test_data=lambda:
- self.m.raw_io.test_api.stream_output('deadbeef'),
- stdout=self.m.raw_io.output(), **kwargs).stdout.strip()
-
- def get_timestamp(self, commit='HEAD', test_data=None, **kwargs):
- """Find and return the timestamp of the given commit."""
- return self('show', commit, '--format=%at', '-s',
- step_test_data=lambda:
- self.m.raw_io.test_api.stream_output('1473312770'),
- stdout=self.m.raw_io.output(), **kwargs).stdout.strip()
diff --git a/recipe_modules/git/example.expected/basic.json b/recipe_modules/git/example.expected/basic.json
deleted file mode 100644
index b85814e..0000000
--- a/recipe_modules/git/example.expected/basic.json
+++ /dev/null
@@ -1,123 +0,0 @@
-[
- {
- "cmd": [
- "python",
- "-u",
- "\nimport sys, os\npath = sys.argv[1]\nmode = int(sys.argv[2])\nif not os.path.isdir(path):\n if os.path.exists(path):\n print \"%s exists but is not a dir\" % path\n sys.exit(1)\n os.makedirs(path, mode)\n",
- "[START_DIR]/fuchsia",
- "511"
- ],
- "name": "makedirs makedirs",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@import sys, os@@@",
- "@@@STEP_LOG_LINE@python.inline@path = sys.argv[1]@@@",
- "@@@STEP_LOG_LINE@python.inline@mode = int(sys.argv[2])@@@",
- "@@@STEP_LOG_LINE@python.inline@if not os.path.isdir(path):@@@",
- "@@@STEP_LOG_LINE@python.inline@ if os.path.exists(path):@@@",
- "@@@STEP_LOG_LINE@python.inline@ print \"%s exists but is not a dir\" % path@@@",
- "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@",
- "@@@STEP_LOG_LINE@python.inline@ os.makedirs(path, mode)@@@",
- "@@@STEP_LOG_END@python.inline@@@"
- ]
- },
- {
- "cmd": [
- "git",
- "init",
- "[START_DIR]/fuchsia"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git init"
- },
- {
- "cmd": [
- "git",
- "remote",
- "add",
- "origin",
- "https://fuchsia.googlesource.com/fuchsia.git"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git remote"
- },
- {
- "cmd": [
- "git",
- "fetch",
- "master"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git fetch"
- },
- {
- "cmd": [
- "git",
- "checkout",
- "-f",
- "FETCH_HEAD"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git checkout"
- },
- {
- "cmd": [
- "git",
- "rev-parse",
- "HEAD"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git rev-parse",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "clean",
- "-f",
- "-d",
- "-x"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git clean"
- },
- {
- "cmd": [
- "git",
- "show",
- "HEAD",
- "--format=%H",
- "-s"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git show",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "show",
- "HEAD",
- "--format=%at",
- "-s"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git show (2)",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "-c",
- "foo=bar",
- "status"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git status"
- },
- {
- "name": "$result",
- "recipe_result": null,
- "status_code": 0
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/git/example.expected/basic_branch.json b/recipe_modules/git/example.expected/basic_branch.json
deleted file mode 100644
index 42200d1..0000000
--- a/recipe_modules/git/example.expected/basic_branch.json
+++ /dev/null
@@ -1,123 +0,0 @@
-[
- {
- "cmd": [
- "python",
- "-u",
- "\nimport sys, os\npath = sys.argv[1]\nmode = int(sys.argv[2])\nif not os.path.isdir(path):\n if os.path.exists(path):\n print \"%s exists but is not a dir\" % path\n sys.exit(1)\n os.makedirs(path, mode)\n",
- "[START_DIR]/fuchsia",
- "511"
- ],
- "name": "makedirs makedirs",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@import sys, os@@@",
- "@@@STEP_LOG_LINE@python.inline@path = sys.argv[1]@@@",
- "@@@STEP_LOG_LINE@python.inline@mode = int(sys.argv[2])@@@",
- "@@@STEP_LOG_LINE@python.inline@if not os.path.isdir(path):@@@",
- "@@@STEP_LOG_LINE@python.inline@ if os.path.exists(path):@@@",
- "@@@STEP_LOG_LINE@python.inline@ print \"%s exists but is not a dir\" % path@@@",
- "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@",
- "@@@STEP_LOG_LINE@python.inline@ os.makedirs(path, mode)@@@",
- "@@@STEP_LOG_END@python.inline@@@"
- ]
- },
- {
- "cmd": [
- "git",
- "init",
- "[START_DIR]/fuchsia"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git init"
- },
- {
- "cmd": [
- "git",
- "remote",
- "add",
- "origin",
- "https://fuchsia.googlesource.com/fuchsia.git"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git remote"
- },
- {
- "cmd": [
- "git",
- "fetch",
- "testing"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git fetch"
- },
- {
- "cmd": [
- "git",
- "checkout",
- "-f",
- "FETCH_HEAD"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git checkout"
- },
- {
- "cmd": [
- "git",
- "rev-parse",
- "HEAD"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git rev-parse",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "clean",
- "-f",
- "-d",
- "-x"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git clean"
- },
- {
- "cmd": [
- "git",
- "show",
- "HEAD",
- "--format=%H",
- "-s"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git show",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "show",
- "HEAD",
- "--format=%at",
- "-s"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git show (2)",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "-c",
- "foo=bar",
- "status"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git status"
- },
- {
- "name": "$result",
- "recipe_result": null,
- "status_code": 0
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/git/example.expected/basic_file.json b/recipe_modules/git/example.expected/basic_file.json
deleted file mode 100644
index 84c3475..0000000
--- a/recipe_modules/git/example.expected/basic_file.json
+++ /dev/null
@@ -1,125 +0,0 @@
-[
- {
- "cmd": [
- "python",
- "-u",
- "\nimport sys, os\npath = sys.argv[1]\nmode = int(sys.argv[2])\nif not os.path.isdir(path):\n if os.path.exists(path):\n print \"%s exists but is not a dir\" % path\n sys.exit(1)\n os.makedirs(path, mode)\n",
- "[START_DIR]/fuchsia",
- "511"
- ],
- "name": "makedirs makedirs",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@import sys, os@@@",
- "@@@STEP_LOG_LINE@python.inline@path = sys.argv[1]@@@",
- "@@@STEP_LOG_LINE@python.inline@mode = int(sys.argv[2])@@@",
- "@@@STEP_LOG_LINE@python.inline@if not os.path.isdir(path):@@@",
- "@@@STEP_LOG_LINE@python.inline@ if os.path.exists(path):@@@",
- "@@@STEP_LOG_LINE@python.inline@ print \"%s exists but is not a dir\" % path@@@",
- "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@",
- "@@@STEP_LOG_LINE@python.inline@ os.makedirs(path, mode)@@@",
- "@@@STEP_LOG_END@python.inline@@@"
- ]
- },
- {
- "cmd": [
- "git",
- "init",
- "[START_DIR]/fuchsia"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git init"
- },
- {
- "cmd": [
- "git",
- "remote",
- "add",
- "origin",
- "https://fuchsia.googlesource.com/fuchsia.git"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git remote"
- },
- {
- "cmd": [
- "git",
- "fetch",
- "master"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git fetch"
- },
- {
- "cmd": [
- "git",
- "checkout",
- "-f",
- "FETCH_HEAD",
- "--",
- "README.md"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git checkout"
- },
- {
- "cmd": [
- "git",
- "rev-parse",
- "HEAD"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git rev-parse",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "clean",
- "-f",
- "-d",
- "-x"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git clean"
- },
- {
- "cmd": [
- "git",
- "show",
- "HEAD",
- "--format=%H",
- "-s"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git show",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "show",
- "HEAD",
- "--format=%at",
- "-s"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git show (2)",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "-c",
- "foo=bar",
- "status"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git status"
- },
- {
- "name": "$result",
- "recipe_result": null,
- "status_code": 0
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/git/example.expected/basic_hash.json b/recipe_modules/git/example.expected/basic_hash.json
deleted file mode 100644
index e40cf6e..0000000
--- a/recipe_modules/git/example.expected/basic_hash.json
+++ /dev/null
@@ -1,122 +0,0 @@
-[
- {
- "cmd": [
- "python",
- "-u",
- "\nimport sys, os\npath = sys.argv[1]\nmode = int(sys.argv[2])\nif not os.path.isdir(path):\n if os.path.exists(path):\n print \"%s exists but is not a dir\" % path\n sys.exit(1)\n os.makedirs(path, mode)\n",
- "[START_DIR]/fuchsia",
- "511"
- ],
- "name": "makedirs makedirs",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@import sys, os@@@",
- "@@@STEP_LOG_LINE@python.inline@path = sys.argv[1]@@@",
- "@@@STEP_LOG_LINE@python.inline@mode = int(sys.argv[2])@@@",
- "@@@STEP_LOG_LINE@python.inline@if not os.path.isdir(path):@@@",
- "@@@STEP_LOG_LINE@python.inline@ if os.path.exists(path):@@@",
- "@@@STEP_LOG_LINE@python.inline@ print \"%s exists but is not a dir\" % path@@@",
- "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@",
- "@@@STEP_LOG_LINE@python.inline@ os.makedirs(path, mode)@@@",
- "@@@STEP_LOG_END@python.inline@@@"
- ]
- },
- {
- "cmd": [
- "git",
- "init",
- "[START_DIR]/fuchsia"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git init"
- },
- {
- "cmd": [
- "git",
- "remote",
- "add",
- "origin",
- "https://fuchsia.googlesource.com/fuchsia.git"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git remote"
- },
- {
- "cmd": [
- "git",
- "fetch"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git fetch"
- },
- {
- "cmd": [
- "git",
- "checkout",
- "-f",
- "abcdef0123456789abcdef0123456789abcdef01"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git checkout"
- },
- {
- "cmd": [
- "git",
- "rev-parse",
- "HEAD"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git rev-parse",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "clean",
- "-f",
- "-d",
- "-x"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git clean"
- },
- {
- "cmd": [
- "git",
- "show",
- "HEAD",
- "--format=%H",
- "-s"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git show",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "show",
- "HEAD",
- "--format=%at",
- "-s"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git show (2)",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "-c",
- "foo=bar",
- "status"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git status"
- },
- {
- "name": "$result",
- "recipe_result": null,
- "status_code": 0
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/git/example.expected/basic_path.json b/recipe_modules/git/example.expected/basic_path.json
deleted file mode 100644
index 3ed8af0..0000000
--- a/recipe_modules/git/example.expected/basic_path.json
+++ /dev/null
@@ -1,123 +0,0 @@
-[
- {
- "cmd": [
- "python",
- "-u",
- "\nimport sys, os\npath = sys.argv[1]\nmode = int(sys.argv[2])\nif not os.path.isdir(path):\n if os.path.exists(path):\n print \"%s exists but is not a dir\" % path\n sys.exit(1)\n os.makedirs(path, mode)\n",
- "[START_DIR]/foo",
- "511"
- ],
- "name": "makedirs makedirs",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@import sys, os@@@",
- "@@@STEP_LOG_LINE@python.inline@path = sys.argv[1]@@@",
- "@@@STEP_LOG_LINE@python.inline@mode = int(sys.argv[2])@@@",
- "@@@STEP_LOG_LINE@python.inline@if not os.path.isdir(path):@@@",
- "@@@STEP_LOG_LINE@python.inline@ if os.path.exists(path):@@@",
- "@@@STEP_LOG_LINE@python.inline@ print \"%s exists but is not a dir\" % path@@@",
- "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@",
- "@@@STEP_LOG_LINE@python.inline@ os.makedirs(path, mode)@@@",
- "@@@STEP_LOG_END@python.inline@@@"
- ]
- },
- {
- "cmd": [
- "git",
- "init",
- "[START_DIR]/foo"
- ],
- "cwd": "[START_DIR]/foo",
- "name": "git init"
- },
- {
- "cmd": [
- "git",
- "remote",
- "add",
- "origin",
- "https://fuchsia.googlesource.com/fuchsia.git"
- ],
- "cwd": "[START_DIR]/foo",
- "name": "git remote"
- },
- {
- "cmd": [
- "git",
- "fetch",
- "master"
- ],
- "cwd": "[START_DIR]/foo",
- "name": "git fetch"
- },
- {
- "cmd": [
- "git",
- "checkout",
- "-f",
- "FETCH_HEAD"
- ],
- "cwd": "[START_DIR]/foo",
- "name": "git checkout"
- },
- {
- "cmd": [
- "git",
- "rev-parse",
- "HEAD"
- ],
- "cwd": "[START_DIR]/foo",
- "name": "git rev-parse",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "clean",
- "-f",
- "-d",
- "-x"
- ],
- "cwd": "[START_DIR]/foo",
- "name": "git clean"
- },
- {
- "cmd": [
- "git",
- "show",
- "HEAD",
- "--format=%H",
- "-s"
- ],
- "cwd": "[START_DIR]/foo",
- "name": "git show",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "show",
- "HEAD",
- "--format=%at",
- "-s"
- ],
- "cwd": "[START_DIR]/foo",
- "name": "git show (2)",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "-c",
- "foo=bar",
- "status"
- ],
- "cwd": "[START_DIR]/foo",
- "name": "git status"
- },
- {
- "name": "$result",
- "recipe_result": null,
- "status_code": 0
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/git/example.expected/basic_ref.json b/recipe_modules/git/example.expected/basic_ref.json
deleted file mode 100644
index c8ad4ea..0000000
--- a/recipe_modules/git/example.expected/basic_ref.json
+++ /dev/null
@@ -1,123 +0,0 @@
-[
- {
- "cmd": [
- "python",
- "-u",
- "\nimport sys, os\npath = sys.argv[1]\nmode = int(sys.argv[2])\nif not os.path.isdir(path):\n if os.path.exists(path):\n print \"%s exists but is not a dir\" % path\n sys.exit(1)\n os.makedirs(path, mode)\n",
- "[START_DIR]/fuchsia",
- "511"
- ],
- "name": "makedirs makedirs",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@import sys, os@@@",
- "@@@STEP_LOG_LINE@python.inline@path = sys.argv[1]@@@",
- "@@@STEP_LOG_LINE@python.inline@mode = int(sys.argv[2])@@@",
- "@@@STEP_LOG_LINE@python.inline@if not os.path.isdir(path):@@@",
- "@@@STEP_LOG_LINE@python.inline@ if os.path.exists(path):@@@",
- "@@@STEP_LOG_LINE@python.inline@ print \"%s exists but is not a dir\" % path@@@",
- "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@",
- "@@@STEP_LOG_LINE@python.inline@ os.makedirs(path, mode)@@@",
- "@@@STEP_LOG_END@python.inline@@@"
- ]
- },
- {
- "cmd": [
- "git",
- "init",
- "[START_DIR]/fuchsia"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git init"
- },
- {
- "cmd": [
- "git",
- "remote",
- "add",
- "origin",
- "https://fuchsia.googlesource.com/fuchsia.git"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git remote"
- },
- {
- "cmd": [
- "git",
- "fetch",
- "refs/foo/bar"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git fetch"
- },
- {
- "cmd": [
- "git",
- "checkout",
- "-f",
- "FETCH_HEAD"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git checkout"
- },
- {
- "cmd": [
- "git",
- "rev-parse",
- "HEAD"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git rev-parse",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "clean",
- "-f",
- "-d",
- "-x"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git clean"
- },
- {
- "cmd": [
- "git",
- "show",
- "HEAD",
- "--format=%H",
- "-s"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git show",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "show",
- "HEAD",
- "--format=%at",
- "-s"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git show (2)",
- "stdout": "/path/to/tmp/"
- },
- {
- "cmd": [
- "git",
- "-c",
- "foo=bar",
- "status"
- ],
- "cwd": "[START_DIR]/fuchsia",
- "name": "git status"
- },
- {
- "name": "$result",
- "recipe_result": null,
- "status_code": 0
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/git/example.py b/recipe_modules/git/example.py
deleted file mode 100644
index bb796df..0000000
--- a/recipe_modules/git/example.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright 2013 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.
-
-DEPS = [
- 'git',
- 'recipe_engine/path',
- 'recipe_engine/platform',
- 'recipe_engine/properties',
- 'recipe_engine/raw_io',
- 'recipe_engine/step',
-]
-
-
-def RunSteps(api):
- url = 'https://fuchsia.googlesource.com/fuchsia.git'
-
- api.git.checkout(
- url,
- path=api.properties.get('path'),
- ref=api.properties.get('revision'),
- remote=api.properties.get('remote'),
- file=api.properties.get('checkout_file'))
-
- api.git.get_hash()
- api.git.get_timestamp()
-
- # You can invoke arbitrary command on api.git.
- api.git('status', config_options={'foo': 'bar'}, cwd=api.path['checkout'])
-
-
-def GenTests(api):
- yield api.test('basic')
- yield api.test('basic_path') + api.properties(path=api.path['start_dir'].join('foo'))
- yield api.test('basic_ref') + api.properties(revision='refs/foo/bar')
- yield api.test('basic_branch') + api.properties(revision='refs/heads/testing')
- yield api.test('basic_hash') + api.properties(
- revision='abcdef0123456789abcdef0123456789abcdef01')
- yield api.test('basic_file') + api.properties(checkout_file='README.md')
diff --git a/recipe_modules/git/test_api.py b/recipe_modules/git/test_api.py
deleted file mode 100644
index b13590f..0000000
--- a/recipe_modules/git/test_api.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright 2016 The Fuchsia 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_test_api
-
-class GitTestApi(recipe_test_api.RecipeTestApi):
-
- pass
-
diff --git a/recipe_modules/go/__init__.py b/recipe_modules/go/__init__.py
deleted file mode 100644
index 9d68e44..0000000
--- a/recipe_modules/go/__init__.py
+++ /dev/null
@@ -1,9 +0,0 @@
-DEPS = [
- 'cipd',
- 'recipe_engine/json',
- 'recipe_engine/path',
- 'recipe_engine/platform',
- 'recipe_engine/python',
- 'recipe_engine/raw_io',
- 'recipe_engine/step',
-]
diff --git a/recipe_modules/go/api.py b/recipe_modules/go/api.py
deleted file mode 100644
index 3440b38..0000000
--- a/recipe_modules/go/api.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright 2016 The Fuchsia 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
-
-import textwrap
-
-
-class GoApi(recipe_api.RecipeApi):
- """GoApi provides support for Go."""
-
- def __init__(self, *args, **kwargs):
- super(GoApi, self).__init__(*args, **kwargs)
- self._go_dir = None
- self._go_version = None
-
- def __call__(self, *args, **kwargs):
- """Return a Go command step."""
- assert self._go_dir
-
- name = kwargs.pop('name', 'go ' + args[0])
- env = kwargs.setdefault('env', {})
- go_cmd = [self.go_executable]
- env.setdefault('GOROOT', self._go_dir)
-
- return self.m.step(name, go_cmd + list(args or []), **kwargs)
-
- def ensure_go(self, version=None):
- """Ensures that go distribution is installed."""
- with self.m.step.nest('ensure_go'):
- with self.m.step.context({'infra_step': True}):
- go_package = ('fuchsia/go/go/%s' %
- self.m.cipd.platform_suffix())
- self._go_dir = self.m.path['start_dir'].join('cipd', 'go')
-
- self.m.cipd.ensure(self._go_dir,
- {go_package: version or 'release'})
-
- return self._go_dir
-
- @property
- def go_executable(self):
- return self.m.path.join(self._go_dir, 'bin', 'go')
-
- def inline(self, program, add_go_log=True, **kwargs):
- """Run an inline Go program as a step.
- Program is output to a temp file and run when this step executes.
- """
- program = textwrap.dedent(program)
-
- try:
- self('run', self.m.raw_io.input(program, '.go'), **kwargs)
- finally:
- result = self.m.step.active_result
- if result and add_go_log:
- result.presentation.logs['go.inline'] = program.splitlines()
-
- return result
diff --git a/recipe_modules/go/example.expected/basic.json b/recipe_modules/go/example.expected/basic.json
deleted file mode 100644
index 8057ed1..0000000
--- a/recipe_modules/go/example.expected/basic.json
+++ /dev/null
@@ -1,120 +0,0 @@
-[
- {
- "cmd": [],
- "name": "ensure_go"
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/cipd/go",
- "--list",
- "fuchsia/go/go/linux-amd64 release",
- "--json-output",
- "/path/to/tmp/json"
- ],
- "name": "ensure_go.ensure_installed",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-release---------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fuchsia/go/go/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [],
- "name": "ensure_go (2)"
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/cipd/go",
- "--list",
- "fuchsia/go/go/linux-amd64 go_version:1.6",
- "--json-output",
- "/path/to/tmp/json"
- ],
- "name": "ensure_go.ensure_installed (2)",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-go_version:1.6--\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fuchsia/go/go/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd/go/bin/go",
- "build",
- "fuchsia.googlesource.com/foo"
- ],
- "env": {
- "GOROOT": "[START_DIR]/cipd/go"
- },
- "name": "go build"
- },
- {
- "cmd": [
- "[START_DIR]/cipd/go/bin/go",
- "test",
- "fuchsia.googlesource.com/foo"
- ],
- "env": {
- "GOROOT": "[START_DIR]/cipd/go"
- },
- "name": "go test"
- },
- {
- "cmd": [
- "[START_DIR]/cipd/go/bin/go",
- "run",
- "package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Printf(\"Hello, world.\n\")\n}"
- ],
- "env": {
- "GOROOT": "[START_DIR]/cipd/go"
- },
- "name": "go run"
- },
- {
- "cmd": [
- "[START_DIR]/cipd/go/bin/go",
- "run",
- "package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Printf(\"Hello, world.\n\")\n}"
- ],
- "env": {
- "GOROOT": "[START_DIR]/cipd/go"
- },
- "name": "go run (2)",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@go.inline@package main@@@",
- "@@@STEP_LOG_LINE@go.inline@@@@",
- "@@@STEP_LOG_LINE@go.inline@import \"fmt\"@@@",
- "@@@STEP_LOG_LINE@go.inline@@@@",
- "@@@STEP_LOG_LINE@go.inline@func main() {@@@",
- "@@@STEP_LOG_LINE@go.inline@\tfmt.Printf(\"Hello, world.@@@",
- "@@@STEP_LOG_LINE@go.inline@\")@@@",
- "@@@STEP_LOG_LINE@go.inline@}@@@",
- "@@@STEP_LOG_END@go.inline@@@"
- ]
- },
- {
- "name": "$result",
- "recipe_result": null,
- "status_code": 0
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/go/example.py b/recipe_modules/go/example.py
deleted file mode 100644
index 3637654..0000000
--- a/recipe_modules/go/example.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright 2016 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-DEPS = [
- 'go',
- 'recipe_engine/path',
- 'recipe_engine/platform',
- 'recipe_engine/properties',
- 'recipe_engine/raw_io',
- 'recipe_engine/step',
-]
-
-
-def RunSteps(api):
- # First, you need a go distribution.
- api.go.ensure_go()
- api.go.ensure_go(version='go_version:1.6')
- assert api.go.go_executable
-
- # Build a go package.
- api.go('build', 'fuchsia.googlesource.com/foo')
-
- # Test a go package.
- api.go('test', 'fuchsia.googlesource.com/foo')
-
- # Run a go program.
- input = api.raw_io.input("""package main
-
-import "fmt"
-
-func main() {
- fmt.Printf("Hello, world.\n")
-}""", '.go')
-
- api.go('run', input)
-
- # Run an inline go program.
- api.go.inline("""package main
-
-import "fmt"
-
-func main() {
- fmt.Printf("Hello, world.\n")
-}""")
-
-
-def GenTests(api):
- yield (
- api.test('basic') +
- api.platform('linux', 64)
- )
diff --git a/recipe_modules/goma/__init__.py b/recipe_modules/goma/__init__.py
deleted file mode 100644
index 7d9ffa4..0000000
--- a/recipe_modules/goma/__init__.py
+++ /dev/null
@@ -1,9 +0,0 @@
-DEPS = [
- 'cipd',
- 'recipe_engine/path',
- 'recipe_engine/platform',
- 'recipe_engine/properties',
- 'recipe_engine/python',
- 'recipe_engine/raw_io',
- 'recipe_engine/step',
-]
diff --git a/recipe_modules/goma/api.py b/recipe_modules/goma/api.py
deleted file mode 100644
index 30c4ed1..0000000
--- a/recipe_modules/goma/api.py
+++ /dev/null
@@ -1,168 +0,0 @@
-# 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 contextlib import contextmanager
-
-from recipe_engine import recipe_api
-
-
-class GomaApi(recipe_api.RecipeApi):
- """GomaApi contains helper functions for using goma."""
-
- def __init__(self, **kwargs):
- super(GomaApi, self).__init__(**kwargs)
- self._goma_dir = None
- self._goma_started = False
-
- self._goma_ctl_env = {}
- self._goma_jobs = None
-
- @property
- def service_account_json_path(self):
- return '/creds/service_accounts/service-account-goma-client.json'
-
- @property
- def json_path(self):
- assert self._goma_dir
- return self.m.path.join(self._goma_dir, 'jsonstatus')
-
- @property
- def recommended_goma_jobs(self):
- """
- Return the recommended number of jobs for parallel build using Goma.
-
- This function caches the _goma_jobs.
- """
- if self._goma_jobs:
- return self._goma_jobs
-
- # We need to use python.inline not to change behavior of recipes.
- step_result = self.m.python.inline(
- 'calculate the number of recommended jobs',
- """
-import multiprocessing
-import sys
-
-job_limit = 200
-if sys.platform.startswith('linux'):
- # Use 80 for linux not to load goma backend.
- job_limit = 80
-
-try:
- jobs = min(job_limit, multiprocessing.cpu_count() * 10)
-except NotImplementedError:
- jobs = 50
-
-print jobs
- """,
- stdout=self.m.raw_io.output(),
- step_test_data=(
- lambda: self.m.raw_io.test_api.stream_output('50\n'))
- )
- self._goma_jobs = int(step_result.stdout)
-
- return self._goma_jobs
-
- def ensure_goma(self, canary=False):
- with self.m.step.nest('ensure_goma'):
- with self.m.step.context({'infra_step': True}):
- self.m.cipd.set_service_account_credentials(
- self.service_account_json_path)
-
- goma_package = ('infra_internal/goma/client/%s' %
- self.m.cipd.platform_suffix())
- ref='release'
- if canary:
- ref='candidate'
- self._goma_dir = self.m.path['start_dir'].join('cipd', 'goma')
-
- self.m.cipd.ensure(self._goma_dir, {goma_package: ref})
-
- return self._goma_dir
-
- @property
- def goma_ctl(self):
- return self.m.path.join(self._goma_dir, 'goma_ctl.py')
-
- @property
- def goma_dir(self):
- assert self._goma_dir
- return self._goma_dir
-
- def start(self, env=None, **kwargs):
- """Start goma compiler_proxy.
-
- A user MUST execute ensure_goma beforehand.
- It is user's responsibility to handle failure of starting compiler_proxy.
- """
- assert self._goma_dir
- assert not self._goma_started
-
- self._goma_ctl_env['GOMA_CACHE_DIR'] = (
- self.m.path.join(self.m.path['cache'], 'goma'))
- self._goma_ctl_env['GOMA_SERVICE_ACCOUNT_JSON_FILE'] = (
- self.service_account_json_path)
-
- # GLOG_log_dir should not be set.
- assert env is None or 'GLOG_log_dir' not in env
-
- goma_ctl_start_env = self._goma_ctl_env.copy()
- if env is not None:
- goma_ctl_start_env.update(env)
-
- try:
- self.m.python(
- name='start_goma',
- script=self.goma_ctl,
- args=['restart'], env=goma_ctl_start_env, infra_step=True, **kwargs)
- self._goma_started = True
- except self.m.step.InfraFailure as e: # pragma: no cover
- try:
- with self.m.step.defer_results():
- self.m.python(
- name='stop_goma (start failure)',
- script=self.goma_ctl,
- args=['stop'], env=self._goma_ctl_env, **kwargs)
- except self.m.step.StepFailure:
- pass
- raise e
-
- def stop(self, **kwargs):
- """Stop goma compiler_proxy.
-
- A user MUST execute start beforehand.
- It is user's responsibility to handle failure of stopping compiler_proxy.
-
- Raises:
- StepFailure if it fails to stop goma.
- """
- assert self._goma_dir
- assert self._goma_started
-
- with self.m.step.defer_results():
- self.m.python(name='goma_jsonstatus', script=self.goma_ctl,
- args=['jsonstatus', self.json_path],
- env=self._goma_ctl_env, **kwargs)
- self.m.python(name='goma_stat', script=self.goma_ctl,
- args=['stat'],
- env=self._goma_ctl_env, **kwargs)
- self.m.python(name='stop_goma', script=self.goma_ctl,
- args=['stop'], env=self._goma_ctl_env, **kwargs)
-
- self._goma_started = False
- self._goma_ctl_env = {}
-
- @contextmanager
- def build_with_goma(self, env=None):
- """Make context wrapping goma start/stop.
-
- Raises:
- StepFailure or InfraFailure if it fails to build.
- """
-
- self.start(env)
- try:
- yield
- finally:
- self.stop()
diff --git a/recipe_modules/goma/example.expected/linux.json b/recipe_modules/goma/example.expected/linux.json
deleted file mode 100644
index 07a9bf3..0000000
--- a/recipe_modules/goma/example.expected/linux.json
+++ /dev/null
@@ -1,172 +0,0 @@
-[
- {
- "cmd": [],
- "name": "ensure_goma"
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/cipd/goma",
- "--list",
- "infra_internal/goma/client/linux-amd64 release",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-goma-client.json"
- ],
- "name": "ensure_goma.ensure_installed",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-release---------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra_internal/goma/client/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [],
- "name": "ensure_goma (2)"
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/cipd/goma",
- "--list",
- "infra_internal/goma/client/linux-amd64 candidate",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-goma-client.json"
- ],
- "name": "ensure_goma.ensure_installed (2)",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-candidate-------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra_internal/goma/client/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "gn",
- "gen",
- "out/Release",
- "--args=use_goma=true goma_dir=[START_DIR]/cipd/goma"
- ],
- "name": "gn"
- },
- {
- "cmd": [
- "python",
- "-u",
- "[START_DIR]/cipd/goma/goma_ctl.py",
- "restart"
- ],
- "env": {
- "GOMA_CACHE_DIR": "[CACHE]/goma",
- "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
- },
- "name": "start_goma"
- },
- {
- "cmd": [
- "python",
- "-u",
- "\nimport multiprocessing\nimport sys\n\njob_limit = 200\nif sys.platform.startswith('linux'):\n # Use 80 for linux not to load goma backend.\n job_limit = 80\n\ntry:\n jobs = min(job_limit, multiprocessing.cpu_count() * 10)\nexcept NotImplementedError:\n jobs = 50\n\nprint jobs\n"
- ],
- "name": "calculate the number of recommended jobs",
- "stdout": "/path/to/tmp/",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@import multiprocessing@@@",
- "@@@STEP_LOG_LINE@python.inline@import sys@@@",
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@job_limit = 200@@@",
- "@@@STEP_LOG_LINE@python.inline@if sys.platform.startswith('linux'):@@@",
- "@@@STEP_LOG_LINE@python.inline@ # Use 80 for linux not to load goma backend.@@@",
- "@@@STEP_LOG_LINE@python.inline@ job_limit = 80@@@",
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@try:@@@",
- "@@@STEP_LOG_LINE@python.inline@ jobs = min(job_limit, multiprocessing.cpu_count() * 10)@@@",
- "@@@STEP_LOG_LINE@python.inline@except NotImplementedError:@@@",
- "@@@STEP_LOG_LINE@python.inline@ jobs = 50@@@",
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@print jobs@@@",
- "@@@STEP_LOG_END@python.inline@@@"
- ]
- },
- {
- "cmd": [
- "echo",
- "50"
- ],
- "name": "echo goma jobs"
- },
- {
- "cmd": [
- "echo",
- "50"
- ],
- "name": "echo goma jobs second"
- },
- {
- "cmd": [
- "python",
- "-u",
- "[START_DIR]/cipd/goma/goma_ctl.py",
- "jsonstatus",
- "[START_DIR]/cipd/goma/jsonstatus"
- ],
- "env": {
- "GOMA_CACHE_DIR": "[CACHE]/goma",
- "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
- },
- "name": "goma_jsonstatus"
- },
- {
- "cmd": [
- "python",
- "-u",
- "[START_DIR]/cipd/goma/goma_ctl.py",
- "stat"
- ],
- "env": {
- "GOMA_CACHE_DIR": "[CACHE]/goma",
- "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
- },
- "name": "goma_stat"
- },
- {
- "cmd": [
- "python",
- "-u",
- "[START_DIR]/cipd/goma/goma_ctl.py",
- "stop"
- ],
- "env": {
- "GOMA_CACHE_DIR": "[CACHE]/goma",
- "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
- },
- "name": "stop_goma"
- },
- {
- "name": "$result",
- "recipe_result": null,
- "status_code": 0
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/goma/example.expected/mac.json b/recipe_modules/goma/example.expected/mac.json
deleted file mode 100644
index e22ae13..0000000
--- a/recipe_modules/goma/example.expected/mac.json
+++ /dev/null
@@ -1,172 +0,0 @@
-[
- {
- "cmd": [],
- "name": "ensure_goma"
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/cipd/goma",
- "--list",
- "infra_internal/goma/client/mac-amd64 release",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-goma-client.json"
- ],
- "name": "ensure_goma.ensure_installed",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-release---------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra_internal/goma/client/mac-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [],
- "name": "ensure_goma (2)"
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/cipd/goma",
- "--list",
- "infra_internal/goma/client/mac-amd64 candidate",
- "--json-output",
- "/path/to/tmp/json",
- "--service-account-json",
- "/creds/service_accounts/service-account-goma-client.json"
- ],
- "name": "ensure_goma.ensure_installed (2)",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-candidate-------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra_internal/goma/client/mac-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "gn",
- "gen",
- "out/Release",
- "--args=use_goma=true goma_dir=[START_DIR]/cipd/goma"
- ],
- "name": "gn"
- },
- {
- "cmd": [
- "python",
- "-u",
- "[START_DIR]/cipd/goma/goma_ctl.py",
- "restart"
- ],
- "env": {
- "GOMA_CACHE_DIR": "[CACHE]/goma",
- "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
- },
- "name": "start_goma"
- },
- {
- "cmd": [
- "python",
- "-u",
- "\nimport multiprocessing\nimport sys\n\njob_limit = 200\nif sys.platform.startswith('linux'):\n # Use 80 for linux not to load goma backend.\n job_limit = 80\n\ntry:\n jobs = min(job_limit, multiprocessing.cpu_count() * 10)\nexcept NotImplementedError:\n jobs = 50\n\nprint jobs\n"
- ],
- "name": "calculate the number of recommended jobs",
- "stdout": "/path/to/tmp/",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@import multiprocessing@@@",
- "@@@STEP_LOG_LINE@python.inline@import sys@@@",
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@job_limit = 200@@@",
- "@@@STEP_LOG_LINE@python.inline@if sys.platform.startswith('linux'):@@@",
- "@@@STEP_LOG_LINE@python.inline@ # Use 80 for linux not to load goma backend.@@@",
- "@@@STEP_LOG_LINE@python.inline@ job_limit = 80@@@",
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@try:@@@",
- "@@@STEP_LOG_LINE@python.inline@ jobs = min(job_limit, multiprocessing.cpu_count() * 10)@@@",
- "@@@STEP_LOG_LINE@python.inline@except NotImplementedError:@@@",
- "@@@STEP_LOG_LINE@python.inline@ jobs = 50@@@",
- "@@@STEP_LOG_LINE@python.inline@@@@",
- "@@@STEP_LOG_LINE@python.inline@print jobs@@@",
- "@@@STEP_LOG_END@python.inline@@@"
- ]
- },
- {
- "cmd": [
- "echo",
- "50"
- ],
- "name": "echo goma jobs"
- },
- {
- "cmd": [
- "echo",
- "50"
- ],
- "name": "echo goma jobs second"
- },
- {
- "cmd": [
- "python",
- "-u",
- "[START_DIR]/cipd/goma/goma_ctl.py",
- "jsonstatus",
- "[START_DIR]/cipd/goma/jsonstatus"
- ],
- "env": {
- "GOMA_CACHE_DIR": "[CACHE]/goma",
- "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
- },
- "name": "goma_jsonstatus"
- },
- {
- "cmd": [
- "python",
- "-u",
- "[START_DIR]/cipd/goma/goma_ctl.py",
- "stat"
- ],
- "env": {
- "GOMA_CACHE_DIR": "[CACHE]/goma",
- "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
- },
- "name": "goma_stat"
- },
- {
- "cmd": [
- "python",
- "-u",
- "[START_DIR]/cipd/goma/goma_ctl.py",
- "stop"
- ],
- "env": {
- "GOMA_CACHE_DIR": "[CACHE]/goma",
- "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
- },
- "name": "stop_goma"
- },
- {
- "name": "$result",
- "recipe_result": null,
- "status_code": 0
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/goma/example.py b/recipe_modules/goma/example.py
deleted file mode 100644
index 090bbe5..0000000
--- a/recipe_modules/goma/example.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 2016 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.
-
-DEPS = [
- 'goma',
- 'recipe_engine/platform',
- 'recipe_engine/properties',
- 'recipe_engine/step',
-]
-
-
-def RunSteps(api):
- api.goma.ensure_goma()
- api.goma.ensure_goma(canary=True)
- api.step('gn', ['gn', 'gen', 'out/Release',
- '--args=use_goma=true goma_dir=%s' % api.goma.goma_dir])
-
- with api.goma.build_with_goma(env={}):
- # build something using goma.
- api.step('echo goma jobs',
- ['echo', str(api.goma.recommended_goma_jobs)])
- api.step('echo goma jobs second',
- ['echo', str(api.goma.recommended_goma_jobs)])
-
-
-def GenTests(api):
- for platform in ('linux', 'mac'):
- properties = {
- 'buildername': 'test_builder',
- 'path_config': 'swarmbucket',
- }
-
- yield (api.test(platform) + api.platform.name(platform) +
- api.properties.generic(**properties))
diff --git a/recipe_modules/jiri/__init__.py b/recipe_modules/jiri/__init__.py
deleted file mode 100644
index 2f348fb..0000000
--- a/recipe_modules/jiri/__init__.py
+++ /dev/null
@@ -1,7 +0,0 @@
-DEPS = [
- 'cipd',
- 'recipe_engine/json',
- 'recipe_engine/path',
- 'recipe_engine/raw_io',
- 'recipe_engine/step',
-]
diff --git a/recipe_modules/jiri/api.py b/recipe_modules/jiri/api.py
deleted file mode 100644
index 90ad255..0000000
--- a/recipe_modules/jiri/api.py
+++ /dev/null
@@ -1,100 +0,0 @@
-# Copyright 2016 The Fuchsia 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 JiriApi(recipe_api.RecipeApi):
- """JiriApi provides support for Jiri managed checkouts."""
-
- def __init__(self, *args, **kwargs):
- super(JiriApi, self).__init__(*args, **kwargs)
- self._jiri_executable = None
-
- def __call__(self, *args, **kwargs):
- """Return a jiri command step."""
- assert self._jiri_executable
- name = kwargs.pop('name', 'jiri ' + args[0])
- jiri_cmd = [self._jiri_executable]
- return self.m.step(name, jiri_cmd + list(args), **kwargs)
-
- def ensure_jiri(self, version=None):
- with self.m.step.nest('ensure_jiri'):
- with self.m.step.context({'infra_step': True}):
- jiri_package = ('fuchsia/tools/jiri/%s' %
- self.m.cipd.platform_suffix())
- cipd_dir = self.m.path['start_dir'].join('cipd', 'jiri')
-
- self.m.cipd.ensure(cipd_dir,
- {jiri_package: version or 'latest'})
- self._jiri_executable = cipd_dir.join('jiri')
-
- return self._jiri_executable
-
- @property
- def jiri(self):
- return self._jiri_executable
-
- def init(self, dir=None, **kwargs):
- cmd = [ 'init', '-cache', self.m.path['cache'].join('git') ]
- if dir:
- cmd.append(dir)
-
- return self(*cmd, **kwargs)
-
- def describe(self, *projects, **kwargs):
- cmd = [
- 'project', 'info', '-json-output', self.m.json.output(),
- ] + list(projects)
- kwargs.setdefault('name', 'jiri project info')
-
- return self(
- *cmd,
- step_test_data=lambda: self.test_api.example_describe(projects),
- **kwargs
- )
-
- def update(self, gc=False, snapshot=None, **kwargs):
- cmd = [ 'update', '-autoupdate=false' ]
- if gc:
- cmd.extend(['-gc=true'])
- if snapshot is not None:
- cmd.append(snapshot)
-
- return self(*cmd, **kwargs)
-
- def clean_project(self, branches=False, **kwargs):
- cmd = [ 'project', 'clean' ]
- if branches:
- cmd.extend(['-branches=true'])
- kwargs.setdefault('name', 'jiri project clean')
-
- return self(*cmd, **kwargs)
-
- def import_manifest(self, manifest, remote, overwrite=False, **kwargs):
- cmd = [ 'import' ]
- if overwrite:
- cmd.extend(['-overwrite=true'])
- cmd.extend([manifest, remote])
-
- return self(*cmd, **kwargs)
-
- def patch(self, ref, host=None, delete=False, force=False, **kwargs):
- cmd = [ 'patch' ]
- if host:
- cmd.extend(['-host', host])
- if delete:
- cmd.extend(['-delete=true'])
- if force:
- cmd.extend(['-force=true'])
- cmd.extend([ref])
-
- return self(*cmd, **kwargs)
-
- def snapshot(self, file, step_test_data=None, **kwargs):
- return self(
- 'snapshot', file,
- step_test_data=step_test_data or self.test_api.example_snapshot,
- **kwargs
- )
diff --git a/recipe_modules/jiri/example.expected/basic.json b/recipe_modules/jiri/example.expected/basic.json
deleted file mode 100644
index 99d5e9d..0000000
--- a/recipe_modules/jiri/example.expected/basic.json
+++ /dev/null
@@ -1,131 +0,0 @@
-[
- {
- "cmd": [],
- "name": "ensure_jiri"
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "--root",
- "[START_DIR]/cipd/jiri",
- "--list",
- "fuchsia/tools/jiri/linux-amd64 latest",
- "--json-output",
- "/path/to/tmp/json"
- ],
- "name": "ensure_jiri.ensure_installed",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"fuchsia/tools/jiri/linux-amd64\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd/jiri/jiri",
- "init",
- "-cache",
- "[CACHE]/git",
- "dir"
- ],
- "name": "jiri init"
- },
- {
- "cmd": [
- "[START_DIR]/cipd/jiri/jiri",
- "import",
- "-overwrite=true",
- "minimal",
- "https://fuchsia.googlesource.com"
- ],
- "name": "jiri import"
- },
- {
- "cmd": [
- "[START_DIR]/cipd/jiri/jiri",
- "update",
- "-autoupdate=false",
- "-gc=true",
- "snapshot"
- ],
- "name": "jiri update"
- },
- {
- "cmd": [
- "[START_DIR]/cipd/jiri/jiri",
- "snapshot",
- "/path/to/tmp/"
- ],
- "name": "jiri snapshot",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@jiri.snapshot@@@@",
- "@@@STEP_LOG_LINE@jiri.snapshot@<manifest>@@@",
- "@@@STEP_LOG_LINE@jiri.snapshot@ <projects>@@@",
- "@@@STEP_LOG_LINE@jiri.snapshot@ <project name=\"manifest\" path=\"manifest\" remote=\"https://fuchsia.googlesource.com/manifest\" revision=\"4c2b0da3c06341db5cebe4d02c78c93c3b2bd78b\"/>@@@",
- "@@@STEP_LOG_LINE@jiri.snapshot@ </projects>@@@",
- "@@@STEP_LOG_LINE@jiri.snapshot@</manifest>@@@",
- "@@@STEP_LOG_END@jiri.snapshot@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd/jiri/jiri",
- "project",
- "info",
- "-json-output",
- "/path/to/tmp/json",
- "test"
- ],
- "name": "jiri project info",
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@[@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"branches\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ \"(HEAD detached at c22471f)\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"master\"@@@",
- "@@@STEP_LOG_LINE@json.output@ ], @@@",
- "@@@STEP_LOG_LINE@json.output@ \"current_branch\": \"\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"name\": \"test\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"path\": \"/path/to/repo\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"remote\": \"https://fuchsia.googlesource.com/repo\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"revision\": \"c22471f4e3f842ae18dd9adec82ed9eb78ed1127\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@]@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd/jiri/jiri",
- "patch",
- "-host",
- "https://fuchsia-review.googlesource.com",
- "-delete=true",
- "-force=true",
- "refs/changes/1/2/3"
- ],
- "name": "jiri patch"
- },
- {
- "cmd": [
- "[START_DIR]/cipd/jiri/jiri",
- "project",
- "clean",
- "-branches=true"
- ],
- "name": "jiri project clean"
- },
- {
- "name": "$result",
- "recipe_result": null,
- "status_code": 0
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/jiri/example.py b/recipe_modules/jiri/example.py
deleted file mode 100644
index 9c6fe50..0000000
--- a/recipe_modules/jiri/example.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# 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.
-
-DEPS = [
- 'jiri',
- 'recipe_engine/path',
- 'recipe_engine/platform',
- 'recipe_engine/properties',
- 'recipe_engine/raw_io',
- 'recipe_engine/step',
-]
-
-
-def RunSteps(api):
- # First, ensure we have jiri.
- api.jiri.ensure_jiri()
- assert api.jiri.jiri
-
- # Setup a new jiri root.
- api.jiri.init('dir')
-
- # Import the manifest.
- api.jiri.import_manifest('minimal', 'https://fuchsia.googlesource.com',
- overwrite=True)
-
- # Download all projects.
- api.jiri.update(gc=True, snapshot='snapshot')
-
- # Take a snapshot.
- step_result = api.jiri.snapshot(api.raw_io.output())
- snapshot = step_result.raw_io.output
- step_result.presentation.logs['jiri.snapshot'] = snapshot.splitlines()
-
- # Get information about the project.
- api.jiri.describe('test')
-
- # Patch in an existing change.
- api.jiri.patch('refs/changes/1/2/3',
- host='https://fuchsia-review.googlesource.com',
- delete=True, force=True)
-
- # Clean up after ourselves.
- api.jiri.clean_project(branches=True)
-
-
-def GenTests(api):
- yield api.test('basic')
diff --git a/recipe_modules/jiri/test_api.py b/recipe_modules/jiri/test_api.py
deleted file mode 100644
index 34c0167..0000000
--- a/recipe_modules/jiri/test_api.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2016 The Fuchsia 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_test_api
-
-
-class JiriTestApi(recipe_test_api.RecipeTestApi):
-
- def example_describe(self, projects):
- assert projects is not None
- return self.m.json.output([
- {
- "name": project,
- "path": "/path/to/repo",
- "remote": "https://fuchsia.googlesource.com/repo",
- "revision": "c22471f4e3f842ae18dd9adec82ed9eb78ed1127",
- "current_branch": "",
- "branches": [
- "(HEAD detached at c22471f)",
- "master"
- ]
- }
- for project in projects
- ])
-
- def example_snapshot(self):
- return self.m.raw_io.output('''
-<manifest>
- <projects>
- <project name="manifest" path="manifest" remote="https://fuchsia.googlesource.com/manifest" revision="4c2b0da3c06341db5cebe4d02c78c93c3b2bd78b"/>
- </projects>
-</manifest>
-''')
diff --git a/recipes.py b/recipes.py
deleted file mode 100755
index bf00b54..0000000
--- a/recipes.py
+++ /dev/null
@@ -1,240 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2016 The LUCI Authors. All rights reserved.
-# Use of this source code is governed under the Apache License, Version 2.0
-# that can be found in the LICENSE file.
-
-"""Bootstrap script to clone and forward to the recipe engine tool.
-
-***********************************************************************
-** DO NOT MODIFY EXCEPT IN THE PER-REPO CONFIGURATION SECTION BELOW. **
-***********************************************************************
-
-This is a copy of https://github.com/luci/recipes-py/blob/master/doc/recipes.py.
-To fix bugs, fix in the github repo then copy it back to here and fix the
-PER-REPO CONFIGURATION section to look like this one.
-"""
-
-import os
-
-#### PER-REPO CONFIGURATION (editable) ####
-# The root of the repository relative to the directory of this file.
-REPO_ROOT = ''
-# The path of the recipes.cfg file relative to the root of the repository.
-RECIPES_CFG = os.path.join('infra', 'config', 'recipes.cfg')
-#### END PER-REPO CONFIGURATION ####
-
-BOOTSTRAP_VERSION = 1
-
-import argparse
-import ast
-import json
-import logging
-import random
-import re
-import subprocess
-import sys
-import time
-import traceback
-
-from cStringIO import StringIO
-
-
-def parse(repo_root, recipes_cfg_path):
- """Parse is transitional code which parses a recipes.cfg file as either jsonpb
- or as textpb.
-
- Args:
- repo_root (str) - native path to the root of the repo we're trying to run
- recipes for.
- recipes_cfg_path (str) - native path to the recipes.cfg file to process.
-
- Returns (as tuple):
- engine_url (str) - the url to the engine repo we want to use.
- engine_revision (str) - the git revision for the engine to get.
- engine_subpath (str) - the subdirectory in the engine repo we should use to
- find it's recipes.py entrypoint. This is here for completeness, but will
- essentially always be empty. It would be used if the recipes-py repo was
- merged as a subdirectory of some other repo and you depended on that
- subdirectory.
- recipes_path (str) - native path to where the recipes live inside of the
- current repo (i.e. the folder containing `recipes/` and/or
- `recipe_modules`)
- """
- with open(recipes_cfg_path, 'rU') as fh:
- data = fh.read()
-
- if data.lstrip().startswith('{'):
- pb = json.loads(data)
- engine = next(
- (d for d in pb['deps'] if d['project_id'] == 'recipe_engine'), None)
- if engine is None:
- raise ValueError('could not find recipe_engine dep in %r'
- % recipes_cfg_path)
- engine_url = engine['url']
- engine_revision = engine['revision']
- engine_subpath = engine.get('path_override', '')
- recipes_path = pb.get('recipes_path', '')
- else:
- def get_unique(things):
- if len(things) == 1:
- return things[0]
- elif len(things) == 0:
- raise ValueError("Expected to get one thing, but dinna get none.")
- else:
- logging.warn('Expected to get one thing, but got a bunch: %s\n%s' %
- (things, traceback.format_stack()))
- return things[0]
-
- protobuf = parse_textpb(StringIO(data))
-
- engine_buf = get_unique([
- b for b in protobuf.get('deps', [])
- if b.get('project_id') == ['recipe_engine'] ])
- engine_url = get_unique(engine_buf['url'])
- engine_revision = get_unique(engine_buf['revision'])
- engine_subpath = (get_unique(engine_buf.get('path_override', ['']))
- .replace('/', os.path.sep))
- recipes_path = get_unique(protobuf.get('recipes_path', ['']))
-
- recipes_path = os.path.join(repo_root, recipes_path.replace('/', os.path.sep))
- return engine_url, engine_revision, engine_subpath, recipes_path
-
-
-def parse_textpb(fh):
- """Parse the protobuf text format just well enough to understand recipes.cfg.
-
- We don't use the protobuf library because we want to be as self-contained
- as possible in this bootstrap, so it can be simply vendored into a client
- repo.
-
- We assume all fields are repeated since we don't have a proto spec to work
- with.
-
- Args:
- fh: a filehandle containing the text format protobuf.
- Returns:
- A recursive dictionary of lists.
- """
- def parse_atom(field, text):
- if text == 'true':
- return True
- if text == 'false':
- return False
-
- # repo_type is an enum. Since it does not have quotes,
- # invoking literal_eval would fail.
- if field == 'repo_type':
- return text
-
- return ast.literal_eval(text)
-
- ret = {}
- for line in fh:
- line = line.strip()
- m = re.match(r'(\w+)\s*:\s*(.*)', line)
- if m:
- ret.setdefault(m.group(1), []).append(parse_atom(m.group(1), m.group(2)))
- continue
-
- m = re.match(r'(\w+)\s*{', line)
- if m:
- subparse = parse_textpb(fh)
- ret.setdefault(m.group(1), []).append(subparse)
- continue
-
- if line == '}':
- return ret
- if line == '':
- continue
-
- raise ValueError('Could not understand line: <%s>' % line)
-
- return ret
-
-
-def _subprocess_call(argv, **kwargs):
- logging.info('Running %r', argv)
- return subprocess.call(argv, **kwargs)
-
-
-def _subprocess_check_call(argv, **kwargs):
- logging.info('Running %r', argv)
- subprocess.check_call(argv, **kwargs)
-
-
-def find_engine_override(argv):
- """Since the bootstrap process attempts to defer all logic to the recipes-py
- repo, we need to be aware if the user is overriding the recipe_engine
- dependency. This looks for and returns the overridden recipe_engine path, if
- any, or None if the user didn't override it."""
- PREFIX = 'recipe_engine='
-
- p = argparse.ArgumentParser()
- p.add_argument('-O', '--project-override', action='append')
- args, _ = p.parse_known_args(argv)
- for override in args.project_override or ():
- if override.startswith(PREFIX):
- return override[len(PREFIX):]
- return None
-
-
-def main():
- if '--verbose' in sys.argv:
- logging.getLogger().setLevel(logging.INFO)
-
- if REPO_ROOT is None or RECIPES_CFG is None:
- logging.error(
- 'In order to use this script, please copy it to your repo and '
- 'replace the REPO_ROOT and RECIPES_CFG values with approprite paths.')
- sys.exit(1)
-
- if sys.platform.startswith(('win', 'cygwin')):
- git = 'git.bat'
- else:
- git = 'git'
-
- # Find the repository and config file to operate on.
- repo_root = os.path.abspath(
- os.path.join(os.path.dirname(__file__), REPO_ROOT))
- recipes_cfg_path = os.path.join(repo_root, RECIPES_CFG)
-
- engine_url, engine_revision, engine_subpath, recipes_path = parse(
- repo_root, recipes_cfg_path)
-
- deps_path = os.path.join(recipes_path, '.recipe_deps')
- engine_path = find_engine_override(sys.argv[1:])
- if not engine_path:
- # Ensure that we have the recipe engine cloned.
- engine_root_path = os.path.join(deps_path, 'recipe_engine')
- engine_path = os.path.join(engine_root_path, engine_subpath)
- def ensure_engine():
- if not os.path.exists(deps_path):
- os.makedirs(deps_path)
- if not os.path.exists(engine_root_path):
- _subprocess_check_call([git, 'clone', engine_url, engine_root_path])
-
- needs_fetch = _subprocess_call(
- [git, 'rev-parse', '--verify', '%s^{commit}' % engine_revision],
- cwd=engine_root_path, stdout=open(os.devnull, 'w'))
- if needs_fetch:
- _subprocess_check_call([git, 'fetch'], cwd=engine_root_path)
- _subprocess_check_call(
- [git, 'checkout', '--quiet', engine_revision], cwd=engine_root_path)
-
- try:
- ensure_engine()
- except subprocess.CalledProcessError:
- logging.exception('ensure_engine failed')
-
- # Retry errors.
- time.sleep(random.uniform(2,5))
- ensure_engine()
-
- args = ['--package', recipes_cfg_path] + sys.argv[1:]
- return _subprocess_call([
- sys.executable, '-u',
- os.path.join(engine_path, 'recipes.py')] + args)
-
-if __name__ == '__main__':
- sys.exit(main())