summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandan Singh <chandan@chandansingh.net>2020-05-07 19:58:18 +0000
committerChandan Singh <chandan@chandansingh.net>2020-05-13 20:04:15 +0000
commita34ff401b4fa3d3649b46ecc336fa27a110373fa (patch)
tree3af7f4f40748bd628b2c23fdf85bc3e83ae9253d
parent0769103ca25f113ab8e64bafb264781199a4dcac (diff)
downloadbuildstream-a34ff401b4fa3d3649b46ecc336fa27a110373fa.tar.gz
_frontend/cli: Support "build" value for `bst build --deps`
This can be quite handy when one is preparing to open a build shell. This originally came up in https://gitlab.com/BuildStream/buildstream/-/issues/685#note_105460896.
-rw-r--r--NEWS1
-rw-r--r--src/buildstream/_frontend/cli.py5
-rw-r--r--tests/frontend/buildcheckout.py16
3 files changed, 21 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 10563b127..984d4343c 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ CLI
---
o `bst shell --build` will now automatically fetch missing sources.
+ o `bst build --deps` now also accepts "build" as an input.
Format
diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index e8e2112aa..b8fd55b08 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -460,7 +460,9 @@ def init(app, project_name, min_version, element_path, force, target_directory):
"--deps",
"-d",
default=None,
- type=FastEnumType(_PipelineSelection, [_PipelineSelection.PLAN, _PipelineSelection.ALL]),
+ type=FastEnumType(
+ _PipelineSelection, [_PipelineSelection.BUILD, _PipelineSelection.PLAN, _PipelineSelection.ALL],
+ ),
help="The dependencies to build",
)
@click.option(
@@ -482,6 +484,7 @@ def build(app, elements, deps, remote):
\b
plan: Only dependencies required for the build plan
+ build: Build time dependencies, excluding the element itself
all: All dependencies
"""
with app.initialized(session_name="Build"):
diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py
index 96c96ccfe..ca88a1368 100644
--- a/tests/frontend/buildcheckout.py
+++ b/tests/frontend/buildcheckout.py
@@ -189,6 +189,22 @@ def test_build_checkout_deps(datafiles, cli, deps):
@pytest.mark.datafiles(DATA_DIR)
+def test_build_deps_build(datafiles, cli):
+ project = str(datafiles)
+ target = "checkout-deps.bst"
+ build_dep = "import-dev.bst"
+ runtime_dep = "import-bin.bst"
+
+ result = cli.run(project=project, args=["build", "--deps", "build", target])
+ result.assert_success()
+
+ states = cli.get_element_states(project, [target, build_dep, runtime_dep])
+ assert states[build_dep] == "cached"
+ assert states[target] == "buildable"
+ assert states[runtime_dep] == "buildable"
+
+
+@pytest.mark.datafiles(DATA_DIR)
def test_build_checkout_unbuilt(datafiles, cli):
project = str(datafiles)
checkout = os.path.join(cli.directory, "checkout")