summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-07-08 16:50:42 +0000
committerZac Medico <zmedico@gentoo.org>2007-07-08 16:50:42 +0000
commit5b6df227c9a0c4716868dd0b0258f53f3e23a562 (patch)
tree3a632357f6e7957d96358db558442e0e531ac6e2 /pym
parentc807e23b6c323ca59d7f3d249251aaff9bac3fdd (diff)
downloadportage-5b6df227c9a0c4716868dd0b0258f53f3e23a562.tar.gz
portage-5b6df227c9a0c4716868dd0b0258f53f3e23a562.tar.bz2
portage-5b6df227c9a0c4716868dd0b0258f53f3e23a562.zip
Make dblink invalidate the vardbapi caches for each merge and unmerge. Don't use portage.listdir() since mtime granularity can prevent cachedir from invalidating it's cache properly and this redundant cache layer isn't needed anyway. This should solve the intermittent failure of AUTOCLEAN to properly clean packages. (trunk r7202:7204)
svn path=/main/branches/2.1.2/; revision=7205
Diffstat (limited to 'pym')
-rw-r--r--pym/portage.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/pym/portage.py b/pym/portage.py
index cefbd0c8b..0fe864381 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -5330,12 +5330,17 @@ class vardbapi(dbapi):
cpc=self.cpcache[mycp]
if cpc[0]==mystat:
return cpc[1]
- list=listdir(self.root+VDB_PATH+"/"+mysplit[0],EmptyOnError=1)
+ cat_dir = os.path.join(self.root, VDB_PATH, mysplit[0])
+ try:
+ dir_list = os.listdir(cat_dir)
+ except EnvironmentError, e:
+ if e.errno == portage_exception.PermissionDenied.errno:
+ raise portage_exception.PermissionDenied(cat_dir)
+ del e
+ dir_list = []
- if (list is None):
- return []
- returnme=[]
- for x in list:
+ returnme = []
+ for x in dir_list:
if x.startswith("."):
continue
if x[0] == '-':
@@ -6994,7 +6999,7 @@ class dblink:
if not os.path.exists(self.dbdir):
return
try:
- for x in listdir(self.dbdir):
+ for x in os.listdir(self.dbdir):
os.unlink(self.dbdir+"/"+x)
os.rmdir(self.dbdir)
except OSError, e:
@@ -7006,6 +7011,12 @@ class dblink:
print
sys.exit(1)
+ # Due to mtime granularity, mtime checks do not always properly
+ # invalidate vardbapi caches.
+ self.vartree.dbapi.mtdircache.pop(self.cat, None)
+ self.vartree.dbapi.matchcache.pop(self.cat, None)
+ self.vartree.dbapi.cpcache.pop(self.mysplit[0], None)
+
def clearcontents(self):
"""
For a given db entry (self), erase the CONTENTS values.
@@ -7798,6 +7809,11 @@ class dblink:
self.dbdir = self.dbpkgdir
self.delete()
_movefile(self.dbtmpdir, self.dbpkgdir, mysettings=self.settings)
+ # Due to mtime granularity, mtime checks do not always properly
+ # invalidate vardbapi caches.
+ self.vartree.dbapi.mtdircache.pop(self.cat, None)
+ self.vartree.dbapi.matchcache.pop(self.cat, None)
+ self.vartree.dbapi.cpcache.pop(self.mysplit[0], None)
contents = self.getcontents()
#write out our collection of md5sums