diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-07-08 16:36:58 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-07-08 16:36:58 +0000 |
commit | 3b3900b799799bea991d541c63535a12045f3bbe (patch) | |
tree | e169cd91090f71f4c6b34cfe212413de0a63f816 | |
parent | ac0a630b42c12b5f0d3088d4f4c45186c82d3d57 (diff) | |
download | portage-3b3900b799799bea991d541c63535a12045f3bbe.tar.gz portage-3b3900b799799bea991d541c63535a12045f3bbe.tar.bz2 portage-3b3900b799799bea991d541c63535a12045f3bbe.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.
svn path=/main/trunk/; revision=7203
-rw-r--r-- | pym/portage/dbapi/vartree.py | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 2df2f841f..03db114b1 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -342,12 +342,17 @@ class vardbapi(dbapi): cpc = self.cpcache[mycp] if cpc[0] == mystat: return cpc[1] - list = listdir(self.getpath(mysplit[0]), EmptyOnError=1) + try: + dir_list = os.listdir(self.getpath(mysplit[0])) + except EnvironmentError, e: + from portage.exception import PermissionDenied + if e.errno == PermissionDenied.errno: + raise PermissionDenied(e) + del e + dir_list = [] - if (list is None): - return [] returnme = [] - for x in list: + for x in dir_list: if x.startswith("."): continue if x[0] == '-': @@ -892,7 +897,7 @@ class dblink(object): 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: @@ -904,6 +909,12 @@ class dblink(object): 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. @@ -1792,6 +1803,11 @@ class dblink(object): 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 |