summaryrefslogtreecommitdiffstats
path: root/pym/portage/dbapi/porttree.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-10-17 16:08:44 -0700
committerZac Medico <zmedico@gentoo.org>2011-10-17 16:08:44 -0700
commita63c163a50bf8a4e5ca8673cd8bebae29c36643a (patch)
tree8c131974eef7483a3b257487d6124397d0d4dec5 /pym/portage/dbapi/porttree.py
parent58b1c71329f9d9ce0ee3a004d9ecaa8887d1dfd5 (diff)
downloadportage-a63c163a50bf8a4e5ca8673cd8bebae29c36643a.tar.gz
portage-a63c163a50bf8a4e5ca8673cd8bebae29c36643a.tar.bz2
portage-a63c163a50bf8a4e5ca8673cd8bebae29c36643a.zip
portdbapi: fix volatile cache handling
The metadata_overlay usage, that was triggered automatically for users without depcachedir write access, has been broken since commit 2ed1cb53cc4158af08c22d466b15b9a9a7767212. The metadata_overlay class is not compatible with the new validation code, so remove it. If users have metadata_overlay configured as their cache module, fall back to flat_hash.
Diffstat (limited to 'pym/portage/dbapi/porttree.py')
-rw-r--r--pym/portage/dbapi/porttree.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 6ad7a6b37..aad72e144 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -17,7 +17,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.versions:best,catpkgsplit,_pkgsplit@pkgsplit,ver_regexp',
)
-from portage.cache import metadata_overlay, volatile
+from portage.cache import volatile
from portage.cache.cache_errors import CacheError
from portage.cache.mappings import Mapping
from portage.dbapi import dbapi
@@ -150,6 +150,9 @@ class portdbapi(dbapi):
self.auxdbmodule = self.settings.load_best_module("portdbapi.auxdbmodule")
self.auxdb = {}
self._pregen_auxdb = {}
+ # If the current user doesn't have depcachedir write permission,
+ # then the depcachedir cache is kept here read-only access.
+ self._ro_auxdb = {}
self._init_cache_dirs()
try:
depcachedir_st = os.stat(self.depcachedir)
@@ -189,18 +192,14 @@ class portdbapi(dbapi):
# to the cache entries/directories.
if (secpass < 1 and not depcachedir_unshared) or not depcachedir_w_ok:
for x in self.porttrees:
+ self.auxdb[x] = volatile.database(
+ self.depcachedir, x, filtered_auxdbkeys,
+ **cache_kwargs)
try:
- db_ro = self.auxdbmodule(self.depcachedir, x,
+ self._ro_auxdb[x] = self.auxdbmodule(self.depcachedir, x,
filtered_auxdbkeys, readonly=True, **cache_kwargs)
except CacheError:
- self.auxdb[x] = volatile.database(
- self.depcachedir, x, filtered_auxdbkeys,
- **cache_kwargs)
- else:
- self.auxdb[x] = metadata_overlay.database(
- self.depcachedir, x, filtered_auxdbkeys,
- db_rw=volatile.database, db_ro=db_ro,
- **cache_kwargs)
+ pass
else:
for x in self.porttrees:
if x in self.auxdb:
@@ -208,8 +207,6 @@ class portdbapi(dbapi):
# location, label, auxdbkeys
self.auxdb[x] = self.auxdbmodule(
self.depcachedir, x, filtered_auxdbkeys, **cache_kwargs)
- if self.auxdbmodule is metadata_overlay.database:
- self.auxdb[x].db_ro.ec = self._repo_info[x].eclass_db
if "metadata-transfer" not in self.settings.features:
for x in self.porttrees:
if x in self._pregen_auxdb:
@@ -440,6 +437,9 @@ class portdbapi(dbapi):
pregen_auxdb = self._pregen_auxdb.get(repo_path)
if pregen_auxdb is not None:
auxdbs.append(pregen_auxdb)
+ ro_auxdb = self._ro_auxdb.get(repo_path)
+ if ro_auxdb is not None:
+ auxdbs.append(ro_auxdb)
auxdbs.append(self.auxdb[repo_path])
eclass_db = self._repo_info[repo_path].eclass_db