summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-05-11 18:14:54 -0700
committerZac Medico <zmedico@gentoo.org>2011-05-11 18:14:54 -0700
commit15ec54ba9615feadbc2b6bb1d32df16a826c6159 (patch)
tree2bdb8b9f16aac354bcc4951247b4a93ae2a132bb
parent60c086dcb69472bfcea3cb61ffd87bd796d46671 (diff)
downloadportage-15ec54ba9615feadbc2b6bb1d32df16a826c6159.tar.gz
portage-15ec54ba9615feadbc2b6bb1d32df16a826c6159.tar.bz2
portage-15ec54ba9615feadbc2b6bb1d32df16a826c6159.zip
portdbapi: tweak cache permission handling
This is a reponse to the following issue: http://code.google.com/p/chromium-os/issues/detail?id=15234
-rw-r--r--pym/portage/dbapi/porttree.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index cd74d21df..379cc68cd 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -17,6 +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.cache_errors import CacheError
from portage.cache.mappings import Mapping
from portage.dbapi import dbapi
@@ -40,6 +41,7 @@ import codecs
import logging
import stat
import sys
+import traceback
import warnings
if sys.hexversion >= 0x3000000:
@@ -159,17 +161,14 @@ class portdbapi(dbapi):
'perms' : 0o664
}
- if secpass < 1:
- # portage_gid is irrelevant, so just obey umask
- cache_kwargs['gid'] = -1
- cache_kwargs['perms'] = -1
-
# XXX: REMOVE THIS ONCE UNUSED_0 IS YANKED FROM auxdbkeys
# ~harring
filtered_auxdbkeys = [x for x in auxdbkeys if not x.startswith("UNUSED_0")]
filtered_auxdbkeys.sort()
- from portage.cache import metadata_overlay, volatile
- if not depcachedir_w_ok:
+ # If secpass < 1, we don't want to write to the cache
+ # since then we won't be able to apply group permissions
+ # to the cache entries/directories.
+ if secpass < 1 or not depcachedir_w_ok:
for x in self.porttrees:
db_ro = self.auxdbmodule(self.depcachedir, x,
filtered_auxdbkeys, gid=portage_gid, readonly=True)
@@ -370,7 +369,12 @@ class portdbapi(dbapi):
metadata[k] = ""
metadata["EAPI"] = "-" + eapi.lstrip("-")
- self.auxdb[repo_path][cpv] = metadata
+ try:
+ self.auxdb[repo_path][cpv] = metadata
+ except CacheError:
+ # Normally this shouldn't happen, so we'll show
+ # a traceback for debugging purposes.
+ traceback.print_exc()
return metadata
def _pull_valid_cache(self, cpv, ebuild_path, repo_path):