summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-03-17 21:24:49 +0000
committerZac Medico <zmedico@gentoo.org>2006-03-17 21:24:49 +0000
commit2340ea43d3797e957ec1a5417b39debb48844991 (patch)
treed8ff58ba6754155a42b47b5c84839787f29cb795
parent28f4f5490d08bcdae1229d30b0b833172ee08c98 (diff)
downloadportage-2340ea43d3797e957ec1a5417b39debb48844991.tar.gz
portage-2340ea43d3797e957ec1a5417b39debb48844991.tar.bz2
portage-2340ea43d3797e957ec1a5417b39debb48844991.zip
Fix error handling for $DISTDIR/cvs-src creation and permissions in doebuild.
svn path=/main/trunk/; revision=2919
-rw-r--r--pym/portage.py48
1 files changed, 27 insertions, 21 deletions
diff --git a/pym/portage.py b/pym/portage.py
index a4a9bf845..ca5469614 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -2819,27 +2819,33 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea
fetchme=newuris[:]
checkme=alist[:]
- try:
- if not os.path.exists(mysettings["DISTDIR"]):
- os.makedirs(mysettings["DISTDIR"])
- if not os.path.exists(mysettings["DISTDIR"]+"/cvs-src"):
- os.makedirs(mysettings["DISTDIR"]+"/cvs-src")
- except OSError, e:
- print "!!! File system problem. (Bad Symlink?)"
- print "!!! Fetching may fail:",str(e)
-
- try:
- mystat=os.stat(mysettings["DISTDIR"]+"/cvs-src")
- if ((mystat[stat.ST_GID]!=portage_gid) or ((mystat[stat.ST_MODE]&02770)!=02770)) and not listonly:
- print "*** Adjusting cvs-src permissions for portage user..."
- apply_secpass_permissions(mysettings["DISTDIR"]+"/cvs-src",
- uid=0, gid=portage_gid, mode=02770, stat_cached=mystat)
- spawn("chgrp -R "+str(portage_gid)+" "+mysettings["DISTDIR"]+"/cvs-src", free=1)
- spawn("chmod -R g+rw "+mysettings["DISTDIR"]+"/cvs-src", free=1)
- except SystemExit, e:
- raise
- except:
- pass
+ if not listonly:
+ for x in ("", "cvs-src"):
+ mydir = os.path.join(mysettings["DISTDIR"], x)
+ try:
+ os.makedirs(mydir)
+ except OSError, oe:
+ if errno.EEXIST == oe.errno:
+ pass
+ elif errno.EPERM == oe.errno:
+ writemsg("!!! %s\n" % str(oe))
+ writemsg("!!! Fetching may fail!\n")
+ else:
+ raise
+ 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))
# 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`,