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-03-03 18:41:49 +0000
commitc479a33086f8f53bf4386c045af06ec95ae3fb8f (patch)
tree9887c3732dc5dd50a79b93f9307cb6d18d91c02a
parent8586e8075890b823b89adf5a7c09d9cc09ee5e06 (diff)
downloadmorph-c479a33086f8f53bf4386c045af06ec95ae3fb8f.tar.gz
gc: Make `morph gc` use the OSTree artifact cache
-rw-r--r--morphlib/plugins/gc_plugin.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/morphlib/plugins/gc_plugin.py b/morphlib/plugins/gc_plugin.py
index 68f386eb..53abd8e2 100644
--- a/morphlib/plugins/gc_plugin.py
+++ b/morphlib/plugins/gc_plugin.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2014 Codethink Limited
+# Copyright (C) 2013-2015 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -126,8 +126,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)
@@ -145,6 +145,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():
@@ -158,6 +160,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',