diff options
-rw-r--r-- | buildstream/_frontend/cli.py | 6 | ||||
-rw-r--r-- | buildstream/_stream.py | 3 | ||||
-rw-r--r-- | buildstream/element.py | 22 |
3 files changed, 18 insertions, 13 deletions
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py index c75e7ac6a..1221bb7dd 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -627,6 +627,9 @@ def shell(app, element, sysroot, mount, isolate, build_, command): @cli.command(short_help="Checkout a built artifact") @click.option('--force', '-f', default=False, is_flag=True, help="Overwrite files existing in checkout directory") +@click.option('--deps', '-d', default='run', + type=click.Choice(['run', 'none']), + help='The dependencies to checkout (default: all') @click.option('--integrate/--no-integrate', default=True, is_flag=True, help="Whether to run integration commands") @click.option('--hardlinks', default=False, is_flag=True, @@ -635,12 +638,13 @@ def shell(app, element, sysroot, mount, isolate, build_, command): type=click.Path(readable=False)) @click.argument('directory', type=click.Path(file_okay=False)) @click.pass_obj -def checkout(app, element, directory, force, integrate, hardlinks): +def checkout(app, element, directory, force, deps, integrate, hardlinks): """Checkout a built artifact to the specified directory """ with app.initialized(): app.stream.checkout(element, directory=directory, + deps=deps, force=force, integrate=integrate, hardlinks=hardlinks) diff --git a/buildstream/_stream.py b/buildstream/_stream.py index 4b699c1f2..a29d8b63f 100644 --- a/buildstream/_stream.py +++ b/buildstream/_stream.py @@ -361,6 +361,7 @@ class Stream(): # their artifacts is acceptable # def checkout(self, target, *, + deps='run', directory=None, force=False, integrate=True, @@ -384,7 +385,7 @@ class Stream(): # Stage deps into a temporary sandbox first try: - with target._prepare_sandbox(Scope.RUN, None, integrate=integrate) as sandbox: + with target._prepare_sandbox(Scope.RUN, None, deps=deps, integrate=integrate) as sandbox: # Copy or move the sandbox to the target directory sandbox_root = sandbox.get_directory() diff --git a/buildstream/element.py b/buildstream/element.py index 04ee76a15..0f0bf49d6 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -1242,8 +1242,7 @@ class Element(Plugin): # is used to stage things by the `bst checkout` codepath # @contextmanager - def _prepare_sandbox(self, scope, directory, integrate=True): - + def _prepare_sandbox(self, scope, directory, deps='run', integrate=True): with self.__sandbox(directory, config=self.__sandbox_config) as sandbox: # Configure always comes first, and we need it. @@ -1255,15 +1254,16 @@ class Element(Plugin): self.stage(sandbox) elif scope == Scope.RUN: # Stage deps in the sandbox root - with self.timed_activity("Staging dependencies", silent_nested=True): - self.stage_dependency_artifacts(sandbox, scope) - - # Run any integration commands provided by the dependencies - # once they are all staged and ready - if integrate: - with self.timed_activity("Integrating sandbox"): - for dep in self.dependencies(scope): - dep.integrate(sandbox) + if deps == 'run': + with self.timed_activity("Staging dependencies", silent_nested=True): + self.stage_dependency_artifacts(sandbox, scope) + + # Run any integration commands provided by the dependencies + # once they are all staged and ready + if integrate: + with self.timed_activity("Integrating sandbox"): + for dep in self.dependencies(scope): + dep.integrate(sandbox) yield sandbox |