summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2015-03-03 13:48:44 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2015-04-10 13:52:26 +0000
commitce8f94ce79be04cd08e761f8e1bb614e723a0423 (patch)
tree0bbb770e29fd249ef7c474a4f4e3a3311cf017e9
parent4e1c8324696fd86b7c7dd2490a15942d31ad6ffd (diff)
downloadmorph-ce8f94ce79be04cd08e761f8e1bb614e723a0423.tar.gz
gc: Make `morph gc` use the OSTree artifact cache
-rw-r--r--morphlib/plugins/gc_plugin.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/morphlib/plugins/gc_plugin.py b/morphlib/plugins/gc_plugin.py
index 71522b04..8b5dc4c2 100644
--- a/morphlib/plugins/gc_plugin.py
+++ b/morphlib/plugins/gc_plugin.py
@@ -125,8 +125,8 @@ class GCPlugin(cliapp.Plugin):
'sufficient space already cleared',
chatty=True)
return
- lac = morphlib.localartifactcache.LocalArtifactCache(
- fs.osfs.OSFS(os.path.join(cache_path, 'artifacts')))
+ lac = morphlib.ostreeartifactcache.OSTreeArtifactCache(
+ os.path.join(cache_path, 'artifacts'))
max_age, min_age = self.calculate_delete_range()
logging.debug('Must remove artifacts older than timestamp %d'
% max_age)
@@ -144,6 +144,8 @@ class GCPlugin(cliapp.Plugin):
lac.remove(cachekey)
removed += 1
+ lac.prune()
+
# Maybe remove remaining middle-aged artifacts
for cachekey in may_delete:
if sufficient_free():
@@ -157,6 +159,8 @@ class GCPlugin(cliapp.Plugin):
lac.remove(cachekey)
removed += 1
+ lac.prune()
+
if sufficient_free():
self.app.status(msg='Made sufficient space in %(cache_path)s '
'after removing %(removed)d sources',