Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/
Date: Thu, 12 May 2011 01:16:56
Message-Id: 15ec54ba9615feadbc2b6bb1d32df16a826c6159.zmedico@gentoo
1 commit: 15ec54ba9615feadbc2b6bb1d32df16a826c6159
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 12 01:14:54 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu May 12 01:14:54 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=15ec54ba
7
8 portdbapi: tweak cache permission handling
9
10 This is a reponse to the following issue:
11
12 http://code.google.com/p/chromium-os/issues/detail?id=15234
13
14 ---
15 pym/portage/dbapi/porttree.py | 20 ++++++++++++--------
16 1 files changed, 12 insertions(+), 8 deletions(-)
17
18 diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
19 index cd74d21..379cc68 100644
20 --- a/pym/portage/dbapi/porttree.py
21 +++ b/pym/portage/dbapi/porttree.py
22 @@ -17,6 +17,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
23 'portage.versions:best,catpkgsplit,_pkgsplit@pkgsplit,ver_regexp',
24 )
25
26 +from portage.cache import metadata_overlay, volatile
27 from portage.cache.cache_errors import CacheError
28 from portage.cache.mappings import Mapping
29 from portage.dbapi import dbapi
30 @@ -40,6 +41,7 @@ import codecs
31 import logging
32 import stat
33 import sys
34 +import traceback
35 import warnings
36
37 if sys.hexversion >= 0x3000000:
38 @@ -159,17 +161,14 @@ class portdbapi(dbapi):
39 'perms' : 0o664
40 }
41
42 - if secpass < 1:
43 - # portage_gid is irrelevant, so just obey umask
44 - cache_kwargs['gid'] = -1
45 - cache_kwargs['perms'] = -1
46 -
47 # XXX: REMOVE THIS ONCE UNUSED_0 IS YANKED FROM auxdbkeys
48 # ~harring
49 filtered_auxdbkeys = [x for x in auxdbkeys if not x.startswith("UNUSED_0")]
50 filtered_auxdbkeys.sort()
51 - from portage.cache import metadata_overlay, volatile
52 - if not depcachedir_w_ok:
53 + # If secpass < 1, we don't want to write to the cache
54 + # since then we won't be able to apply group permissions
55 + # to the cache entries/directories.
56 + if secpass < 1 or not depcachedir_w_ok:
57 for x in self.porttrees:
58 db_ro = self.auxdbmodule(self.depcachedir, x,
59 filtered_auxdbkeys, gid=portage_gid, readonly=True)
60 @@ -370,7 +369,12 @@ class portdbapi(dbapi):
61 metadata[k] = ""
62 metadata["EAPI"] = "-" + eapi.lstrip("-")
63
64 - self.auxdb[repo_path][cpv] = metadata
65 + try:
66 + self.auxdb[repo_path][cpv] = metadata
67 + except CacheError:
68 + # Normally this shouldn't happen, so we'll show
69 + # a traceback for debugging purposes.
70 + traceback.print_exc()
71 return metadata
72
73 def _pull_valid_cache(self, cpv, ebuild_path, repo_path):