1 |
--- |
2 |
pym/portage/sync/controller.py | 24 ++++++++++++++++++------ |
3 |
1 file changed, 18 insertions(+), 6 deletions(-) |
4 |
|
5 |
diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py |
6 |
index 3104524..4fa1e5a 100644 |
7 |
--- a/pym/portage/sync/controller.py |
8 |
+++ b/pym/portage/sync/controller.py |
9 |
@@ -185,11 +185,6 @@ class SyncManager(object): |
10 |
st = os.stat(repo.location) |
11 |
except OSError: |
12 |
st = None |
13 |
- if st is None: |
14 |
- writemsg_level(">>> '%s' not found, creating it." |
15 |
- % _unicode_decode(repo.location)) |
16 |
- portage.util.ensure_dirs(repo.location, mode=0o755) |
17 |
- st = os.stat(repo.location) |
18 |
|
19 |
self.usersync_uid = None |
20 |
spawn_kwargs = {} |
21 |
@@ -243,7 +238,24 @@ class SyncManager(object): |
22 |
spawn_kwargs["gid"] = gid |
23 |
spawn_kwargs["groups"] = [gid] |
24 |
spawn_kwargs["env"]["HOME"] = home |
25 |
- elif ('usersync' in self.settings.features and |
26 |
+ |
27 |
+ if st is None: |
28 |
+ perms = {'mode': 0o755} |
29 |
+ # respect sync-user if set |
30 |
+ if 'umask' in spawn_kwargs: |
31 |
+ perms['mode'] &= ~spawn_kwargs['umask'] |
32 |
+ if 'uid' in spawn_kwargs: |
33 |
+ perms['uid'] = spawn_kwargs['uid'] |
34 |
+ if 'gid' in spawn_kwargs: |
35 |
+ perms['gid'] = spawn_kwargs['gid'] |
36 |
+ |
37 |
+ writemsg_level(">>> '%s' not found, creating it." |
38 |
+ % _unicode_decode(repo.location)) |
39 |
+ portage.util.ensure_dirs(repo.location, **perms) |
40 |
+ st = os.stat(repo.location) |
41 |
+ |
42 |
+ if (repo.sync_user is None and |
43 |
+ 'usersync' in self.settings.features and |
44 |
portage.data.secpass >= 2 and |
45 |
(st.st_uid != os.getuid() and st.st_mode & 0o700 or |
46 |
st.st_gid != os.getgid() and st.st_mode & 0o070)): |
47 |
-- |
48 |
2.2.0 |