You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:42:10 UTC
[buildstream] 03/08: cli.py: Defer pruning until all specified refs
are removed
This is an automated email from the ASF dual-hosted git repository.
not-in-ldap pushed a commit to branch jennis/new_artifact_subcommands
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 1050e97ca0b87ca2b7cd48ee4b9e1d135904cd54
Author: James Ennis <ja...@codethink.com>
AuthorDate: Fri Jan 11 12:13:15 2019 +0000
cli.py: Defer pruning until all specified refs are removed
---
buildstream/_frontend/cli.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py
index 28e6027..f2bf45c 100644
--- a/buildstream/_frontend/cli.py
+++ b/buildstream/_frontend/cli.py
@@ -1101,13 +1101,19 @@ def artifact_delete(app, artifacts):
if element is not None:
elements = [element]
+ # Remove specified elements and artifacts
if elements:
elements = app.stream.load_selection(elements, selection=PipelineSelection.NONE)
for element in elements:
- cache.remove(cache.get_artifact_fullname(element, element._get_cache_key()))
+ cache_key = element._get_cache_key()
+ ref = cache.get_artifact_fullname(element, cache_key)
+ cache.remove(ref, defer_prune=True)
if artifacts:
- for i, ref in enumerate(artifacts, start=1):
- cache.cas.remove(ref, defer_prune=(i != len(artifacts)))
+ for ref in artifacts:
+ cache.remove(ref, defer_prune=True)
+
+ # Now we've removed all the refs, prune the unreachable objects
+ cache.prune()
##################################################################