aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-05-12 11:42:08 -0700
committerZac Medico <zmedico@gentoo.org>2011-05-12 11:42:08 -0700
commit34b54ba9e854b13f0413383979824ac3f90a2686 (patch)
tree68ac6d6889c38eac14a46b53f60b5cf12a3c4f51 /pym/portage/cache
parentexpand_new_virt: return early for non-virtual cat (diff)
downloadportage-34b54ba9e854b13f0413383979824ac3f90a2686.tar.gz
portage-34b54ba9e854b13f0413383979824ac3f90a2686.tar.bz2
portage-34b54ba9e854b13f0413383979824ac3f90a2686.zip
cache.sqlite: handle readonly
Diffstat (limited to 'pym/portage/cache')
-rw-r--r--pym/portage/cache/sqlite.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py
index d15b6ece1..4eb340bb0 100644
--- a/pym/portage/cache/sqlite.py
+++ b/pym/portage/cache/sqlite.py
@@ -31,7 +31,7 @@ class database(fs_template.FsBased):
self.location = os.path.join(self.location,
self.label.lstrip(os.path.sep).rstrip(os.path.sep))
- if not os.path.exists(self.location):
+ if not self.readonly and not os.path.exists(self.location):
self._ensure_dirs()
config.setdefault("autocommit", self.autocommits)
@@ -72,7 +72,8 @@ class database(fs_template.FsBased):
connection_kwargs = {}
connection_kwargs["timeout"] = config["timeout"]
try:
- self._ensure_dirs()
+ if not self.readonly:
+ self._ensure_dirs()
self._db_connection = self._db_module.connect(
database=_unicode_decode(self._dbpath), **connection_kwargs)
self._db_cursor = self._db_connection.cursor()