From b7c4d023faa00a6c93658550567b8fce2a3c6457 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 22 Dec 2006 23:26:48 +0000 Subject: When an unprivileged user runs portage (not in the portage group), use metadata_overlay together with a volatile in-memory cache module in order to implement cache writes. This allows, for example, a user who's not in the portage group to run `ebuild foo.ebuild digest` (issue reported by Charlie Shepherd ). svn path=/main/trunk/; revision=5354 --- pym/cache/flat_hash.py | 2 +- pym/cache/metadata_overlay.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'pym/cache') diff --git a/pym/cache/flat_hash.py b/pym/cache/flat_hash.py index a8adb2205..48e8a175e 100644 --- a/pym/cache/flat_hash.py +++ b/pym/cache/flat_hash.py @@ -17,7 +17,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() def __getitem__(self, cpv): diff --git a/pym/cache/metadata_overlay.py b/pym/cache/metadata_overlay.py index c4d18c173..b829ea579 100644 --- a/pym/cache/metadata_overlay.py +++ b/pym/cache/metadata_overlay.py @@ -19,7 +19,10 @@ class database(template.database): **config): super(database, self).__init__(location, label, auxdbkeys) self.db_rw = db_rw(location, label, auxdbkeys, **config) - self.db_ro = db_ro(label,"metadata/cache",auxdbkeys) + self.commit = self.db_rw.commit + ro_config = config.copy() + ro_config["readonly"] = True + self.db_ro = db_ro(label, "metadata/cache", auxdbkeys, **ro_config) def __getitem__(self, cpv): """funnel whiteout validation through here, since value needs to be fetched""" -- cgit v1.2.3-1-g7c22