Only commit the mtimedb if the internal state has changed.
authorZac Medico <zmedico@gentoo.org>
Thu, 6 Jul 2006 19:54:45 +0000 (19:54 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 6 Jul 2006 19:54:45 +0000 (19:54 -0000)
svn path=/main/trunk/; revision=3807

pym/portage.py

index 72b42dffc704a505e1fdae59d001655630ab7c6d..6061695fa8e1eba7c7c35e9114585e82105d90bf 100644 (file)
@@ -7127,9 +7127,15 @@ class MtimeDB(dict):
                                writemsg("Deleting invalid mtimedb key: %s\n" % str(k))
                                del d[k]
                self.update(d)
+               self._clean_data = d
 
        def commit(self):
-               commit_mtimedb(mydict=self, filename=self.filename)
+               d = {}
+               d.update(self)
+               # Only commit if the internal state has changed.
+               if d != self._clean_data:
+                       commit_mtimedb(mydict=d, filename=self.filename)
+                       self._clean_data = d
 
 def create_trees(config_root="/", target_root="/", trees=None):
        if trees is None: