Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 157083 Details for
Bug 223417
portage-2.1.5.2 and 2.1.5.5: Random emerge failures in the merging phase (KeyError)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
actively invalidate cache when adding/removing packages (don't rely on mtime)
invalid_cache.patch (text/plain), 2.98 KB, created by
Zac Medico
on 2008-06-16 13:36:43 UTC
(
hide
)
Description:
actively invalidate cache when adding/removing packages (don't rely on mtime)
Filename:
MIME Type:
Creator:
Zac Medico
Created:
2008-06-16 13:36:43 UTC
Size:
2.98 KB
patch
obsolete
>Index: pym/portage.py >=================================================================== >--- pym/portage.py (revision 10666) >+++ pym/portage.py (revision 10668) >@@ -6551,6 +6551,22 @@ > 'return: ["0",">=sys-libs/bar-1.0","http://www.foo.com"] or [] if mycpv not found' > raise NotImplementedError > >+ def _add(self, pkg_dblink): >+ self._clear_cache(pkg_dblink) >+ >+ def _remove(self, pkg_dblink): >+ self._clear_cache(pkg_dblink) >+ >+ def _clear_cache(self, pkg_dblink): >+ # Due to 1 second mtime granularity in < python-1.5, mtime checks >+ # are not always sufficient to invalidate vardbapi caches. Therefore, >+ # the caches need to be actively invalidated here. >+ self.mtdircache.pop(pkg_dblink.cat, None) >+ self.matchcache.pop(pkg_dblink.cat, None) >+ self.cpcache.pop(pkg_dblink.mysplit[0], None) >+ from portage import dircache >+ dircache.pop(pkg_dblink.dbcatdir, None) >+ > def match(self, origdep, use_cache=1): > """Given a dependency, try to find packages that match > Args: >@@ -9033,24 +9049,15 @@ > """ > if not os.path.exists(self.dbdir): > return >- try: >- for x in os.listdir(self.dbdir): >- os.unlink(self.dbdir+"/"+x) >- os.rmdir(self.dbdir) >- except OSError, e: >- print "!!! Unable to remove db entry for this package." >- print "!!! It is possible that a directory is in this one. Portage will still" >- print "!!! register this package as installed as long as this directory exists." >- print "!!! You may delete this directory with 'rm -Rf "+self.dbdir+"'" >- print "!!! "+str(e) >- 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) >+ # Check validity of self.dbdir before attempting to remove it. >+ if not self.dbdir.startswith(self.dbroot): >+ writemsg("portage.dblink.delete(): invalid dbdir: %s\n" % \ >+ self.dbdir, noiselevel=-1) >+ return >+ import shutil >+ shutil.rmtree(self.dbdir) >+ self.vartree.dbapi._remove(self) > > def clearcontents(self): > """ >@@ -10206,11 +10213,7 @@ > f.write(line) > f.close() > >- # 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) >+ self.vartree.dbapi._add(self) > contents = self.getcontents() > > #do postinst script >Index: bin/emerge >=================================================================== >--- bin/emerge (revision 10666) >+++ bin/emerge (revision 10668) >@@ -1176,7 +1176,7 @@ > vdb_lock = portage_locks.lockdir(vdb_path) > real_dbapi = real_vartree.dbapi > slot_counters = {} >- for cpv in real_dbapi.cpv_all(use_cache=0): >+ for cpv in real_dbapi.cpv_all(): > cache_key = ("installed", self.root, cpv, "nomerge") > pkg = self._pkg_cache.get(cache_key) > if pkg is not None:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 223417
:
154177
|
157019
| 157083