diff options
-rw-r--r-- | buildstream/_frontend/cli.py | 3 | ||||
-rw-r--r-- | buildstream/_frontend/widget.py | 23 | ||||
-rw-r--r-- | man/bst-artifact-checkout.1 | 2 | ||||
-rw-r--r-- | man/bst-artifact-log.1 | 2 | ||||
-rw-r--r-- | man/bst-artifact-pull.1 | 2 | ||||
-rw-r--r-- | man/bst-artifact-push.1 | 2 | ||||
-rw-r--r-- | man/bst-artifact-server.1 | 2 | ||||
-rw-r--r-- | man/bst-artifact.1 | 2 | ||||
-rw-r--r-- | man/bst-build.1 | 5 | ||||
-rw-r--r-- | man/bst-help.1 | 2 | ||||
-rw-r--r-- | man/bst-init.1 | 2 | ||||
-rw-r--r-- | man/bst-shell.1 | 2 | ||||
-rw-r--r-- | man/bst-show.1 | 5 | ||||
-rw-r--r-- | man/bst-source-checkout.1 | 2 | ||||
-rw-r--r-- | man/bst-source-fetch.1 | 2 | ||||
-rw-r--r-- | man/bst-source-track.1 | 2 | ||||
-rw-r--r-- | man/bst-source.1 | 2 | ||||
-rw-r--r-- | man/bst-workspace-close.1 | 2 | ||||
-rw-r--r-- | man/bst-workspace-list.1 | 2 | ||||
-rw-r--r-- | man/bst-workspace-open.1 | 2 | ||||
-rw-r--r-- | man/bst-workspace-reset.1 | 2 | ||||
-rw-r--r-- | man/bst-workspace.1 | 2 | ||||
-rw-r--r-- | man/bst.1 | 2 | ||||
-rw-r--r-- | tests/frontend/show.py | 25 |
24 files changed, 77 insertions, 22 deletions
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py index 49d5717b4..b3c4634a9 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -440,6 +440,9 @@ def show(app, elements, deps, except_, order, format_): %{public} Public domain data %{workspaced} If the element is workspaced %{workspace-dirs} A list of workspace directories + %{deps} A list of all dependencies + %{build-deps} A list of build dependencies + %{runtime-deps} A list of runtime dependencies The value of the %{symbol} without the leading '%' character is understood as a pythonic formatting string, so python formatting features apply, diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py index de122f8a3..b8e3d920a 100644 --- a/buildstream/_frontend/widget.py +++ b/buildstream/_frontend/widget.py @@ -27,7 +27,7 @@ from ruamel import yaml import click from . import Profile -from .. import Element, Consistency +from .. import Element, Consistency, Scope from .. import _yaml from .. import __version__ as bst_version from .._exceptions import ImplError @@ -435,6 +435,27 @@ class LogLine(Widget): line = p.fmt_subst( line, 'workspace-dirs', '') + # Dependencies + if "%{deps" in format_: + deps = [e.name for e in element.dependencies(Scope.ALL, recurse=False)] + line = p.fmt_subst( + line, 'deps', + yaml.safe_dump(deps, default_style=None).rstrip('\n')) + + # Build Dependencies + if "%{build-deps" in format_: + build_deps = [e.name for e in element.dependencies(Scope.BUILD, recurse=False)] + line = p.fmt_subst( + line, 'build-deps', + yaml.safe_dump(build_deps, default_style=False).rstrip('\n')) + + # Runtime Dependencies + if "%{runtime-deps" in format_: + runtime_deps = [e.name for e in element.dependencies(Scope.RUN, recurse=False)] + line = p.fmt_subst( + line, 'runtime-deps', + yaml.safe_dump(runtime_deps, default_style=False).rstrip('\n')) + report += line + '\n' return report.rstrip('\n') diff --git a/man/bst-artifact-checkout.1 b/man/bst-artifact-checkout.1 index e928a3048..2c11852c8 100644 --- a/man/bst-artifact-checkout.1 +++ b/man/bst-artifact-checkout.1 @@ -1,4 +1,4 @@ -.TH "BST ARTIFACT CHECKOUT" "1" "24-Jan-2019" "" "bst artifact checkout Manual" +.TH "BST ARTIFACT CHECKOUT" "1" "12-Feb-2019" "" "bst artifact checkout Manual" .SH NAME bst\-artifact\-checkout \- Checkout contents of an artifact .SH SYNOPSIS diff --git a/man/bst-artifact-log.1 b/man/bst-artifact-log.1 index 3feed0886..6045e2587 100644 --- a/man/bst-artifact-log.1 +++ b/man/bst-artifact-log.1 @@ -1,4 +1,4 @@ -.TH "BST ARTIFACT LOG" "1" "24-Jan-2019" "" "bst artifact log Manual" +.TH "BST ARTIFACT LOG" "1" "12-Feb-2019" "" "bst artifact log Manual" .SH NAME bst\-artifact\-log \- Show logs of an artifact .SH SYNOPSIS diff --git a/man/bst-artifact-pull.1 b/man/bst-artifact-pull.1 index 81ffe2229..b01b2bb15 100644 --- a/man/bst-artifact-pull.1 +++ b/man/bst-artifact-pull.1 @@ -1,4 +1,4 @@ -.TH "BST ARTIFACT PULL" "1" "24-Jan-2019" "" "bst artifact pull Manual" +.TH "BST ARTIFACT PULL" "1" "12-Feb-2019" "" "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 b4182023c..bc87c8287 100644 --- a/man/bst-artifact-push.1 +++ b/man/bst-artifact-push.1 @@ -1,4 +1,4 @@ -.TH "BST ARTIFACT PUSH" "1" "24-Jan-2019" "" "bst artifact push Manual" +.TH "BST ARTIFACT PUSH" "1" "12-Feb-2019" "" "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 6181b818f..f196b878d 100644 --- a/man/bst-artifact-server.1 +++ b/man/bst-artifact-server.1 @@ -1,4 +1,4 @@ -.TH "BST-ARTIFACT-SERVER" "1" "24-Jan-2019" "" "bst-artifact-server Manual" +.TH "BST-ARTIFACT-SERVER" "1" "12-Feb-2019" "" "bst-artifact-server Manual" .SH NAME bst-artifact-server \- CAS Artifact Server .SH SYNOPSIS diff --git a/man/bst-artifact.1 b/man/bst-artifact.1 index 688ee3389..a4bbeb7b2 100644 --- a/man/bst-artifact.1 +++ b/man/bst-artifact.1 @@ -1,4 +1,4 @@ -.TH "BST ARTIFACT" "1" "24-Jan-2019" "" "bst artifact Manual" +.TH "BST ARTIFACT" "1" "12-Feb-2019" "" "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 5ec12f459..deee1301e 100644 --- a/man/bst-build.1 +++ b/man/bst-build.1 @@ -1,4 +1,4 @@ -.TH "BST BUILD" "1" "24-Jan-2019" "" "bst build Manual" +.TH "BST BUILD" "1" "12-Feb-2019" "" "bst build Manual" .SH NAME bst\-build \- Build elements in a pipeline .SH SYNOPSIS @@ -32,3 +32,6 @@ Allow tracking to cross junction boundaries .TP \fB\-\-track\-save\fP Deprecated: This is ignored +.TP +\fB\-r,\fP \-\-remote TEXT +The URL of the remote cache (defaults to the first configured cache) diff --git a/man/bst-help.1 b/man/bst-help.1 index 54bc940bb..35675db1d 100644 --- a/man/bst-help.1 +++ b/man/bst-help.1 @@ -1,4 +1,4 @@ -.TH "BST HELP" "1" "24-Jan-2019" "" "bst help Manual" +.TH "BST HELP" "1" "12-Feb-2019" "" "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 6870acbe4..9b7b119d9 100644 --- a/man/bst-init.1 +++ b/man/bst-init.1 @@ -1,4 +1,4 @@ -.TH "BST INIT" "1" "24-Jan-2019" "" "bst init Manual" +.TH "BST INIT" "1" "12-Feb-2019" "" "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 37303c18b..d223d0d20 100644 --- a/man/bst-shell.1 +++ b/man/bst-shell.1 @@ -1,4 +1,4 @@ -.TH "BST SHELL" "1" "24-Jan-2019" "" "bst shell Manual" +.TH "BST SHELL" "1" "12-Feb-2019" "" "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 79d237058..4fe0b71c2 100644 --- a/man/bst-show.1 +++ b/man/bst-show.1 @@ -1,4 +1,4 @@ -.TH "BST SHOW" "1" "24-Jan-2019" "" "bst show Manual" +.TH "BST SHOW" "1" "12-Feb-2019" "" "bst show Manual" .SH NAME bst\-show \- Show elements in the pipeline .SH SYNOPSIS @@ -43,6 +43,9 @@ the following symbols can be used in the format string: %{public} Public domain data %{workspaced} If the element is workspaced %{workspace-dirs} A list of workspace directories + %{deps} A list of all dependencies + %{build-deps} A list of build dependencies + %{runtime-deps} A list of runtime dependencies .PP The value of the %{symbol} without the leading '%' character is understood as a pythonic formatting string, so python formatting features apply, diff --git a/man/bst-source-checkout.1 b/man/bst-source-checkout.1 index cd6a0db27..f3101b679 100644 --- a/man/bst-source-checkout.1 +++ b/man/bst-source-checkout.1 @@ -1,4 +1,4 @@ -.TH "BST SOURCE CHECKOUT" "1" "24-Jan-2019" "" "bst source checkout Manual" +.TH "BST SOURCE CHECKOUT" "1" "12-Feb-2019" "" "bst source checkout Manual" .SH NAME bst\-source\-checkout \- Checkout sources for an element .SH SYNOPSIS diff --git a/man/bst-source-fetch.1 b/man/bst-source-fetch.1 index 8cbb792e2..0fb63a6d7 100644 --- a/man/bst-source-fetch.1 +++ b/man/bst-source-fetch.1 @@ -1,4 +1,4 @@ -.TH "BST SOURCE FETCH" "1" "24-Jan-2019" "" "bst source fetch Manual" +.TH "BST SOURCE FETCH" "1" "12-Feb-2019" "" "bst source fetch Manual" .SH NAME bst\-source\-fetch \- Fetch sources in a pipeline .SH SYNOPSIS diff --git a/man/bst-source-track.1 b/man/bst-source-track.1 index e56233ba2..92f8cd310 100644 --- a/man/bst-source-track.1 +++ b/man/bst-source-track.1 @@ -1,4 +1,4 @@ -.TH "BST SOURCE TRACK" "1" "24-Jan-2019" "" "bst source track Manual" +.TH "BST SOURCE TRACK" "1" "12-Feb-2019" "" "bst source track Manual" .SH NAME bst\-source\-track \- Track new source references .SH SYNOPSIS diff --git a/man/bst-source.1 b/man/bst-source.1 index 4344af206..897642541 100644 --- a/man/bst-source.1 +++ b/man/bst-source.1 @@ -1,4 +1,4 @@ -.TH "BST SOURCE" "1" "24-Jan-2019" "" "bst source Manual" +.TH "BST SOURCE" "1" "12-Feb-2019" "" "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 d36e5097b..5c2659f63 100644 --- a/man/bst-workspace-close.1 +++ b/man/bst-workspace-close.1 @@ -1,4 +1,4 @@ -.TH "BST WORKSPACE CLOSE" "1" "24-Jan-2019" "" "bst workspace close Manual" +.TH "BST WORKSPACE CLOSE" "1" "12-Feb-2019" "" "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 64fdb6a44..6be37d631 100644 --- a/man/bst-workspace-list.1 +++ b/man/bst-workspace-list.1 @@ -1,4 +1,4 @@ -.TH "BST WORKSPACE LIST" "1" "24-Jan-2019" "" "bst workspace list Manual" +.TH "BST WORKSPACE LIST" "1" "12-Feb-2019" "" "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 e5527ba6a..4fd70fc15 100644 --- a/man/bst-workspace-open.1 +++ b/man/bst-workspace-open.1 @@ -1,4 +1,4 @@ -.TH "BST WORKSPACE OPEN" "1" "24-Jan-2019" "" "bst workspace open Manual" +.TH "BST WORKSPACE OPEN" "1" "12-Feb-2019" "" "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 3bb1c73b4..ad2fc707a 100644 --- a/man/bst-workspace-reset.1 +++ b/man/bst-workspace-reset.1 @@ -1,4 +1,4 @@ -.TH "BST WORKSPACE RESET" "1" "24-Jan-2019" "" "bst workspace reset Manual" +.TH "BST WORKSPACE RESET" "1" "12-Feb-2019" "" "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 a6a0f53fc..b90505e1a 100644 --- a/man/bst-workspace.1 +++ b/man/bst-workspace.1 @@ -1,4 +1,4 @@ -.TH "BST WORKSPACE" "1" "24-Jan-2019" "" "bst workspace Manual" +.TH "BST WORKSPACE" "1" "12-Feb-2019" "" "bst workspace Manual" .SH NAME bst\-workspace \- Manipulate developer workspaces .SH SYNOPSIS @@ -1,4 +1,4 @@ -.TH "BST" "1" "24-Jan-2019" "" "bst Manual" +.TH "BST" "1" "12-Feb-2019" "" "bst Manual" .SH NAME bst \- Build and manipulate BuildStream projects... .SH SYNOPSIS diff --git a/tests/frontend/show.py b/tests/frontend/show.py index ad3ae3591..ac1edebd6 100644 --- a/tests/frontend/show.py +++ b/tests/frontend/show.py @@ -400,3 +400,28 @@ def test_exceed_max_recursion_depth(cli, tmpdir, dependency_depth): assert result.exit_code == -1 shutil.rmtree(project_path) + + +############################################################### +# Testing format symbols # +############################################################### +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'project')) +@pytest.mark.parametrize("dep_kind, expected_deps", [ + ('%{deps}', '[import-dev.bst, import-bin.bst]'), + ('%{build-deps}', '[import-dev.bst]'), + ('%{runtime-deps}', '[import-bin.bst]') +]) +def test_format_deps(cli, datafiles, dep_kind, expected_deps): + project = os.path.join(datafiles.dirname, datafiles.basename) + target = 'checkout-deps.bst' + result = cli.run(project=project, silent=True, args=[ + 'show', + '--deps', 'none', + '--format', '%{name}: ' + dep_kind, + target]) + result.assert_success() + + expected = '{name}: {deps}'.format(name=target, deps=expected_deps) + if result.output.strip() != expected: + raise AssertionError("Expected output:\n{}\nInstead received output:\n{}" + .format(expected, result.output)) |