summaryrefslogtreecommitdiffstats
path: root/pym/portage/cache
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-06-22 05:07:45 +0000
committerZac Medico <zmedico@gentoo.org>2009-06-22 05:07:45 +0000
commit28184c982a0688ed9bc4d82df407d4e400f6318c (patch)
tree16dbce002d13f1fa5b4d88ba1261ae41e0e6fb62 /pym/portage/cache
parente478a44ddb7018fcbbaf93a42afd1c559d431b35 (diff)
downloadportage-28184c982a0688ed9bc4d82df407d4e400f6318c.tar.gz
portage-28184c982a0688ed9bc4d82df407d4e400f6318c.tar.bz2
portage-28184c982a0688ed9bc4d82df407d4e400f6318c.zip
Use portage.util.apply_permissions() inside _ensure_access().
svn path=/main/trunk/; revision=13662
Diffstat (limited to 'pym/portage/cache')
-rw-r--r--pym/portage/cache/fs_template.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/pym/portage/cache/fs_template.py b/pym/portage/cache/fs_template.py
index ee8964e70..d41749186 100644
--- a/pym/portage/cache/fs_template.py
+++ b/pym/portage/cache/fs_template.py
@@ -5,7 +5,14 @@
import os
from portage.cache import template
-from portage.data import portage_gid
+
+import portage.proxy.lazyimport
+import portage.proxy as proxy
+proxy.lazyimport.lazyimport(globals(),
+ 'portage.data:portage_gid',
+ 'portage.exception:PortageException',
+ 'portage.util:apply_permissions',
+)
class FsBased(template.database):
"""template wrapping fs needed options, and providing _ensure_access as a way to
@@ -34,14 +41,11 @@ class FsBased(template.database):
"""returns true or false if it's able to ensure that path is properly chmod'd and chowned.
if mtime is specified, attempts to ensure that's correct also"""
try:
- if self._gid != -1:
- os.chown(path, -1, self._gid)
- if self._perms != -1:
- os.chmod(path, self._perms)
+ apply_permissions(path, gid=self._gid, mode=self._perms)
if mtime != -1:
mtime=long(mtime)
os.utime(path, (mtime, mtime))
- except (OSError, IOError):
+ except (PortageException, EnvironmentError):
return False
return True