summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-07-27 22:07:49 +0000
committerZac Medico <zmedico@gentoo.org>2006-07-27 22:07:49 +0000
commit6110ef3b178a08b393d7f539fb2d4ee2d2e556eb (patch)
tree425bf14eb805c96313bede0060169f45d1aacfb3 /pym
parent6a034c0774ff51f91c8c3166651bf19b8df6c8a4 (diff)
downloadportage-6110ef3b178a08b393d7f539fb2d4ee2d2e556eb.tar.gz
portage-6110ef3b178a08b393d7f539fb2d4ee2d2e556eb.tar.bz2
portage-6110ef3b178a08b393d7f539fb2d4ee2d2e556eb.zip
Simplify permissions adjustment after a file is fetched.
svn path=/main/trunk/; revision=4037
Diffstat (limited to 'pym')
-rw-r--r--pym/portage.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 8f9dd0041..3efdee888 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -2049,18 +2049,15 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
selinux.setexec(None)
finally:
- #if root, -always- set the perms.
- if os.path.exists(mysettings["DISTDIR"]+"/"+myfile) and (fetched != 1 or os.getuid() == 0) \
- and os.access(mysettings["DISTDIR"]+"/",os.W_OK):
- if os.stat(mysettings["DISTDIR"]+"/"+myfile).st_gid != portage_gid:
- try:
- os.chown(mysettings["DISTDIR"]+"/"+myfile,-1,portage_gid)
- except SystemExit, e:
- raise
- except:
- portage_util.writemsg("chown failed on distfile: " + str(myfile),
- noiselevel=-1)
- os.chmod(mysettings["DISTDIR"]+"/"+myfile,0664)
+ try:
+ apply_secpass_permissions(myfile_path,
+ gid=portage_gid, mode=0664, mask=02)
+ except portage_exception.FileNotFound, e:
+ pass
+ except portage_exception.PortageException, e:
+ if not os.access(myfile_path, os.R_OK):
+ writemsg("!!! Failed to adjust permissions:" + \
+ " %s\n" % str(e), noiselevel=-1)
if mydigests!=None and mydigests.has_key(myfile):
try: