public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/sync/
Date: Sun,  7 Dec 2014 22:57:17 +0000 (UTC)	[thread overview]
Message-ID: <1417993027.9a2b1e6096e35508e9f101fa0478101493ef0335.mgorny@gentoo> (raw)

commit:     9a2b1e6096e35508e9f101fa0478101493ef0335
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Dec  5 22:54:27 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=9a2b1e60

sync: ensure sync_{umask,user} is respected when creating repo

---
 pym/portage/sync/controller.py | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index ab6eb21..9001298 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -192,11 +192,6 @@ class SyncManager(object):
 			st = os.stat(repo.location)
 		except OSError:
 			st = None
-		if st is None:
-			writemsg_level(">>> '%s' not found, creating it."
-				% _unicode_decode(repo.location))
-			portage.util.ensure_dirs(repo.location, mode=0o755)
-			st = os.stat(repo.location)
 
 		self.usersync_uid = None
 		spawn_kwargs = {}
@@ -249,7 +244,24 @@ class SyncManager(object):
 				spawn_kwargs["groups"] = [gid]
 			if home is not None:
 				spawn_kwargs["env"]["HOME"] = home
-		elif ('usersync' in self.settings.features and
+
+		if st is None:
+			perms = {'mode': 0o755}
+			# respect sync-user if set
+			if 'umask' in spawn_kwargs:
+				perms['mode'] &= ~spawn_kwargs['umask']
+			if 'uid' in spawn_kwargs:
+				perms['uid'] = spawn_kwargs['uid']
+			if 'gid' in spawn_kwargs:
+				perms['gid'] = spawn_kwargs['gid']
+
+			writemsg_level(">>> '%s' not found, creating it."
+				% _unicode_decode(repo.location))
+			portage.util.ensure_dirs(repo.location, **perms)
+			st = os.stat(repo.location)
+
+		if (repo.sync_user is None and
+			'usersync' in self.settings.features and
 			portage.data.secpass >= 2 and
 			(st.st_uid != os.getuid() and st.st_mode & 0o700 or
 			st.st_gid != os.getgid() and st.st_mode & 0o070)):


             reply	other threads:[~2014-12-07 22:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-07 22:57 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-17 23:59 [gentoo-commits] proj/portage:master commit in: pym/portage/sync/ Zac Medico
2015-12-12 23:42 Zac Medico
2015-11-24 16:16 Zac Medico
2015-10-06 16:27 Zac Medico
2015-09-23 22:32 Zac Medico
2015-08-30 23:52 Zac Medico
2015-07-14 21:31 Brian Dolbec
2015-04-22 16:59 Brian Dolbec
2015-02-09 20:12 Brian Dolbec
2015-02-09 20:12 Brian Dolbec
2015-01-18 18:04 Michał Górny
2014-12-07  9:15 Brian Dolbec
2014-12-07  5:42 Brian Dolbec
2014-12-04 20:16 Brian Dolbec
2014-12-04 20:16 Brian Dolbec
2014-12-04 20:16 Brian Dolbec
2014-12-04 20:04 [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:16 ` [gentoo-commits] proj/portage:master " Brian Dolbec
2014-12-04 20:04 [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:16 ` [gentoo-commits] proj/portage:master " Brian Dolbec
2014-12-04 20:04 [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:16 ` [gentoo-commits] proj/portage:master " Brian Dolbec
2014-12-04 20:04 [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:16 ` [gentoo-commits] proj/portage:master " Brian Dolbec
2014-12-04 20:04 [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:16 ` [gentoo-commits] proj/portage:master " Brian Dolbec

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=1417993027.9a2b1e6096e35508e9f101fa0478101493ef0335.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-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