summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-04-14 11:03:28 +0000
committerZac Medico <zmedico@gentoo.org>2006-04-14 11:03:28 +0000
commit545e96ac48d6ac0927a4c462d77135ef32f142d8 (patch)
treee812f5205121f3f7acbc990b4bc35bbd5e3177bf
parent6ecb7943d09eee2f31fce8b194214a6cb61037e3 (diff)
downloadportage-545e96ac48d6ac0927a4c462d77135ef32f142d8.tar.gz
portage-545e96ac48d6ac0927a4c462d77135ef32f142d8.tar.bz2
portage-545e96ac48d6ac0927a4c462d77135ef32f142d8.zip
Run chflags only when needed for bug #129852. Thanks to Diego Pettenò for the patch.
svn path=/main/trunk/; revision=3147
-rw-r--r--pym/portage.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/pym/portage.py b/pym/portage.py
index dfb26e288..815f3820d 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -2764,12 +2764,13 @@ def movefile(src,dest,newmtime=None,sstat=None,mysettings=None):
if bsd_chflags:
# Check that we can actually unset schg etc flags...
# Clear the flags on source and destination; we'll reinstate them after merging
- if(destexists):
+ if destexists and sflags != 0:
if bsd_chflags.lchflags(dest, 0) < 0:
writemsg("!!! Couldn't clear flags on file being merged: \n ")
# We might have an immutable flag on the parent dir; save and clear.
pflags=bsd_chflags.lgetflags(os.path.dirname(dest))
- bsd_chflags.lchflags(os.path.dirname(dest), 0)
+ if pflags != 0:
+ bsd_chflags.lchflags(os.path.dirname(dest), 0)
# Don't bother checking the return value here; if it fails then the next line will catch it.
bsd_chflags.lchflags(src, 0)
@@ -2805,7 +2806,8 @@ def movefile(src,dest,newmtime=None,sstat=None,mysettings=None):
lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
if bsd_chflags:
# Restore the flags we saved before moving
- if bsd_chflags.lchflags(dest, sflags) < 0 or bsd_chflags.lchflags(os.path.dirname(dest), pflags) < 0:
+ if (sflags != 0 and bsd_chflags.lchflags(dest, sflags) < 0) or \
+ (pflags and bsd_chflags.lchflags(os.path.dirname(dest), pflags) < 0):
writemsg("!!! Couldn't restore flags ("+str(flags)+") on " + dest+":\n")
writemsg("!!! %s\n" % str(e))
return None
@@ -2887,7 +2889,8 @@ def movefile(src,dest,newmtime=None,sstat=None,mysettings=None):
if bsd_chflags:
# Restore the flags we saved before moving
- if bsd_chflags.lchflags(dest, sflags) < 0 or bsd_chflags.lchflags(os.path.dirname(dest), pflags) < 0:
+ if (sflags != 0 and bsd_chflags.lchflags(dest, sflags) < 0) or \
+ (pflags and bsd_chflags.lchflags(os.path.dirname(dest), pflags) < 0):
writemsg("!!! Couldn't restore flags ("+str(sflags)+") on " + dest+":\n")
return None
@@ -6032,7 +6035,7 @@ class dblink:
if bsd_chflags:
# Save then clear flags on dest.
dflags=bsd_chflags.lgetflags(mydest)
- if(bsd_chflags.lchflags(mydest, 0)<0):
+ if dflags != 0 and bsd_chflags.lchflags(mydest, 0) < 0:
writemsg("!!! Couldn't clear flags on '"+mydest+"'.\n")
if not os.access(mydest, os.W_OK):