summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbst-marge-bot <marge-bot@buildstream.build>2020-08-14 18:58:07 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2020-08-14 18:58:07 +0000
commit47ec22e656b17ba59432b619befa5fd24bdea7bd (patch)
treefb0a844d6e803c4caa3428cc37f486ad30ec551a
parent6daae554ddf6e1c3e25cdbaad6ac56c5398b8c84 (diff)
parent5e5fa67bfd9610763f8fa334a78162f143a53c9f (diff)
downloadbuildstream-47ec22e656b17ba59432b619befa5fd24bdea7bd.tar.gz
Merge branch 'chandan/cli-track-deps' into 'master'
_frontend/cli: Add --deps `build` & `run` values for `source track --deps` See merge request BuildStream/buildstream!2027
-rw-r--r--NEWS1
-rw-r--r--man/bst-artifact-checkout.12
-rw-r--r--man/bst-artifact-delete.12
-rw-r--r--man/bst-artifact-list-contents.12
-rw-r--r--man/bst-artifact-log.12
-rw-r--r--man/bst-artifact-pull.12
-rw-r--r--man/bst-artifact-push.12
-rw-r--r--man/bst-artifact-server.12
-rw-r--r--man/bst-artifact-show.12
-rw-r--r--man/bst-artifact.12
-rw-r--r--man/bst-build.12
-rw-r--r--man/bst-help.12
-rw-r--r--man/bst-init.12
-rw-r--r--man/bst-shell.12
-rw-r--r--man/bst-show.12
-rw-r--r--man/bst-source-checkout.12
-rw-r--r--man/bst-source-fetch.12
-rw-r--r--man/bst-source-push.12
-rw-r--r--man/bst-source-track.14
-rw-r--r--man/bst-source.12
-rw-r--r--man/bst-workspace-close.12
-rw-r--r--man/bst-workspace-list.12
-rw-r--r--man/bst-workspace-open.12
-rw-r--r--man/bst-workspace-reset.12
-rw-r--r--man/bst-workspace.12
-rw-r--r--man/bst.12
-rw-r--r--src/buildstream/_frontend/cli.py5
-rw-r--r--tests/frontend/completions.py2
-rw-r--r--tests/frontend/source-track/apples.bst5
-rw-r--r--tests/frontend/source-track/bananas.bst11
-rw-r--r--tests/frontend/source-track/files/apples1
-rw-r--r--tests/frontend/source-track/files/bananas1
-rw-r--r--tests/frontend/source-track/files/oranges1
-rw-r--r--tests/frontend/source-track/oranges.bst5
-rw-r--r--tests/frontend/track.py41
35 files changed, 96 insertions, 29 deletions
diff --git a/NEWS b/NEWS
index b0f8650db..ff460e507 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ CLI
o Add `bst source push` subcommand. This command pushes element sources to a
remote source cache.
+ o `bst source track` now also accepts "build" and "run" as inputs.
Artifacts
---------
diff --git a/man/bst-artifact-checkout.1 b/man/bst-artifact-checkout.1
index e992c6ccd..d9d62d875 100644
--- a/man/bst-artifact-checkout.1
+++ b/man/bst-artifact-checkout.1
@@ -1,4 +1,4 @@
-.TH "BST ARTIFACT CHECKOUT" "1" "2020-07-01" "" "bst artifact checkout Manual"
+.TH "BST ARTIFACT CHECKOUT" "1" "2020-08-13" "" "bst artifact checkout Manual"
.SH NAME
bst\-artifact\-checkout \- Checkout contents of an artifact
.SH SYNOPSIS
diff --git a/man/bst-artifact-delete.1 b/man/bst-artifact-delete.1
index b1dc10607..76c383d6b 100644
--- a/man/bst-artifact-delete.1
+++ b/man/bst-artifact-delete.1
@@ -1,4 +1,4 @@
-.TH "BST ARTIFACT DELETE" "1" "2020-07-01" "" "bst artifact delete Manual"
+.TH "BST ARTIFACT DELETE" "1" "2020-08-13" "" "bst artifact delete Manual"
.SH NAME
bst\-artifact\-delete \- Remove artifacts from the local cache
.SH SYNOPSIS
diff --git a/man/bst-artifact-list-contents.1 b/man/bst-artifact-list-contents.1
index b0160d75c..e3d5f1487 100644
--- a/man/bst-artifact-list-contents.1
+++ b/man/bst-artifact-list-contents.1
@@ -1,4 +1,4 @@
-.TH "BST ARTIFACT LIST-CONTENTS" "1" "2020-07-01" "" "bst artifact list-contents Manual"
+.TH "BST ARTIFACT LIST-CONTENTS" "1" "2020-08-13" "" "bst artifact list-contents Manual"
.SH NAME
bst\-artifact\-list-contents \- List the contents of an artifact
.SH SYNOPSIS
diff --git a/man/bst-artifact-log.1 b/man/bst-artifact-log.1
index 58b3cec23..769907e21 100644
--- a/man/bst-artifact-log.1
+++ b/man/bst-artifact-log.1
@@ -1,4 +1,4 @@
-.TH "BST ARTIFACT LOG" "1" "2020-07-01" "" "bst artifact log Manual"
+.TH "BST ARTIFACT LOG" "1" "2020-08-13" "" "bst artifact log Manual"
.SH NAME
bst\-artifact\-log \- Show logs of artifacts
.SH SYNOPSIS
diff --git a/man/bst-artifact-pull.1 b/man/bst-artifact-pull.1
index 15ad9e726..c31b1b4c9 100644
--- a/man/bst-artifact-pull.1
+++ b/man/bst-artifact-pull.1
@@ -1,4 +1,4 @@
-.TH "BST ARTIFACT PULL" "1" "2020-07-01" "" "bst artifact pull Manual"
+.TH "BST ARTIFACT PULL" "1" "2020-08-13" "" "bst artifact pull Manual"
.SH NAME
bst\-artifact\-pull \- Pull a built artifact
.SH SYNOPSIS
diff --git a/man/bst-artifact-push.1 b/man/bst-artifact-push.1
index 9d71aacf8..cb312c9e5 100644
--- a/man/bst-artifact-push.1
+++ b/man/bst-artifact-push.1
@@ -1,4 +1,4 @@
-.TH "BST ARTIFACT PUSH" "1" "2020-07-01" "" "bst artifact push Manual"
+.TH "BST ARTIFACT PUSH" "1" "2020-08-13" "" "bst artifact push Manual"
.SH NAME
bst\-artifact\-push \- Push a built artifact
.SH SYNOPSIS
diff --git a/man/bst-artifact-server.1 b/man/bst-artifact-server.1
index f3af6e705..d7120a1a1 100644
--- a/man/bst-artifact-server.1
+++ b/man/bst-artifact-server.1
@@ -1,4 +1,4 @@
-.TH "BST-ARTIFACT-SERVER" "1" "2020-07-01" "" "bst-artifact-server Manual"
+.TH "BST-ARTIFACT-SERVER" "1" "2020-08-13" "" "bst-artifact-server Manual"
.SH NAME
bst-artifact-server \- CAS Artifact Server
.SH SYNOPSIS
diff --git a/man/bst-artifact-show.1 b/man/bst-artifact-show.1
index cff3f4954..fc59ba320 100644
--- a/man/bst-artifact-show.1
+++ b/man/bst-artifact-show.1
@@ -1,4 +1,4 @@
-.TH "BST ARTIFACT SHOW" "1" "2020-07-01" "" "bst artifact show Manual"
+.TH "BST ARTIFACT SHOW" "1" "2020-08-13" "" "bst artifact show Manual"
.SH NAME
bst\-artifact\-show \- Show the cached state of artifacts
.SH SYNOPSIS
diff --git a/man/bst-artifact.1 b/man/bst-artifact.1
index bb1feade0..3cb170557 100644
--- a/man/bst-artifact.1
+++ b/man/bst-artifact.1
@@ -1,4 +1,4 @@
-.TH "BST ARTIFACT" "1" "2020-07-01" "" "bst artifact Manual"
+.TH "BST ARTIFACT" "1" "2020-08-13" "" "bst artifact Manual"
.SH NAME
bst\-artifact \- Manipulate cached artifacts.
.SH SYNOPSIS
diff --git a/man/bst-build.1 b/man/bst-build.1
index 2842089aa..a5a25536b 100644
--- a/man/bst-build.1
+++ b/man/bst-build.1
@@ -1,4 +1,4 @@
-.TH "BST BUILD" "1" "2020-07-01" "" "bst build Manual"
+.TH "BST BUILD" "1" "2020-08-13" "" "bst build Manual"
.SH NAME
bst\-build \- Build elements in a pipeline
.SH SYNOPSIS
diff --git a/man/bst-help.1 b/man/bst-help.1
index 459c91aeb..efd495ba1 100644
--- a/man/bst-help.1
+++ b/man/bst-help.1
@@ -1,4 +1,4 @@
-.TH "BST HELP" "1" "2020-07-01" "" "bst help Manual"
+.TH "BST HELP" "1" "2020-08-13" "" "bst help Manual"
.SH NAME
bst\-help \- Print usage information
.SH SYNOPSIS
diff --git a/man/bst-init.1 b/man/bst-init.1
index 91dc924bb..433b7de67 100644
--- a/man/bst-init.1
+++ b/man/bst-init.1
@@ -1,4 +1,4 @@
-.TH "BST INIT" "1" "2020-07-01" "" "bst init Manual"
+.TH "BST INIT" "1" "2020-08-13" "" "bst init Manual"
.SH NAME
bst\-init \- Initialize a new BuildStream project
.SH SYNOPSIS
diff --git a/man/bst-shell.1 b/man/bst-shell.1
index 54e694721..925ae1f56 100644
--- a/man/bst-shell.1
+++ b/man/bst-shell.1
@@ -1,4 +1,4 @@
-.TH "BST SHELL" "1" "2020-07-01" "" "bst shell Manual"
+.TH "BST SHELL" "1" "2020-08-13" "" "bst shell Manual"
.SH NAME
bst\-shell \- Shell into an element's sandbox environment
.SH SYNOPSIS
diff --git a/man/bst-show.1 b/man/bst-show.1
index a4ded7204..eaee58be6 100644
--- a/man/bst-show.1
+++ b/man/bst-show.1
@@ -1,4 +1,4 @@
-.TH "BST SHOW" "1" "2020-07-01" "" "bst show Manual"
+.TH "BST SHOW" "1" "2020-08-13" "" "bst show Manual"
.SH NAME
bst\-show \- Show elements in the pipeline
.SH SYNOPSIS
diff --git a/man/bst-source-checkout.1 b/man/bst-source-checkout.1
index e0a806951..f450d97f3 100644
--- a/man/bst-source-checkout.1
+++ b/man/bst-source-checkout.1
@@ -1,4 +1,4 @@
-.TH "BST SOURCE CHECKOUT" "1" "2020-07-01" "" "bst source checkout Manual"
+.TH "BST SOURCE CHECKOUT" "1" "2020-08-13" "" "bst source checkout Manual"
.SH NAME
bst\-source\-checkout \- Checkout sources of an element
.SH SYNOPSIS
diff --git a/man/bst-source-fetch.1 b/man/bst-source-fetch.1
index a0a832010..4fc2633a2 100644
--- a/man/bst-source-fetch.1
+++ b/man/bst-source-fetch.1
@@ -1,4 +1,4 @@
-.TH "BST SOURCE FETCH" "1" "2020-07-01" "" "bst source fetch Manual"
+.TH "BST SOURCE FETCH" "1" "2020-08-13" "" "bst source fetch Manual"
.SH NAME
bst\-source\-fetch \- Fetch sources in a pipeline
.SH SYNOPSIS
diff --git a/man/bst-source-push.1 b/man/bst-source-push.1
index edb2996c3..d517e74b5 100644
--- a/man/bst-source-push.1
+++ b/man/bst-source-push.1
@@ -1,4 +1,4 @@
-.TH "BST SOURCE PUSH" "1" "2020-07-01" "" "bst source push Manual"
+.TH "BST SOURCE PUSH" "1" "2020-08-13" "" "bst source push Manual"
.SH NAME
bst\-source\-push \- Push sources in a pipeline
.SH SYNOPSIS
diff --git a/man/bst-source-track.1 b/man/bst-source-track.1
index ed5236eea..3cd3b17b5 100644
--- a/man/bst-source-track.1
+++ b/man/bst-source-track.1
@@ -1,4 +1,4 @@
-.TH "BST SOURCE TRACK" "1" "2020-07-01" "" "bst source track Manual"
+.TH "BST SOURCE TRACK" "1" "2020-08-13" "" "bst source track Manual"
.SH NAME
bst\-source\-track \- Track new source references
.SH SYNOPSIS
@@ -30,7 +30,7 @@ Specify `--deps` to control which sources to track:
\fB\-\-except\fP PATH
Except certain dependencies from tracking
.TP
-\fB\-d,\fP \-\-deps [none|all]
+\fB\-d,\fP \-\-deps [build|run|all|none]
The dependencies to track [default: none]
.TP
\fB\-J,\fP \-\-cross\-junctions
diff --git a/man/bst-source.1 b/man/bst-source.1
index f53f26b7a..94a268a57 100644
--- a/man/bst-source.1
+++ b/man/bst-source.1
@@ -1,4 +1,4 @@
-.TH "BST SOURCE" "1" "2020-07-01" "" "bst source Manual"
+.TH "BST SOURCE" "1" "2020-08-13" "" "bst source Manual"
.SH NAME
bst\-source \- Manipulate sources for an element
.SH SYNOPSIS
diff --git a/man/bst-workspace-close.1 b/man/bst-workspace-close.1
index b628ae4e7..6abce3485 100644
--- a/man/bst-workspace-close.1
+++ b/man/bst-workspace-close.1
@@ -1,4 +1,4 @@
-.TH "BST WORKSPACE CLOSE" "1" "2020-07-01" "" "bst workspace close Manual"
+.TH "BST WORKSPACE CLOSE" "1" "2020-08-13" "" "bst workspace close Manual"
.SH NAME
bst\-workspace\-close \- Close workspaces
.SH SYNOPSIS
diff --git a/man/bst-workspace-list.1 b/man/bst-workspace-list.1
index 8dc26eb3e..4e7aacd52 100644
--- a/man/bst-workspace-list.1
+++ b/man/bst-workspace-list.1
@@ -1,4 +1,4 @@
-.TH "BST WORKSPACE LIST" "1" "2020-07-01" "" "bst workspace list Manual"
+.TH "BST WORKSPACE LIST" "1" "2020-08-13" "" "bst workspace list Manual"
.SH NAME
bst\-workspace\-list \- List open workspaces
.SH SYNOPSIS
diff --git a/man/bst-workspace-open.1 b/man/bst-workspace-open.1
index f1acb69d1..900205a7a 100644
--- a/man/bst-workspace-open.1
+++ b/man/bst-workspace-open.1
@@ -1,4 +1,4 @@
-.TH "BST WORKSPACE OPEN" "1" "2020-07-01" "" "bst workspace open Manual"
+.TH "BST WORKSPACE OPEN" "1" "2020-08-13" "" "bst workspace open Manual"
.SH NAME
bst\-workspace\-open \- Open a new workspace
.SH SYNOPSIS
diff --git a/man/bst-workspace-reset.1 b/man/bst-workspace-reset.1
index 7ea1c99e6..3a73b473b 100644
--- a/man/bst-workspace-reset.1
+++ b/man/bst-workspace-reset.1
@@ -1,4 +1,4 @@
-.TH "BST WORKSPACE RESET" "1" "2020-07-01" "" "bst workspace reset Manual"
+.TH "BST WORKSPACE RESET" "1" "2020-08-13" "" "bst workspace reset Manual"
.SH NAME
bst\-workspace\-reset \- Reset a workspace to its original state
.SH SYNOPSIS
diff --git a/man/bst-workspace.1 b/man/bst-workspace.1
index c27133b77..89af0b819 100644
--- a/man/bst-workspace.1
+++ b/man/bst-workspace.1
@@ -1,4 +1,4 @@
-.TH "BST WORKSPACE" "1" "2020-07-01" "" "bst workspace Manual"
+.TH "BST WORKSPACE" "1" "2020-08-13" "" "bst workspace Manual"
.SH NAME
bst\-workspace \- Manipulate developer workspaces
.SH SYNOPSIS
diff --git a/man/bst.1 b/man/bst.1
index 4ea843548..d6d7a422d 100644
--- a/man/bst.1
+++ b/man/bst.1
@@ -1,4 +1,4 @@
-.TH "BST" "1" "2020-07-01" "" "bst Manual"
+.TH "BST" "1" "2020-08-13" "" "bst Manual"
.SH NAME
bst \- Build and manipulate BuildStream projects...
.SH SYNOPSIS
diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index b41d17b5b..b0eacbb02 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -875,7 +875,10 @@ def source_push(app, elements, deps, remote):
"-d",
default=_PipelineSelection.NONE,
show_default=True,
- type=FastEnumType(_PipelineSelection, [_PipelineSelection.NONE, _PipelineSelection.ALL]),
+ type=FastEnumType(
+ _PipelineSelection,
+ [_PipelineSelection.BUILD, _PipelineSelection.RUN, _PipelineSelection.ALL, _PipelineSelection.NONE],
+ ),
help="The dependencies to track",
)
@click.option("--cross-junctions", "-J", is_flag=True, help="Allow crossing junction boundaries")
diff --git a/tests/frontend/completions.py b/tests/frontend/completions.py
index 952ed177b..21ef3becc 100644
--- a/tests/frontend/completions.py
+++ b/tests/frontend/completions.py
@@ -150,7 +150,7 @@ def test_options(cli, cmd, word_idx, expected):
("bst show --deps b", 3, ["build "]),
("bst show --deps=b", 2, ["build "]),
("bst show --deps r", 3, ["run "]),
- ("bst source track --deps ", 4, ["all ", "none "]),
+ ("bst source track --deps ", 4, ["all ", "build ", "none ", "run "]),
],
)
def test_option_choice(cli, cmd, word_idx, expected):
diff --git a/tests/frontend/source-track/apples.bst b/tests/frontend/source-track/apples.bst
new file mode 100644
index 000000000..482b1e78e
--- /dev/null
+++ b/tests/frontend/source-track/apples.bst
@@ -0,0 +1,5 @@
+kind: import
+
+sources:
+- kind: remote
+ url: project-root:/files/apples
diff --git a/tests/frontend/source-track/bananas.bst b/tests/frontend/source-track/bananas.bst
new file mode 100644
index 000000000..71b714b7d
--- /dev/null
+++ b/tests/frontend/source-track/bananas.bst
@@ -0,0 +1,11 @@
+kind: import
+
+build-depends:
+- apples.bst
+
+runtime-depends:
+- oranges.bst
+
+sources:
+- kind: remote
+ url: project-root:/files/bananas
diff --git a/tests/frontend/source-track/files/apples b/tests/frontend/source-track/files/apples
new file mode 100644
index 000000000..950a188f0
--- /dev/null
+++ b/tests/frontend/source-track/files/apples
@@ -0,0 +1 @@
+apples
diff --git a/tests/frontend/source-track/files/bananas b/tests/frontend/source-track/files/bananas
new file mode 100644
index 000000000..9baf85eb7
--- /dev/null
+++ b/tests/frontend/source-track/files/bananas
@@ -0,0 +1 @@
+bananas
diff --git a/tests/frontend/source-track/files/oranges b/tests/frontend/source-track/files/oranges
new file mode 100644
index 000000000..192019cb7
--- /dev/null
+++ b/tests/frontend/source-track/files/oranges
@@ -0,0 +1 @@
+oranges
diff --git a/tests/frontend/source-track/oranges.bst b/tests/frontend/source-track/oranges.bst
new file mode 100644
index 000000000..56af0e579
--- /dev/null
+++ b/tests/frontend/source-track/oranges.bst
@@ -0,0 +1,5 @@
+kind: import
+
+sources:
+- kind: remote
+ url: project-root:/files/oranges
diff --git a/tests/frontend/track.py b/tests/frontend/track.py
index 5fe9bbde6..ba569d210 100644
--- a/tests/frontend/track.py
+++ b/tests/frontend/track.py
@@ -5,7 +5,7 @@ import stat
import os
import pytest
-from buildstream.testing import create_repo
+from buildstream.testing import create_repo, generate_project
from buildstream.testing import cli # pylint: disable=unused-import
from buildstream.exceptions import ErrorDomain, LoadErrorReason
from buildstream import _yaml
@@ -122,6 +122,45 @@ def test_track_optional(cli, tmpdir, datafiles, ref_storage):
assert test_key != master_key
+# Test all possible choices of the `--deps` option.
+#
+# NOTE: Elements used in this test must have sources that are trackable and do
+# not have a reference already. The kinds of the sources do not matter so
+# long as they can be tracked from somewhere.
+# Currently we use remote sources for this purpose.
+#
+@pytest.mark.datafiles(os.path.join(TOP_DIR, "source-track"))
+@pytest.mark.parametrize(
+ "deps, expected_states",
+ [
+ ("build", ("no reference", "buildable", "no reference")),
+ ("none", ("waiting", "no reference", "no reference")),
+ ("run", ("waiting", "no reference", "buildable")),
+ ("all", ("waiting", "buildable", "buildable")),
+ ],
+)
+def test_track_deps(cli, datafiles, deps, expected_states):
+ project = str(datafiles)
+ generate_project(project, {"aliases": {"project-root": "file:///" + project}})
+
+ target = "bananas.bst"
+ build_dep = "apples.bst"
+ runtime_dep = "oranges.bst"
+
+ # Assert that none of the sources have a reference
+ states = cli.get_element_states(project, [target, build_dep, runtime_dep])
+ assert all([state == "no reference" for state in states.values()])
+
+ # Now track the specified sources
+ result = cli.run(project=project, args=["source", "track", "--deps", deps, target])
+ result.assert_success()
+
+ # Finally assert that we have tracked _only_ the desired sources
+ states = cli.get_element_states(project, [target, build_dep, runtime_dep])
+ states_flattened = (states[target], states[build_dep], states[runtime_dep])
+ assert states_flattened == expected_states
+
+
@pytest.mark.datafiles(os.path.join(TOP_DIR, "track-cross-junction"))
@pytest.mark.parametrize("cross_junction", [("cross"), ("nocross")])
@pytest.mark.parametrize("ref_storage", [("inline"), ("project.refs")])