[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.45-35-g3633050

Andreas Beckmann debian at abeckmann.de
Wed Jun 27 20:03:46 UTC 2012


The following commit has been merged in the develop branch:
commit 01c385649aefa6cca879f59937e06fe669c91e50
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Mon Jun 25 16:52:06 2012 +0200

    logdb: evict file from cache after create/remove
    
    the cache may contain stale data about this file otherwise
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index 8948f79..14f7629 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -176,6 +176,14 @@ class LogDB:
             cache[pathname] = os.path.exists(pathname)
         return cache[pathname]
 
+    def _evict(self, pathname):
+        try:
+            cache = self.exists_cache
+            if pathname in cache:
+                del cache[pathname]
+        except AttributeError:
+            pass
+
     def open_file(self, pathname, mode):
         return file(pathname, mode)
 
@@ -212,12 +220,14 @@ class LogDB:
         f = self.open_file(full_name, "w")
         f.write(contents)
         f.close()
+        self._evict(full_name)
         return True
 
     def remove(self, subdir, package, version):
         full_name = os.path.join(subdir, self._log_name(package, version))
         if self.exists(full_name):
             self.remove_file(full_name)
+        self._evict(full_name)
 
 
 class PackagesDB:

-- 
piuparts git repository



More information about the Piuparts-commits mailing list