Bug #332967 - In bintree.inject(), add a sanity check to make sure we
authorZac Medico <zmedico@gentoo.org>
Mon, 16 Aug 2010 10:02:34 +0000 (03:02 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 16 Aug 2010 10:02:34 +0000 (03:02 -0700)
don't try to call movefile on a package that's already in the correct
location.

pym/portage/dbapi/bintree.py

index d84031681b0646882578e1396ca0a1cb044a513c..2863b5c5359e6548c872f22872f7b25a9327d745 100644 (file)
@@ -945,8 +945,9 @@ class binarytree(object):
                                wantnewlockfile=1)
                        if filename is not None:
                                new_filename = self.getname(cpv)
-                               self._ensure_dir(os.path.dirname(new_filename))
-                               _movefile(filename, new_filename, mysettings=self.settings)
+                               if not os.path.samefile(filename, new_filename):
+                                       self._ensure_dir(os.path.dirname(new_filename))
+                                       _movefile(filename, new_filename, mysettings=self.settings)
                        if self._all_directory and \
                                self.getname(cpv).split(os.path.sep)[-2] == "All":
                                self._create_symlink(cpv)