diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-04-20 20:53:33 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-04-20 20:53:33 +0000 |
commit | fd21c4439d5922802ba8d4e8362fabd0c73ecba3 (patch) | |
tree | d01d8711d7ba801ed77b597ab1b377944b1300b8 | |
parent | 5c2b1f74c9c6ed932e5a430a1d1d9562b488d89c (diff) | |
download | portage-fd21c4439d5922802ba8d4e8362fabd0c73ecba3.tar.gz portage-fd21c4439d5922802ba8d4e8362fabd0c73ecba3.tar.bz2 portage-fd21c4439d5922802ba8d4e8362fabd0c73ecba3.zip |
Bug #218559 - Make portdbapi automatically add sandbox write access to
self.depcachedir when appropriate. This makes the portageq blanket sandbox
exemption unnecessary. (trunk r9928)
svn path=/main/branches/2.1.2/; revision=9929
-rwxr-xr-x | bin/portageq | 4 | ||||
-rw-r--r-- | pym/portage.py | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/bin/portageq b/bin/portageq index f0c2e19e2..d65abaa8f 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 import portage_exception #----------------------------------------------------------------------------- diff --git a/pym/portage.py b/pym/portage.py index 44f7e212a..db1ba59fb 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -7118,7 +7118,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.tmpfs = self.mysettings["PORTAGE_TMPFS"] if self.tmpfs and not os.path.exists(self.tmpfs): |