From 4bf7cbd0566b547d29d1acab41f1ea6404253d47 Mon Sep 17 00:00:00 2001 From: James Ennis Date: Fri, 16 Aug 2019 15:47:22 +0100 Subject: cli.py: Implement --deps for artifact delete --- src/buildstream/_frontend/cli.py | 7 +++++-- src/buildstream/_stream.py | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py index 1fcf85953..5b2e60d49 100644 --- a/src/buildstream/_frontend/cli.py +++ b/src/buildstream/_frontend/cli.py @@ -1233,12 +1233,15 @@ def artifact_list_contents(app, artifacts): # Artifact Delete Command # ################################################################### @artifact.command(name='delete', short_help="Remove artifacts from the local cache") +@click.option('--deps', '-d', default='none', + type=click.Choice(['none', 'run', 'build', 'all']), + help="The dependencies to delete (default: none)") @click.argument('artifacts', type=click.Path(), nargs=-1) @click.pass_obj -def artifact_delete(app, artifacts): +def artifact_delete(app, artifacts, deps): """Remove artifacts from the local cache""" with app.initialized(): - app.stream.artifact_delete(artifacts) + app.stream.artifact_delete(artifacts, selection=deps) ################################################################## diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index fc83156f5..58d4a0ebd 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -672,9 +672,10 @@ class Stream(): # Args: # targets (str): Targets to remove # - def artifact_delete(self, targets): + def artifact_delete(self, targets, *, + selection=PipelineSelection.NONE): # Return list of Element and/or ArtifactElement objects - target_objects = self.load_selection(targets, selection=PipelineSelection.NONE, load_refs=True) + target_objects = self.load_selection(targets, selection=selection, load_refs=True) # Some of the targets may refer to the same key, so first obtain a # set of the refs to be removed. -- cgit v1.2.1