1 |
Author: zmedico |
2 |
Date: 2009-06-22 05:07:45 +0000 (Mon, 22 Jun 2009) |
3 |
New Revision: 13662 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/cache/fs_template.py |
7 |
Log: |
8 |
Use portage.util.apply_permissions() inside _ensure_access(). |
9 |
|
10 |
|
11 |
Modified: main/trunk/pym/portage/cache/fs_template.py |
12 |
=================================================================== |
13 |
--- main/trunk/pym/portage/cache/fs_template.py 2009-06-22 04:12:26 UTC (rev 13661) |
14 |
+++ main/trunk/pym/portage/cache/fs_template.py 2009-06-22 05:07:45 UTC (rev 13662) |
15 |
@@ -5,8 +5,15 @@ |
16 |
|
17 |
import os |
18 |
from portage.cache import template |
19 |
-from portage.data import portage_gid |
20 |
|
21 |
+import portage.proxy.lazyimport |
22 |
+import portage.proxy as proxy |
23 |
+proxy.lazyimport.lazyimport(globals(), |
24 |
+ 'portage.data:portage_gid', |
25 |
+ 'portage.exception:PortageException', |
26 |
+ 'portage.util:apply_permissions', |
27 |
+) |
28 |
+ |
29 |
class FsBased(template.database): |
30 |
"""template wrapping fs needed options, and providing _ensure_access as a way to |
31 |
attempt to ensure files have the specified owners/perms""" |
32 |
@@ -34,14 +41,11 @@ |
33 |
"""returns true or false if it's able to ensure that path is properly chmod'd and chowned. |
34 |
if mtime is specified, attempts to ensure that's correct also""" |
35 |
try: |
36 |
- if self._gid != -1: |
37 |
- os.chown(path, -1, self._gid) |
38 |
- if self._perms != -1: |
39 |
- os.chmod(path, self._perms) |
40 |
+ apply_permissions(path, gid=self._gid, mode=self._perms) |
41 |
if mtime != -1: |
42 |
mtime=long(mtime) |
43 |
os.utime(path, (mtime, mtime)) |
44 |
- except (OSError, IOError): |
45 |
+ except (PortageException, EnvironmentError): |
46 |
return False |
47 |
return True |