summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-05-27 07:48:19 +0000
committerZac Medico <zmedico@gentoo.org>2008-05-27 07:48:19 +0000
commitc868422d525109dc2588c72c9b9b6d4c2020d412 (patch)
treec371f636f04a9d8d9424cee9572611ff761f1559 /pym
parent66ea890ee5ce78e51b0d3cb1e75ba2c4fa552e0b (diff)
downloadportage-c868422d525109dc2588c72c9b9b6d4c2020d412.tar.gz
portage-c868422d525109dc2588c72c9b9b6d4c2020d412.tar.bz2
portage-c868422d525109dc2588c72c9b9b6d4c2020d412.zip
Make config._init_dirs() preserver /tmp and /var/tmp permissions if
those directories already exist. This gives freedom to the user to adjust permissions to suit their taste. svn path=/main/trunk/; revision=10452
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 1ff6f25b8..df3736302 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -1663,16 +1663,23 @@ class config(object):
if not os.access(self["ROOT"], os.W_OK):
return
+ # gid, mode, mask, preserve_perms
dir_mode_map = {
- "tmp" : (-1, 01777, 0),
- "var/tmp" : (-1, 01777, 0),
- PRIVATE_PATH : (portage_gid, 02750, 02),
- CACHE_PATH.lstrip(os.path.sep) : (portage_gid, 0755, 02)
+ "tmp" : ( -1, 01777, 0, True),
+ "var/tmp" : ( -1, 01777, 0, True),
+ PRIVATE_PATH : ( portage_gid, 02750, 02, False),
+ CACHE_PATH.lstrip(os.path.sep) : (portage_gid, 0755, 02, False)
}
- for mypath, (gid, mode, modemask) in dir_mode_map.iteritems():
+ for mypath, (gid, mode, modemask, preserve_perms) \
+ in dir_mode_map.iteritems():
+ mydir = os.path.join(self["ROOT"], mypath)
+ if preserve_perms and os.path.isdir(mypath):
+ # Only adjust permissions on some directories if
+ # they don't exist yet. This gives freedom to the
+ # user to adjust permissions to suit their taste.
+ continue
try:
- mydir = os.path.join(self["ROOT"], mypath)
portage.util.ensure_dirs(mydir, gid=gid, mode=mode, mask=modemask)
except portage.exception.PortageException, e:
writemsg("!!! Directory initialization failed: '%s'\n" % mydir,