diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-03-17 22:41:48 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-03-17 22:41:48 +0000 |
commit | 9d0f054967db70af58a43ab4e359a6137ecf47ce (patch) | |
tree | aac320f30691a9b82045dd720f15a3f596008c7d | |
parent | 2340ea43d3797e957ec1a5417b39debb48844991 (diff) | |
download | portage-9d0f054967db70af58a43ab4e359a6137ecf47ce.tar.gz portage-9d0f054967db70af58a43ab4e359a6137ecf47ce.tar.bz2 portage-9d0f054967db70af58a43ab4e359a6137ecf47ce.zip |
For better handling of $DISTDIR/cvs-src permissions, use os.walk instead of spawning chgrp and chmod.
svn path=/main/trunk/; revision=2922
-rw-r--r-- | pym/portage.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/pym/portage.py b/pym/portage.py index ca5469614..87810a22b 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -2835,18 +2835,32 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea try: apply_secpass_permissions(mysettings["DISTDIR"], gid=portage_gid, mode=0775, mask=02) - cvs_src_dir = os.path.join(mysettings["DISTDIR"], "cvs-src") - apply_secpass_permissions(cvs_src_dir, - gid=portage_gid, mode=02770, mask=02) - portage_exec.spawn(["chgrp", "-R", str(portage_gid), cvs_src_dir]) - portage_exec.spawn(["chmod", "-R", "g+rw", cvs_src_dir]) - portage_exec.spawn(["find", cvs_src_dir, "-type", "d", - "-exec","chmod", "g+xs", "{}", ";"]) except portage_exception.OperationNotPermitted, e: writemsg("Operation Not Permitted: %s\n" % str(e)) except portage_exception.FileNotFound, e: writemsg("File Not Found: '%s'\n" % str(e)) + def onerror(oe): + writemsg("%s\n" % str(oe)) + for dirpath, dirnames, filenames in os.walk( + os.path.join(mysettings["DISTDIR"], "cvs-src"), onerror=onerror): + try: + apply_secpass_permissions(dirpath, + gid=portage_gid, mode=02770, mask=02) + except portage_exception.OperationNotPermitted, e: + writemsg("Operation Not Permitted: %s\n" % str(e)) + except portage_exception.FileNotFound, e: + writemsg("File Not Found: '%s'\n" % str(e)) + + for name in filenames: + try: + apply_secpass_permissions(os.path.join(dirpath, name), + gid=portage_gid, mode=0660, mask=02) + except portage_exception.OperationNotPermitted, e: + writemsg("Operation Not Permitted: %s\n" % str(e)) + except portage_exception.FileNotFound, e: + writemsg("File Not Found: '%s'\n" % str(e)) + # Only try and fetch the files if we are going to need them ... otherwise, # if user has FEATURES=noauto and they run `ebuild clean unpack compile install`, # we will try and fetch 4 times :/ |