From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH 1/4] sync: allow overriding sync-umask for the repository
Date: Sat, 6 Dec 2014 01:03:33 +0100 [thread overview]
Message-ID: <1417824216-7990-2-git-send-email-mgorny@gentoo.org> (raw)
In-Reply-To: <1417824216-7990-1-git-send-email-mgorny@gentoo.org>
---
pym/portage/repository/config.py | 16 ++++++++++++----
pym/portage/sync/controller.py | 3 +++
2 files changed, 15 insertions(+), 4 deletions(-)
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 21aa7a7..0e5efb6 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -213,6 +213,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:
--
2.2.0
next prev parent reply other threads:[~2014-12-06 0:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-06 0:03 [gentoo-portage-dev] [PATCH 0/4] sync: sync-umask and sync-user support Michał Górny
2014-12-06 0:03 ` Michał Górny [this message]
2014-12-07 6:46 ` [gentoo-portage-dev] [PATCH 1/4] sync: allow overriding sync-umask for the repository Zac Medico
2014-12-07 9:00 ` [gentoo-portage-dev] [PATCH] " Michał Górny
2014-12-06 0:03 ` [gentoo-portage-dev] [PATCH 2/4] sync: allow overriding sync-user " Michał Górny
2014-12-07 7:02 ` Zac Medico
2014-12-07 9:01 ` [gentoo-portage-dev] [PATCH] " Michał Górny
2014-12-07 9:07 ` Michał Górny
2014-12-07 18:32 ` Zac Medico
2014-12-08 6:53 ` Arfrever Frehtes Taifersar Arahesis
2014-12-06 0:03 ` [gentoo-portage-dev] [PATCH 3/4] sync: ensure sync_{umask,user} is respected when creating repo Michał Górny
2014-12-07 7:10 ` Zac Medico
2014-12-06 0:03 ` [gentoo-portage-dev] [PATCH 4/4] sync: Add backwards compat with SYNC_{UMASK,USER} variables Michał Górny
2014-12-07 7:15 ` Zac Medico
2014-12-07 8:22 ` Michał Górny
2014-12-07 9:04 ` Zac Medico
2014-12-07 9:06 ` Michał Górny
2014-12-07 18:33 ` Zac Medico
2014-12-07 18:39 ` Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1417824216-7990-2-git-send-email-mgorny@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox