From: Zac Medico Date: Thu, 12 May 2011 18:42:08 +0000 (-0700) Subject: cache.sqlite: handle readonly X-Git-Tag: v2.1.9.49~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f78c4c37db15172e092db99fe8ef96d26ff9bc7d;p=portage.git cache.sqlite: handle readonly --- 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()