summaryrefslogtreecommitdiffstats
path: root/pym/portage/dbapi/vartree.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/portage/dbapi/vartree.py')
-rw-r--r--pym/portage/dbapi/vartree.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 2555657ba..b27f30fe3 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1100,6 +1100,7 @@ class dblink(object):
self.contentscache = None
self._contents_inodes = None
self._contents_basenames = None
+ self._md5_merge_map = {}
def lockdb(self):
if self._lock_vdb:
@@ -2377,6 +2378,7 @@ class dblink(object):
if self.mergeme(srcroot, destroot, outfile, None,
secondhand, cfgfiledict, mymtime):
return 1
+ self._md5_merge_map.clear()
#restore umask
os.umask(prevmask)
@@ -2734,9 +2736,17 @@ class dblink(object):
# whether config protection or not, we merge the new file the
# same way. Unless moveme=0 (blocking directory)
if moveme:
- mymtime = movefile(mysrc, mydest, newmtime=thismtime, sstat=mystat, mysettings=self.settings)
+ hardlink_key = (mymd5, mystat.st_size)
+ hardlink_candidates = self._md5_merge_map.get(hardlink_key)
+ if hardlink_candidates is None:
+ hardlink_candidates = []
+ self._md5_merge_map[hardlink_key] = hardlink_candidates
+ mymtime = movefile(mysrc, mydest, newmtime=thismtime,
+ sstat=mystat, mysettings=self.settings,
+ hardlink_candidates=hardlink_candidates)
if mymtime is None:
return 1
+ hardlink_candidates.append(mydest)
zing = ">>>"
if mymtime != None: