summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-12-30 04:10:54 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-12-30 04:10:54 +0000
commit89d9943894fb32b7f9ed63017e9332367f4a5dc1 (patch)
tree9a89f7297944d4d61688eb29ed2156dfdd012a45
parent2da4663b628825f8520f2501a337a9fe22e32f09 (diff)
downloadportage-89d9943894fb32b7f9ed63017e9332367f4a5dc1.tar.gz
portage-89d9943894fb32b7f9ed63017e9332367f4a5dc1.tar.bz2
portage-89d9943894fb32b7f9ed63017e9332367f4a5dc1.zip
Don't attempt to chmod/chown unless running as root when calling simple
ebuild functions. svn path=/main/trunk/; revision=2495
-rw-r--r--pym/portage.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/pym/portage.py b/pym/portage.py
index eaa5c6e8d..aa99c1c1c 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -2584,8 +2584,9 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea
logdir = mysettings["T"]+"/logging"
if not os.path.exists(logdir):
os.makedirs(logdir)
- os.chown(logdir, portage_uid, portage_gid)
- os.chmod(logdir, 0770)
+ if secpass == 2:
+ os.chown(logdir, portage_uid, portage_gid)
+ os.chmod(logdir, 0770)
try: # XXX: negative RESTRICT
if not (("nouserpriv" in string.split(mysettings["PORTAGE_RESTRICT"])) or \
@@ -2707,8 +2708,11 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea
print "!!!",e
if os.access(mysettings["PORT_LOGDIR"]+"/",os.W_OK):
try:
- os.chown(mysettings["PORT_LOGDIR"],portage_uid,portage_gid)
- os.chmod(mysettings["PORT_LOGDIR"],02770)
+ perms = os.stat(mysettings["PORT_LOGDIR"])
+ if perms[stat.ST_UID] != portage_uid or perms[stat.ST_GID] != portage_gid:
+ os.chown(mysettings["PORT_LOGDIR"],portage_uid,portage_gid)
+ if stat.S_IMODE(perms[stat.ST_MODE]) != 02770:
+ os.chmod(mysettings["PORT_LOGDIR"],02770)
if not mysettings.has_key("LOG_PF") or (mysettings["LOG_PF"] != mysettings["PF"]):
mysettings["LOG_PF"]=mysettings["PF"]
mysettings["LOG_COUNTER"]=str(db[myroot]["vartree"].dbapi.get_counter_tick_core("/"))