Fix logic from previous commit so it only applies when a 'newmtime' parameter
authorZac Medico <zmedico@gentoo.org>
Fri, 27 Nov 2009 22:38:16 +0000 (22:38 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 27 Nov 2009 22:38:16 +0000 (22:38 -0000)
has not been specified (this is always the case when called by portage).
(trunk r14898)

svn path=/main/branches/2.1.7/; revision=14903

pym/portage/__init__.py

index e2285499697ba9232f384376a058308dd85fc726..e314654f46c4ed129698b2567483fa612f7e2bb8 100644 (file)
@@ -7565,13 +7565,15 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
        try:
                if hardlinked:
                        newmtime = long(os.stat(dest).st_mtime)
-               elif not renamefailed:
-                       newmtime = long(sstat.st_mtime)
                else:
                        if newmtime is not None:
                                os.utime(dest, (newmtime, newmtime))
                        else:
-                               os.utime(dest, (sstat.st_atime, sstat.st_mtime))
+                               if renamefailed:
+                                       # If rename succeeded then this is not necessary, since
+                                       # rename automatically preserves timestamps with complete
+                                       # precision.
+                                       os.utime(dest, (sstat.st_atime, sstat.st_mtime))
                                newmtime = long(sstat.st_mtime)
        except OSError:
                # The utime can fail here with EPERM even though the move succeeded.