Skip to content

Commit 948c3f3

Browse files
committed
cli: add --use-buildtrees option for artifacts checkout
Add support for checking out build trees via bst artifacts checkout, similar to the existing bst shell --use-buildtrees functionality.
1 parent 9412787 commit 948c3f3

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎src/buildstream/_frontend/cli.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,16 @@ def artifact_show(app, deps, artifact_remotes, ignore_project_artifact_remotes,
13791379
is_flag=True,
13801380
help="Ignore remote artifact cache servers recommended by projects",
13811381
)
1382+
@click.option(
1383+
"--use-buildtree",
1384+
"-t",
1385+
"cli_buildtree",
1386+
is_flag=True,
1387+
help=(
1388+
"Stage a buildtree. Will fail if a buildtree is not available. "
1389+
"pull-buildtrees configuration is needed if the buildtree is not available locally."
1390+
),
1391+
)
13821392
@click.argument("target", required=False, type=click.Path(readable=False))
13831393
@click.pass_obj
13841394
def artifact_checkout(
@@ -1392,6 +1402,7 @@ def artifact_checkout(
13921402
directory,
13931403
artifact_remotes,
13941404
ignore_project_artifact_remotes,
1405+
cli_buildtree,
13951406
target,
13961407
):
13971408
"""Checkout contents of an artifact
@@ -1454,6 +1465,7 @@ def artifact_checkout(
14541465
tar=bool(tar),
14551466
artifact_remotes=artifact_remotes,
14561467
ignore_project_artifact_remotes=ignore_project_artifact_remotes,
1468+
usebuildtree=cli_buildtree,
14571469
)
14581470

14591471

‎src/buildstream/_stream.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,7 @@ def checkout(
695695
tar: bool = False,
696696
artifact_remotes: Iterable[RemoteSpec] = (),
697697
ignore_project_artifact_remotes: bool = False,
698+
usebuildtree: bool = False,
698699
):
699700

700701
elements = self._load(
@@ -728,7 +729,7 @@ def checkout(
728729
_PipelineSelection.NONE: _Scope.NONE,
729730
_PipelineSelection.ALL: _Scope.ALL,
730731
}
731-
with element._prepare_sandbox(scope=scope[selection], integrate=integrate) as sandbox:
732+
with element._prepare_sandbox(scope=scope[selection], integrate=integrate, usebuildtree=usebuildtree) as sandbox:
732733
# Copy or move the sandbox to the target directory
733734
virdir = sandbox.get_virtual_directory()
734735
self._export_artifact(tar, location, compression, element, hardlinks, virdir)

0 commit comments

Comments
 (0)