From: Zac Medico Date: Tue, 16 Apr 2013 14:00:45 +0000 (-0700) Subject: movefile: remove source symlink/hardlink after mv X-Git-Tag: v2.2.0_alpha174~22 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4d9c8b5ca0a7c13066b3e08ed6700cbd0939ec72;p=portage.git movefile: remove source symlink/hardlink after mv --- diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py index 8a7a2b6a6..f33e67c62 100644 --- a/pym/portage/util/movefile.py +++ b/pym/portage/util/movefile.py @@ -224,6 +224,12 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, target != os.readlink(dest): raise lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID]) + + try: + _os.unlink(src_bytes) + except OSError: + pass + if sys.hexversion >= 0x3030000: try: os.utime(dest, ns=(sstat.st_mtime_ns, sstat.st_mtime_ns), follow_symlinks=False) @@ -277,6 +283,10 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, writemsg("!!! %s\n" % (e,), noiselevel=-1) return None hardlinked = True + try: + _os.unlink(src_bytes) + except OSError: + pass break renamefailed=1