From 290990af18d2c56c26bb4b33f24e641948879522 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 28 Oct 2011 22:35:01 -0700 Subject: quickpkg: fix regression in hardlink support Hardlink support has been broken since commit 4198da0184aaec30c41f2e5d2c7af71c4d35b662, which omitted the hardlink logic from TarFile.gettarinfo(). --- pym/portage/dbapi/vartree.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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): -- cgit v1.2.3-1-g7c22