blob: 3d6d8fa301e5fcd09d0afad55ad6c1ba58f16516 [file] [log] [blame]
# Copyright 2020 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.
"""Recipe to build the Linux host sysroot and upload it to CIPD."""
from recipe_engine.recipe_api import Property
DEPS = [
"fuchsia/build",
"fuchsia/build_input_resolver",
"fuchsia/checkout",
"fuchsia/status_check",
"fuchsia/upload",
"recipe_engine/buildbucket",
"recipe_engine/path",
"recipe_engine/properties",
"recipe_engine/step",
]
PROPERTIES = {
"manifest": Property(kind=str, help="Jiri manifest to use"),
"remote": Property(kind=str, help="Remote manifest repository"),
"fint_params_path": Property(kind=str, help="Path to a fint params file"),
}
PACKAGE = "fuchsia/third_party/sysroot/linux"
def RunSteps(api, manifest, remote, fint_params_path):
api.build_input_resolver.resolve(
default_project_url="https://fuchsia.googlesource.com/fuchsia"
)
bb_build = api.buildbucket.build
checkout = api.checkout.fuchsia_with_options(
path=api.path["start_dir"].join("linux_sysroot"),
manifest=manifest,
remote=remote,
)
build_results = api.build.with_options(
checkout=checkout, fint_params_path=fint_params_path
)
packages_lockfile = checkout.root_dir.join(
"tools", "debroot", "cmd", "packages.lock"
)
sysroot_dir = api.path.mkdtemp("sysroot")
debroot = build_results.tool("debroot")
api.step(
"generate sysroot",
[debroot, "install", "-out", sysroot_dir, packages_lockfile],
)
commit = bb_build.input.gitiles_commit
repository = "https://%s/%s" % (commit.host, commit.project)
api.upload.cipd_package(
PACKAGE,
sysroot_dir,
[api.upload.DirectoryPath(sysroot_dir)],
search_tag={"git_revision": commit.id},
repository=repository,
)
def GenTests(api):
yield (
api.status_check.test("basic")
+ api.buildbucket.ci_build(git_repo="https://fuchsia.googlesource.com/fuchsia")
+ api.properties(
manifest="minimal",
remote="https://fuchsia.googlesource.com/fuchsia",
fint_params_path="specs/linux-sysroot.textproto",
)
)