commit: 8f57f47d6e7ac110491af520f674a51e0cc564b0
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 5 22:14:11 2014 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Dec 7 22:57:07 2014 +0000
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8f57f47d
sync: allow overriding sync-umask for the repository
---
man/portage.5 | 5 +++++
pym/portage/repository/config.py | 16 ++++++++++++----
pym/portage/sync/controller.py | 3 +++
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/man/portage.5 b/man/portage.5
index 150294b..8c3d389 100644
--- a/man/portage.5
+++ b/man/portage.5
@@ -901,6 +901,11 @@ Valid non\-empty values: cvs, git, rsync
This attribute can be set to empty value to disable synchronization of given
repository. Empty value is default.
.TP
+.B sync\-umask
+Specifies umask used to synchronize the repository.
+.br
+Takes an octal permission mask, e.g. 022.
+.TP
.B sync\-uri
Specifies URI of repository used for synchronization performed by `emerge
\-\-sync`.
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index d37ce6a..678cc68 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -85,8 +85,9 @@ class RepoConfig(object):
'main_repo', 'manifest_hashes', 'masters', 'missing_repo_name',
'name', 'portage1_profiles', 'portage1_profiles_compat',
'priority',
'profile_formats', 'sign_commit', 'sign_manifest',
'sync_cvs_repo',
- 'sync_type', 'sync_uri', 'thin_manifest', 'update_changelog',
- 'user_location', '_eapis_banned', '_eapis_deprecated',
'_masters_orig')
+ 'sync_type', 'sync_umask', 'sync_uri', 'thin_manifest',
+ 'update_changelog', 'user_location', '_eapis_banned',
+ '_eapis_deprecated', '_masters_orig')
def __init__(self, name, repo_opts, local_config=True):
"""Build a RepoConfig with options in repo_opts
@@ -154,6 +155,11 @@ class RepoConfig(object):
sync_type = sync_type.strip()
self.sync_type = sync_type or None
+ sync_umask = repo_opts.get('sync-umask')
+ if sync_umask is not None:
+ sync_umask = sync_umask.strip()
+ self.sync_umask = sync_umask or None
+
sync_uri = repo_opts.get('sync-uri')
if sync_uri is not None:
sync_uri = sync_uri.strip()
@@ -375,6 +381,8 @@ class RepoConfig(object):
repo_msg.append(indent + "sync-cvs-repo: " +
self.sync_cvs_repo)
if self.sync_type:
repo_msg.append(indent + "sync-type: " + self.sync_type)
+ if self.sync_umask:
+ repo_msg.append(indent + "sync-umask: " +
self.sync_umask)
if self.sync_uri:
repo_msg.append(indent + "sync-uri: " + self.sync_uri)
if self.masters:
@@ -464,7 +472,7 @@ class RepoConfigLoader(object):
# repos.conf is allowed to
override.
for k in ('aliases',
'auto_sync', 'eclass_overrides',
'force', 'masters',
'priority', 'sync_cvs_repo',
- 'sync_type', 'sync_uri',
+ 'sync_type',
'sync_umask', 'sync_uri',
):
v =
getattr(repos_conf_opts, k, None)
if v is not None:
@@ -915,7 +923,7 @@ class RepoConfigLoader(object):
def config_string(self):
str_or_int_keys = ("auto_sync", "format", "location",
"main_repo", "priority", "sync_cvs_repo",
- "sync_type", "sync_uri")
+ "sync_type", "sync_umask", "sync_uri")
str_tuple_keys = ("aliases", "eclass_overrides", "force")
repo_config_tuple_keys = ("masters",)
keys = str_or_int_keys + str_tuple_keys + repo_config_tuple_keys
diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 6b9fb2c..006300c 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -220,6 +220,9 @@ class SyncManager(object):
if not st.st_mode & 0o020:
umask = umask | 0o020
spawn_kwargs["umask"] = umask
+ # override the defaults when sync_umask is set
+ if repo.sync_umask is not None:
+ spawn_kwargs["umask"] = int(repo.sync_umask, 8)
self.spawn_kwargs = spawn_kwargs
if self.usersync_uid is not None: