[Notes] [Git][BuildStream/buildstream][master] 3 commits: _frontend: Allow printing dependencies using `bst show`



Title: GitLab

Chandan Singh pushed to branch master at BuildStream / buildstream

Commits:

24 changed files:

Changes:

  • buildstream/_frontend/cli.py
    ... ... @@ -440,6 +440,9 @@ def show(app, elements, deps, except_, order, format_):
    440 440
             %{public}         Public domain data
    
    441 441
             %{workspaced}     If the element is workspaced
    
    442 442
             %{workspace-dirs} A list of workspace directories
    
    443
    +        %{deps}           A list of all dependencies
    
    444
    +        %{build-deps}     A list of build dependencies
    
    445
    +        %{runtime-deps}   A list of runtime dependencies
    
    443 446
     
    
    444 447
         The value of the %{symbol} without the leading '%' character is understood
    
    445 448
         as a pythonic formatting string, so python formatting features apply,
    

  • buildstream/_frontend/widget.py
    ... ... @@ -27,7 +27,7 @@ from ruamel import yaml
    27 27
     import click
    
    28 28
     
    
    29 29
     from . import Profile
    
    30
    -from .. import Element, Consistency
    
    30
    +from .. import Element, Consistency, Scope
    
    31 31
     from .. import _yaml
    
    32 32
     from .. import __version__ as bst_version
    
    33 33
     from .._exceptions import ImplError
    
    ... ... @@ -435,6 +435,27 @@ class LogLine(Widget):
    435 435
                         line = p.fmt_subst(
    
    436 436
                             line, 'workspace-dirs', '')
    
    437 437
     
    
    438
    +            # Dependencies
    
    439
    +            if "%{deps" in format_:
    
    440
    +                deps = [e.name for e in element.dependencies(Scope.ALL, recurse=False)]
    
    441
    +                line = p.fmt_subst(
    
    442
    +                    line, 'deps',
    
    443
    +                    yaml.safe_dump(deps, default_style=None).rstrip('\n'))
    
    444
    +
    
    445
    +            # Build Dependencies
    
    446
    +            if "%{build-deps" in format_:
    
    447
    +                build_deps = [e.name for e in element.dependencies(Scope.BUILD, recurse=False)]
    
    448
    +                line = p.fmt_subst(
    
    449
    +                    line, 'build-deps',
    
    450
    +                    yaml.safe_dump(build_deps, default_style=False).rstrip('\n'))
    
    451
    +
    
    452
    +            # Runtime Dependencies
    
    453
    +            if "%{runtime-deps" in format_:
    
    454
    +                runtime_deps = [e.name for e in element.dependencies(Scope.RUN, recurse=False)]
    
    455
    +                line = p.fmt_subst(
    
    456
    +                    line, 'runtime-deps',
    
    457
    +                    yaml.safe_dump(runtime_deps, default_style=False).rstrip('\n'))
    
    458
    +
    
    438 459
                 report += line + '\n'
    
    439 460
     
    
    440 461
             return report.rstrip('\n')
    

  • man/bst-artifact-checkout.1
    1
    -.TH "BST ARTIFACT CHECKOUT" "1" "24-Jan-2019" "" "bst artifact checkout Manual"
    
    1
    +.TH "BST ARTIFACT CHECKOUT" "1" "12-Feb-2019" "" "bst artifact checkout Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-artifact\-checkout \- Checkout contents of an artifact
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-artifact-log.1
    1
    -.TH "BST ARTIFACT LOG" "1" "24-Jan-2019" "" "bst artifact log Manual"
    
    1
    +.TH "BST ARTIFACT LOG" "1" "12-Feb-2019" "" "bst artifact log Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-artifact\-log \- Show logs of an artifact
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-artifact-pull.1
    1
    -.TH "BST ARTIFACT PULL" "1" "24-Jan-2019" "" "bst artifact pull Manual"
    
    1
    +.TH "BST ARTIFACT PULL" "1" "12-Feb-2019" "" "bst artifact pull Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-artifact\-pull \- Pull a built artifact
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-artifact-push.1
    1
    -.TH "BST ARTIFACT PUSH" "1" "24-Jan-2019" "" "bst artifact push Manual"
    
    1
    +.TH "BST ARTIFACT PUSH" "1" "12-Feb-2019" "" "bst artifact push Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-artifact\-push \- Push a built artifact
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-artifact-server.1
    1
    -.TH "BST-ARTIFACT-SERVER" "1" "24-Jan-2019" "" "bst-artifact-server Manual"
    
    1
    +.TH "BST-ARTIFACT-SERVER" "1" "12-Feb-2019" "" "bst-artifact-server Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst-artifact-server \- CAS Artifact Server
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-artifact.1
    1
    -.TH "BST ARTIFACT" "1" "24-Jan-2019" "" "bst artifact Manual"
    
    1
    +.TH "BST ARTIFACT" "1" "12-Feb-2019" "" "bst artifact Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-artifact \- Manipulate cached artifacts
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-build.1
    1
    -.TH "BST BUILD" "1" "24-Jan-2019" "" "bst build Manual"
    
    1
    +.TH "BST BUILD" "1" "12-Feb-2019" "" "bst build Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-build \- Build elements in a pipeline
    
    4 4
     .SH SYNOPSIS
    
    ... ... @@ -32,3 +32,6 @@ Allow tracking to cross junction boundaries
    32 32
     .TP
    
    33 33
     \fB\-\-track\-save\fP
    
    34 34
     Deprecated: This is ignored
    
    35
    +.TP
    
    36
    +\fB\-r,\fP \-\-remote TEXT
    
    37
    +The URL of the remote cache (defaults to the first configured cache)

  • man/bst-help.1
    1
    -.TH "BST HELP" "1" "24-Jan-2019" "" "bst help Manual"
    
    1
    +.TH "BST HELP" "1" "12-Feb-2019" "" "bst help Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-help \- Print usage information
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-init.1
    1
    -.TH "BST INIT" "1" "24-Jan-2019" "" "bst init Manual"
    
    1
    +.TH "BST INIT" "1" "12-Feb-2019" "" "bst init Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-init \- Initialize a new BuildStream project
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-shell.1
    1
    -.TH "BST SHELL" "1" "24-Jan-2019" "" "bst shell Manual"
    
    1
    +.TH "BST SHELL" "1" "12-Feb-2019" "" "bst shell Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-shell \- Shell into an element's sandbox environment
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-show.1
    1
    -.TH "BST SHOW" "1" "24-Jan-2019" "" "bst show Manual"
    
    1
    +.TH "BST SHOW" "1" "12-Feb-2019" "" "bst show Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-show \- Show elements in the pipeline
    
    4 4
     .SH SYNOPSIS
    
    ... ... @@ -43,6 +43,9 @@ the following symbols can be used in the format string:
    43 43
         %{public}         Public domain data
    
    44 44
         %{workspaced}     If the element is workspaced
    
    45 45
         %{workspace-dirs} A list of workspace directories
    
    46
    +    %{deps}           A list of all dependencies
    
    47
    +    %{build-deps}     A list of build dependencies
    
    48
    +    %{runtime-deps}   A list of runtime dependencies
    
    46 49
     .PP
    
    47 50
     The value of the %{symbol} without the leading '%' character is understood
    
    48 51
     as a pythonic formatting string, so python formatting features apply,
    

  • man/bst-source-checkout.1
    1
    -.TH "BST SOURCE CHECKOUT" "1" "24-Jan-2019" "" "bst source checkout Manual"
    
    1
    +.TH "BST SOURCE CHECKOUT" "1" "12-Feb-2019" "" "bst source checkout Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-source\-checkout \- Checkout sources for an element
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-source-fetch.1
    1
    -.TH "BST SOURCE FETCH" "1" "24-Jan-2019" "" "bst source fetch Manual"
    
    1
    +.TH "BST SOURCE FETCH" "1" "12-Feb-2019" "" "bst source fetch Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-source\-fetch \- Fetch sources in a pipeline
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-source-track.1
    1
    -.TH "BST SOURCE TRACK" "1" "24-Jan-2019" "" "bst source track Manual"
    
    1
    +.TH "BST SOURCE TRACK" "1" "12-Feb-2019" "" "bst source track Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-source\-track \- Track new source references
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-source.1
    1
    -.TH "BST SOURCE" "1" "24-Jan-2019" "" "bst source Manual"
    
    1
    +.TH "BST SOURCE" "1" "12-Feb-2019" "" "bst source Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-source \- Manipulate sources for an element
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-workspace-close.1
    1
    -.TH "BST WORKSPACE CLOSE" "1" "24-Jan-2019" "" "bst workspace close Manual"
    
    1
    +.TH "BST WORKSPACE CLOSE" "1" "12-Feb-2019" "" "bst workspace close Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-workspace\-close \- Close workspaces
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-workspace-list.1
    1
    -.TH "BST WORKSPACE LIST" "1" "24-Jan-2019" "" "bst workspace list Manual"
    
    1
    +.TH "BST WORKSPACE LIST" "1" "12-Feb-2019" "" "bst workspace list Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-workspace\-list \- List open workspaces
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-workspace-open.1
    1
    -.TH "BST WORKSPACE OPEN" "1" "24-Jan-2019" "" "bst workspace open Manual"
    
    1
    +.TH "BST WORKSPACE OPEN" "1" "12-Feb-2019" "" "bst workspace open Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-workspace\-open \- Open a new workspace
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-workspace-reset.1
    1
    -.TH "BST WORKSPACE RESET" "1" "24-Jan-2019" "" "bst workspace reset Manual"
    
    1
    +.TH "BST WORKSPACE RESET" "1" "12-Feb-2019" "" "bst workspace reset Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-workspace\-reset \- Reset a workspace to its original state
    
    4 4
     .SH SYNOPSIS
    

  • man/bst-workspace.1
    1
    -.TH "BST WORKSPACE" "1" "24-Jan-2019" "" "bst workspace Manual"
    
    1
    +.TH "BST WORKSPACE" "1" "12-Feb-2019" "" "bst workspace Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst\-workspace \- Manipulate developer workspaces
    
    4 4
     .SH SYNOPSIS
    

  • man/bst.1
    1
    -.TH "BST" "1" "24-Jan-2019" "" "bst Manual"
    
    1
    +.TH "BST" "1" "12-Feb-2019" "" "bst Manual"
    
    2 2
     .SH NAME
    
    3 3
     bst \- Build and manipulate BuildStream projects...
    
    4 4
     .SH SYNOPSIS
    

  • tests/frontend/show.py
    ... ... @@ -400,3 +400,28 @@ def test_exceed_max_recursion_depth(cli, tmpdir, dependency_depth):
    400 400
             assert result.exit_code == -1
    
    401 401
     
    
    402 402
         shutil.rmtree(project_path)
    
    403
    +
    
    404
    +
    
    405
    +###############################################################
    
    406
    +#                   Testing format symbols                    #
    
    407
    +###############################################################
    
    408
    +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'project'))
    
    409
    +@pytest.mark.parametrize("dep_kind, expected_deps", [
    
    410
    +    ('%{deps}', '[import-dev.bst, import-bin.bst]'),
    
    411
    +    ('%{build-deps}', '[import-dev.bst]'),
    
    412
    +    ('%{runtime-deps}', '[import-bin.bst]')
    
    413
    +])
    
    414
    +def test_format_deps(cli, datafiles, dep_kind, expected_deps):
    
    415
    +    project = os.path.join(datafiles.dirname, datafiles.basename)
    
    416
    +    target = 'checkout-deps.bst'
    
    417
    +    result = cli.run(project=project, silent=True, args=[
    
    418
    +        'show',
    
    419
    +        '--deps', 'none',
    
    420
    +        '--format', '%{name}: ' + dep_kind,
    
    421
    +        target])
    
    422
    +    result.assert_success()
    
    423
    +
    
    424
    +    expected = '{name}: {deps}'.format(name=target, deps=expected_deps)
    
    425
    +    if result.output.strip() != expected:
    
    426
    +        raise AssertionError("Expected output:\n{}\nInstead received output:\n{}"
    
    427
    +                             .format(expected, result.output))



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]