From 4d9c8b5ca0a7c13066b3e08ed6700cbd0939ec72 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 16 Apr 2013 07:00:45 -0700 Subject: [PATCH] movefile: remove source symlink/hardlink after mv --- pym/portage/util/movefile.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 -- 2.26.2