From 683df024376e2d4be3d2b00e2d9f63f219394181 Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Fri, 9 May 2008 08:57:01 +0000 Subject: [PATCH] clearCache should get the latest values.. When it is called from manager.py it is only once read but manager.py calls clearCache after calling setCache.. And because of that the old value is used. The one that was read when manager.py initializes pisi. --- pisi/api.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index 03d5570f..690dbec6 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -752,12 +752,13 @@ def clearCache(all=False): pkgList = map(lambda x: os.path.basename(x).split(".pisi")[0], glob.glob("%s/*.pisi" % cacheDir)) if not all: # Cache limits from pisi.conf - limit = int(ctx.config.values.general.package_cache_limit) * 1024 * 1024 # is this safe? - if not limit: + config = pisi.configfile.ConfigurationFile("/etc/pisi/pisi.conf") + cacheLimit = int(config.get("general", "package_cache_limit")) * 1024 * 1024 # is this safe? + if not cacheLimit: return old, latest = getPackageLists(pkgList) order = getRemoveOrder(cacheDir, latest) + getRemoveOrder(cacheDir, old) - removeOrderByLimit(cacheDir, order, limit) + removeOrderByLimit(cacheDir, order, cacheLimit) else: removeAll(cacheDir)