Commit f544a575 authored by Tom Pollard's avatar Tom Pollard
Browse files

_frontend/cli.py: Add --pull-buildtrees to bst build & pull

The addition of the pull-buildtrees flag will be used to override
the default behaviour of remote artifact cache pulling. Included
is the required changes to completions tests.
parent 0a5db229
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -305,10 +305,12 @@ def init(app, project_name, format_version, element_path, force):
              help="Allow tracking to cross junction boundaries")
@click.option('--track-save', default=False, is_flag=True,
              help="Deprecated: This is ignored")
@click.option('--pull-buildtrees', default=False, is_flag=True,
              help="Pull buildtrees from a remote cache server")
@click.argument('elements', nargs=-1,
                type=click.Path(readable=False))
@click.pass_obj
def build(app, elements, all_, track_, track_save, track_all, track_except, track_cross_junctions):
def build(app, elements, all_, track_, track_save, track_all, track_except, track_cross_junctions, pull_buildtrees):
    """Build elements in a pipeline"""

    if (track_except or track_cross_junctions) and not (track_ or track_all):
@@ -327,7 +329,8 @@ def build(app, elements, all_, track_, track_save, track_all, track_except, trac
                         track_targets=track_,
                         track_except=track_except,
                         track_cross_junctions=track_cross_junctions,
                         build_all=all_)
                         build_all=all_,
                         pull_buildtrees=pull_buildtrees)


##################################################################
@@ -429,10 +432,12 @@ def track(app, elements, deps, except_, cross_junctions):
              help='The dependency artifacts to pull (default: none)')
@click.option('--remote', '-r',
              help="The URL of the remote cache (defaults to the first configured cache)")
@click.option('--pull-buildtrees', default=False, is_flag=True,
              help="Pull buildtrees from a remote cache server")
@click.argument('elements', nargs=-1,
                type=click.Path(readable=False))
@click.pass_obj
def pull(app, elements, deps, remote):
def pull(app, elements, deps, remote, pull_buildtrees):
    """Pull a built artifact from the configured remote artifact cache.

    By default the artifact will be pulled one of the configured caches
@@ -446,7 +451,7 @@ def pull(app, elements, deps, remote):
        all:   All dependencies
    """
    with app.initialized(session_name="Pull"):
        app.stream.pull(elements, selection=deps, remote=remote)
        app.stream.pull(elements, selection=deps, remote=remote, pull_buildtrees=pull_buildtrees)


##################################################################
+4 −2
Original line number Diff line number Diff line
@@ -165,7 +165,8 @@ class Stream():
              track_targets=None,
              track_except=None,
              track_cross_junctions=False,
              build_all=False):
              build_all=False,
              pull_buildtrees=False):

        if build_all:
            selection = PipelineSelection.ALL
@@ -295,7 +296,8 @@ class Stream():
    #
    def pull(self, targets, *,
             selection=PipelineSelection.NONE,
             remote=None):
             remote=None,
             pull_buildtrees=False):

        use_config = True
        if remote:
+1 −1
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ def test_commands(cli, cmd, word_idx, expected):
    ('bst --no-colors build -', 3, ['--all ', '--track ', '--track-all ',
                                    '--track-except ',
                                    '--track-cross-junctions ', '-J ',
                                    '--track-save ']),
                                    '--track-save ', '--pull-buildtrees ']),

    # Test the behavior of completing after an option that has a
    # parameter that cannot be completed, vs an option that has