Esempio n. 1
0
def BaseConfig(**_kwargs):
    def render_cmd(lst):
        return [(x if isinstance(x, Placeholder) else str(x)) for x in lst]

    return ConfigGroup(
        # For compatibility with buildbot, the step name must be ascii, which is why
        # this is a 'str' and not a 'basestring'.
        name=Single(str),
        cmd=List(inner_type=(int, basestring, Path, Placeholder),
                 jsonish_fn=render_cmd),

        # optional
        env=Dict(item_fn=lambda (k, v): (k, v if v is None else str(v)),
                 value_type=(basestring, int, Path, type(None))),
        cwd=Single(Path, jsonish_fn=str, required=False),
        stdout=Single(Placeholder, required=False),
        stderr=Single(Placeholder, required=False),
        stdin=Single(Placeholder, required=False),
        allow_subannotations=Single(bool, required=False),
        trigger_specs=ConfigList(
            lambda: ConfigGroup(
                bucket=Single(basestring),
                builder_name=Single(basestring),
                properties=Dict(value_type=object),
                buildbot_changes=List(dict),
            ), ),
        step_test_data=Single(collections.Callable, required=False),
        ok_ret=Set(int),
        infra_step=Single(bool, required=False),
        step_nest_level=Single(int, required=False),
    )
Esempio n. 2
0
def BaseConfig(USE_MIRROR=True,
               CACHE_DIR=None,
               BUILDSPEC_VERSION=None,
               **_kwargs):
    cache_dir = str(CACHE_DIR) if CACHE_DIR else None
    return ConfigGroup(
        solutions=ConfigList(lambda: ConfigGroup(
            name=Single(basestring),
            url=Single((basestring, type(None)), empty_val=''),
            deps_file=Single(basestring,
                             empty_val='.DEPS.git',
                             required=False,
                             hidden=False),
            managed=Single(bool, empty_val=True, required=False, hidden=False),
            custom_deps=Dict(value_type=(basestring, types.NoneType)),
            custom_vars=Dict(value_type=(basestring, types.BooleanType)),
            safesync_url=Single(basestring, required=False),
            revision=Single((basestring, gclient_api.RevisionResolver),
                            required=False,
                            hidden=True),
        )),
        deps_os=Dict(value_type=basestring),
        hooks=List(basestring),
        target_os=Set(basestring),
        target_os_only=Single(bool, empty_val=False, required=False),
        target_cpu=Set(basestring),
        target_cpu_only=Single(bool, empty_val=False, required=False),
        cache_dir=Static(cache_dir, hidden=False),

        # If supplied, use this as the source root (instead of the first solution's
        # checkout).
        src_root=Single(basestring, required=False, hidden=True),

        # Maps 'solution' -> build_property
        # TODO(machenbach): Deprecate this in favor of the one below.
        # http://crbug.com/713356
        got_revision_mapping=Dict(hidden=True),

        # Maps build_property -> 'solution'
        got_revision_reverse_mapping=Dict(hidden=True),

        # Addition revisions we want to pass in.  For now theres a duplication
        # of code here of setting custom vars AND passing in --revision. We hope
        # to remove custom vars later.
        revisions=Dict(value_type=(basestring, gclient_api.RevisionResolver),
                       hidden=True),

        # TODO(iannucci): HACK! The use of None here to indicate that we apply this
        #   to the solution.revision field is really terrible. I mostly blame
        #   gclient.
        # Maps 'parent_build_property' -> 'custom_var_name'
        # Maps 'parent_build_property' -> None
        # If value is None, the property value will be applied to
        # solutions[0].revision. Otherwise, it will be applied to
        # solutions[0].custom_vars['custom_var_name']
        parent_got_revision_mapping=Dict(hidden=True),
        delete_unversioned_trees=Single(bool, empty_val=True, required=False),

        # Maps canonical repo URL to (local_path, revision).
        #  - canonical gitiles repo URL is "https://<host>/<project>"
        #    where project does not have "/a/" prefix or ".git" suffix.
        #  - solution/path is then used to apply patches as patch root in
        #    bot_update.
        #  - if revision is given, it's passed verbatim to bot_update for
        #    corresponding dependency. Otherwise (i.e. None), the patch will be
        #    applied on top of version pinned in DEPS.
        # This is essentially a whitelist of which repos inside a solution
        # can be patched automatically by bot_update based on
        # api.buildbucket.build.input.gerrit_changes[0].project
        # For example, if bare chromium solution has this entry in repo_path_map
        #     'http://103.210.161.2:3232/angle/angle': (
        #       'src/third_party/angle', 'HEAD')
        # then a patch to Angle project can be applied to a chromium src's
        # checkout after first updating Angle's repo to its master's HEAD.
        repo_path_map=Dict(value_type=tuple, hidden=True),

        # Check out refs/branch-heads.
        # TODO (machenbach): Only implemented for bot_update atm.
        with_branch_heads=Single(bool,
                                 empty_val=False,
                                 required=False,
                                 hidden=True),

        # Check out refs/tags.
        with_tags=Single(bool, empty_val=False, required=False, hidden=True),
        disable_syntax_validation=Single(bool, empty_val=False,
                                         required=False),
        USE_MIRROR=Static(bool(USE_MIRROR)),
        BUILDSPEC_VERSION=Static(BUILDSPEC_VERSION, hidden=True),
    )
Esempio n. 3
0
def BaseConfig(USE_MIRROR=True,
               GIT_MODE=False,
               CACHE_DIR=None,
               PATCH_PROJECT=None,
               BUILDSPEC_VERSION=None,
               **_kwargs):
    deps = '.DEPS.git' if GIT_MODE else 'DEPS'
    cache_dir = str(CACHE_DIR) if CACHE_DIR else None
    return ConfigGroup(
        solutions=ConfigList(lambda: ConfigGroup(
            name=Single(basestring),
            url=Single(basestring),
            deps_file=Single(
                basestring, empty_val=deps, required=False, hidden=False),
            managed=Single(bool, empty_val=True, required=False, hidden=False),
            custom_deps=Dict(value_type=(basestring, types.NoneType)),
            custom_vars=Dict(value_type=basestring),
            safesync_url=Single(basestring, required=False),
            revision=Single((basestring, gclient_api.RevisionResolver),
                            required=False,
                            hidden=True),
        )),
        deps_os=Dict(value_type=basestring),
        hooks=List(basestring),
        target_os=Set(basestring),
        target_os_only=Single(bool, empty_val=False, required=False),
        cache_dir=Static(cache_dir, hidden=False),

        # If supplied, use this as the source root (instead of the first solution's
        # checkout).
        src_root=Single(basestring, required=False, hidden=True),

        # Maps 'solution' -> build_property
        got_revision_mapping=Dict(hidden=True),

        # Addition revisions we want to pass in.  For now theres a duplication
        # of code here of setting custom vars AND passing in --revision. We hope
        # to remove custom vars later.
        revisions=Dict(value_type=(basestring, gclient_api.RevisionResolver),
                       hidden=True),

        # TODO(iannucci): HACK! The use of None here to indicate that we apply this
        #   to the solution.revision field is really terrible. I mostly blame
        #   gclient.
        # Maps 'parent_build_property' -> 'custom_var_name'
        # Maps 'parent_build_property' -> None
        # If value is None, the property value will be applied to
        # solutions[0].revision. Otherwise, it will be applied to
        # solutions[0].custom_vars['custom_var_name']
        parent_got_revision_mapping=Dict(hidden=True),
        delete_unversioned_trees=Single(bool, empty_val=True, required=False),

        # Maps patch_project to (solution/path, revision).
        #  - solution/path is then used to apply patches as patch root in
        #    bot_update.
        #  - if revision is given, it's passed verbatim to bot_update for
        #    corresponding dependency. Otherwise (ie None), the patch will be
        #    applied on top of version pinned in DEPS.
        # This is essentially a whitelist of which projects inside a solution
        # can be patched automatically by bot_update based on PATCH_PROJECT
        # property.
        # For example, bare chromium solution has this entry in patch_projects
        #     'angle/angle': ('src/third_party/angle', 'HEAD')
        # then a patch to Angle project can be applied to a chromium src's
        # checkout after first updating Angle's repo to its master's HEAD.
        patch_projects=Dict(value_type=tuple, hidden=True),

        # Check out refs/branch-heads.
        # TODO (machenbach): Only implemented for bot_update atm.
        with_branch_heads=Single(bool,
                                 empty_val=False,
                                 required=False,
                                 hidden=True),
        GIT_MODE=Static(bool(GIT_MODE)),
        USE_MIRROR=Static(bool(USE_MIRROR)),
        # TODO(tandrii): remove PATCH_PROJECT field.
        # DON'T USE THIS. WILL BE REMOVED.
        PATCH_PROJECT=Static(str(PATCH_PROJECT), hidden=True),
        BUILDSPEC_VERSION=Static(BUILDSPEC_VERSION, hidden=True),
    )
Esempio n. 4
0
    'path',
    'platform',
    'properties',
    'service_account',
    'step',
]

PROPERTIES = {
    'use_pkg':
    Property(default=False, kind=bool),
    'pkg_files':
    Property(default=(), kind=List(str)),
    'pkg_dirs':
    Property(default=(),
             kind=ConfigList(lambda: ConfigGroup(
                 path=Single(str),
                 exclusions=List(str),
             ))),
    'pkg_vars':
    Property(default=None, kind=dict),
    'ver_files':
    Property(default=(), kind=List(str)),
    'install_mode':
    Property(default=None),
    'refs':
    Property(default=['fake-ref-1', 'fake-ref-2'], kind=List(str)),
    'tags':
    Property(kind=dict,
             default={
                 'fake_tag_1': 'fake_value_1',
                 'fake_tag_2': 'fake_value_2'
             }),
Esempio n. 5
0
def BaseConfig(USE_MIRROR=True, GIT_MODE=False, CACHE_DIR=None,
               PATCH_PROJECT=None, BUILDSPEC_VERSION=None,
               **_kwargs):
  deps = '.DEPS.git' if GIT_MODE else 'DEPS'
  cache_dir = str(CACHE_DIR) if GIT_MODE and CACHE_DIR else None
  return ConfigGroup(
    solutions = ConfigList(
      lambda: ConfigGroup(
        name = Single(basestring),
        url = Single(basestring),
        deps_file = Single(basestring, empty_val=deps, required=False,
                           hidden=False),
        managed = Single(bool, empty_val=True, required=False, hidden=False),
        custom_deps = Dict(value_type=(basestring, types.NoneType)),
        custom_vars = Dict(value_type=basestring),
        safesync_url = Single(basestring, required=False),

        revision = Single(
            (basestring, gclient_api.RevisionResolver),
            required=False, hidden=True),
      )
    ),
    deps_os = Dict(value_type=basestring),
    hooks = List(basestring),
    target_os = Set(basestring),
    target_os_only = Single(bool, empty_val=False, required=False),
    cache_dir = Static(cache_dir, hidden=False),

    # If supplied, use this as the source root (instead of the first solution's
    # checkout).
    src_root = Single(basestring, required=False, hidden=True),

    # Maps 'solution' -> build_property
    got_revision_mapping = Dict(hidden=True),

    # Addition revisions we want to pass in.  For now theres a duplication
    # of code here of setting custom vars AND passing in --revision. We hope
    # to remove custom vars later.
    revisions = Dict(
        value_type=(basestring, gclient_api.RevisionResolver),
        hidden=True),

    # TODO(iannucci): HACK! The use of None here to indicate that we apply this
    #   to the solution.revision field is really terrible. I mostly blame
    #   gclient.
    # Maps 'parent_build_property' -> 'custom_var_name'
    # Maps 'parent_build_property' -> None
    # If value is None, the property value will be applied to
    # solutions[0].revision. Otherwise, it will be applied to
    # solutions[0].custom_vars['custom_var_name']
    parent_got_revision_mapping = Dict(hidden=True),
    delete_unversioned_trees = Single(bool, empty_val=True, required=False),

    # Check out refs/branch-heads.
    # TODO (machenbach): Only implemented for bot_update atm.
    with_branch_heads = Single(
        bool,
        empty_val=False,
        required=False,
        hidden=True),

    GIT_MODE = Static(bool(GIT_MODE)),
    USE_MIRROR = Static(bool(USE_MIRROR)),
    PATCH_PROJECT = Static(str(PATCH_PROJECT), hidden=True),
    BUILDSPEC_VERSION= Static(BUILDSPEC_VERSION, hidden=True),
  )
Esempio n. 6
0
    "recipe_engine/platform",
    "recipe_engine/properties",
    "recipe_engine/raw_io",
    "recipe_engine/step",
    "recipe_engine/tricium",
]

PROPERTIES = {
    "cipd_packages":
        Property(
            help="CIPD packages containing necessary binaries.",
            kind=ConfigList(
                lambda: ConfigGroup(
                    # Package name.
                    name=Single(str),
                    # Version.
                    version=Single(str),
                    # Language subdirectory (e.g. clang) in which to put the package. The Tricium modules assume a Fuchsia prebuilts-like layout.
                    subdir=Single(str),
                )
            ),
            default={},
        ),
}

# Namedtuple to simulate a class generated by jiri checkout because flutter is
# not using jiri.
_CheckoutResult = collections.namedtuple(
    '_CheckoutResult', ['root_dir', 'release_version']
)

Esempio n. 7
0
    'recipe_engine/path',
    'recipe_engine/properties',
    'recipe_engine/python',
    'recipe_engine/runtime',
    'recipe_engine/step',
    'depot_tools/git',
    'support_3pp',
]

PROPERTIES = {
    'package_locations':
    Property(help=('URL of repo containing package definitions.'
                   'Cross-compiling requires docker on $PATH.'),
             kind=ConfigList(
                 lambda: ConfigGroup(
                     repo=Single(str),
                     ref=Single(str, required=False),
                     subdir=Single(str, required=False),
                 ), )),
    'to_build':
    Property(
        help=
        ('The names (and optionally versions) of the packages to build and upload.'
         ' Leave empty to build and upload all known packages. If you want to '
         'specify a version other than "latest", pass the package name like '
         '"[email protected]".'),
        kind=List(str),
        default=(),
    ),
    'platform':
    Property(
        kind=str,