From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1R1M3Y-0004oT-KQ for garchives@archives.gentoo.org; Wed, 07 Sep 2011 17:37:01 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 285CB21C054; Wed, 7 Sep 2011 17:36:53 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id DF62721C054 for ; Wed, 7 Sep 2011 17:36:52 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 654621B4020 for ; Wed, 7 Sep 2011 17:36:52 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id B957380042 for ; Wed, 7 Sep 2011 17:36:51 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <37d9c3df6b25f10a78ff216875bb481e0171fae0.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dbapi/porttree.py X-VCS-Directories: pym/portage/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 37d9c3df6b25f10a78ff216875bb481e0171fae0 Date: Wed, 7 Sep 2011 17:36:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 2197257ce81134d8cb767e44fd255eb1 commit: 37d9c3df6b25f10a78ff216875bb481e0171fae0 Author: Zac Medico gentoo org> AuthorDate: Wed Sep 7 17:36:37 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Sep 7 17:36:37 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D37d9c3df pordbapi: add unshared cache mode for egencache --- pym/portage/dbapi/porttree.py | 33 +++++++++++++++++++++++++++------ 1 files changed, 27 insertions(+), 6 deletions(-) diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.p= y index bf8ecd9..ac972c4 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -154,11 +154,32 @@ class portdbapi(dbapi): self.auxdb =3D {} self._pregen_auxdb =3D {} self._init_cache_dirs() - depcachedir_w_ok =3D os.access(self.depcachedir, os.W_OK) - cache_kwargs =3D { - 'gid' : portage_gid, - 'perms' : 0o664 - } + try: + depcachedir_st =3D os.stat(self.depcachedir) + depcachedir_w_ok =3D os.access(self.depcachedir, os.W_OK) + except OSError: + depcachedir_st =3D None + depcachedir_w_ok =3D False + + cache_kwargs =3D {} + + depcachedir_unshared =3D False + if portage.data.secpass < 1 and \ + depcachedir_w_ok and \ + depcachedir_st is not None and \ + os.getuid() =3D=3D depcachedir_st.st_uid and \ + os.getgid() =3D=3D depcachedir_st.st_gid: + # If this user owns depcachedir and is not in the + # portage group, then don't bother to set permissions + # on cache entries. This makes it possible to run + # egencache without any need to be a member of the + # portage group. + depcachedir_unshared =3D True + else: + cache_kwargs.update({ + 'gid' : portage_gid, + 'perms' : 0o664 + }) =20 # XXX: REMOVE THIS ONCE UNUSED_0 IS YANKED FROM auxdbkeys # ~harring @@ -167,7 +188,7 @@ class portdbapi(dbapi): # 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: + if (secpass < 1 and not depcachedir_unshared) or not depcachedir_w_ok: for x in self.porttrees: try: db_ro =3D self.auxdbmodule(self.depcachedir, x,