summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-01-12 08:14:24 +0000
committerZac Medico <zmedico@gentoo.org>2009-01-12 08:14:24 +0000
commite9c40b141978327325f3f1e4b16787f937bcfdcd (patch)
tree221e935861f202a7ca479ab6f9db00c960ee5307 /pym
parent639ef7731ecf12edbfbef3871b8a24c34f069a42 (diff)
downloadportage-e9c40b141978327325f3f1e4b16787f937bcfdcd.tar.gz
portage-e9c40b141978327325f3f1e4b16787f937bcfdcd.tar.bz2
portage-e9c40b141978327325f3f1e4b16787f937bcfdcd.zip
Do not hardlink files unless they are in the same
directory, since otherwise tar may not be able to extract a tarball of the resulting hardlinks due to 'Invalid cross-device link' errors (depends on layout of mount points). Also, don't hardlink zero-byte files since it doesn't save any space. Thanks to Daniel Robbins for reporting these issues which were noticed by funtoo users when attempting to extract stage tarballs. (trunk r12381) svn path=/main/branches/2.1.6/; revision=12451
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/dbapi/vartree.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 3d8e9d6cb..921ea7de6 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -2736,12 +2736,21 @@ class dblink(object):
# whether config protection or not, we merge the new file the
# same way. Unless moveme=0 (blocking directory)
if moveme:
- hardlink_key = (mymd5, mystat.st_size,
+ # Do not hardlink files unless they are in the same
+ # directory, since otherwise tar may not be able to
+ # extract a tarball of the resulting hardlinks due to
+ # 'Invalid cross-device link' errors (depends on layout of
+ # mount points). Also, don't hardlink zero-byte files since
+ # it doesn't save any space.
+ parent_dir = os.path.dirname(myrealdest)
+ print "parent_dir", parent_dir
+ hardlink_key = (parent_dir, mymd5, mystat.st_size,
mystat.st_mode, mystat.st_uid, mystat.st_gid)
hardlink_candidates = self._md5_merge_map.get(hardlink_key)
if hardlink_candidates is None:
hardlink_candidates = []
- self._md5_merge_map[hardlink_key] = hardlink_candidates
+ if mystat.st_size != 0:
+ self._md5_merge_map[hardlink_key] = hardlink_candidates
mymtime = movefile(mysrc, mydest, newmtime=thismtime,
sstat=mystat, mysettings=self.settings,
hardlink_candidates=hardlink_candidates)