diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-04-20 20:50:48 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-04-20 20:50:48 +0000 |
commit | c829201cd5e92666b3610b46dec0391e62fbe16e (patch) | |
tree | 8263d7fdfc5f67f0e50d3881eec7f5840876ca16 | |
parent | 2f9e7a89a7edcec5e116ac5d921d1ab9f2ab433c (diff) | |
download | portage-c829201cd5e92666b3610b46dec0391e62fbe16e.tar.gz portage-c829201cd5e92666b3610b46dec0391e62fbe16e.tar.bz2 portage-c829201cd5e92666b3610b46dec0391e62fbe16e.zip |
Bug #218559 - Make portdbapi automatically add sandbox write access to
self.depcachedir when appropriate. This makes the portageq blanket sandbox
exemption unnecessary.
svn path=/main/trunk/; revision=9928
-rwxr-xr-x | bin/portageq | 4 | ||||
-rw-r--r-- | pym/portage/dbapi/porttree.py | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/bin/portageq b/bin/portageq index eb0d0ff69..c3fe8b37d 100755 --- a/bin/portageq +++ b/bin/portageq @@ -21,10 +21,6 @@ except KeyboardInterrupt: import os -# This allows portageq to be exempt from sandbox, -# for things like updating metadata cache. -os.environ["SANDBOX_ON"] = "0" - import types #----------------------------------------------------------------------------- diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 845fdbae5..3c0bc01b5 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -62,7 +62,16 @@ class portdbapi(dbapi): #self.root=settings["PORTDIR"] self.porttree_root = os.path.realpath(porttree_root) - self.depcachedir = self.mysettings.depcachedir[:] + self.depcachedir = os.path.realpath(self.mysettings.depcachedir) + + if os.environ.get("SANDBOX_ON") == "1": + # Make api consumers exempt from sandbox violations + # when doing metadata cache updates. + sandbox_write = os.environ.get("SANDBOX_WRITE", "").split(":") + if self.depcachedir not in sandbox_write: + sandbox_write.append(self.depcachedir) + os.environ["SANDBOX_WRITE"] = \ + ":".join(filter(None, sandbox_write)) self.eclassdb = eclass_cache.cache(self.porttree_root, overlays=self.mysettings["PORTDIR_OVERLAY"].split()) |