From: Zac Medico Date: Sat, 29 Oct 2011 05:35:01 +0000 (-0700) Subject: quickpkg: fix regression in hardlink support X-Git-Tag: v2.2.0_alpha72~24 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=290990af18d2c56c26bb4b33f24e641948879522;p=portage.git quickpkg: fix regression in hardlink support Hardlink support has been broken since commit 4198da0184aaec30c41f2e5d2c7af71c4d35b662, which omitted the hardlink logic from TarFile.gettarinfo(). --- diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index ee0db6f24..73772b0e0 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -4560,11 +4560,20 @@ def tar_contents(contents, root, tar, protect=None, onProgress=None): tarinfo.mode = lst.st_mode tarinfo.uid = lst.st_uid tarinfo.gid = lst.st_gid - tarinfo.size = lst.st_size + tarinfo.size = 0 tarinfo.mtime = lst.st_mtime tarinfo.linkname = "" if stat.S_ISREG(lst.st_mode): - tarinfo.type = tarfile.REGTYPE + inode = (lst.st_ino, lst.st_dev) + if (lst.st_nlink > 1 and + inode in tar.inodes and + arcname != tar.inodes[inode]): + tarinfo.type = tarfile.LNKTYPE + tarinfo.linkname = tar.inodes[inode] + else: + tar.inodes[inode] = arcname + tarinfo.type = tarfile.REGTYPE + tarinfo.size = lst.st_size elif stat.S_ISDIR(lst.st_mode): tarinfo.type = tarfile.DIRTYPE elif stat.S_ISLNK(lst.st_mode):