1 |
commit: 290990af18d2c56c26bb4b33f24e641948879522 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Oct 29 05:35:01 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Oct 29 05:35:01 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=290990af |
7 |
|
8 |
quickpkg: fix regression in hardlink support |
9 |
|
10 |
Hardlink support has been broken since commit |
11 |
4198da0184aaec30c41f2e5d2c7af71c4d35b662, which omitted the hardlink |
12 |
logic from TarFile.gettarinfo(). |
13 |
|
14 |
--- |
15 |
pym/portage/dbapi/vartree.py | 13 +++++++++++-- |
16 |
1 files changed, 11 insertions(+), 2 deletions(-) |
17 |
|
18 |
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py |
19 |
index ee0db6f..73772b0 100644 |
20 |
--- a/pym/portage/dbapi/vartree.py |
21 |
+++ b/pym/portage/dbapi/vartree.py |
22 |
@@ -4560,11 +4560,20 @@ def tar_contents(contents, root, tar, protect=None, onProgress=None): |
23 |
tarinfo.mode = lst.st_mode |
24 |
tarinfo.uid = lst.st_uid |
25 |
tarinfo.gid = lst.st_gid |
26 |
- tarinfo.size = lst.st_size |
27 |
+ tarinfo.size = 0 |
28 |
tarinfo.mtime = lst.st_mtime |
29 |
tarinfo.linkname = "" |
30 |
if stat.S_ISREG(lst.st_mode): |
31 |
- tarinfo.type = tarfile.REGTYPE |
32 |
+ inode = (lst.st_ino, lst.st_dev) |
33 |
+ if (lst.st_nlink > 1 and |
34 |
+ inode in tar.inodes and |
35 |
+ arcname != tar.inodes[inode]): |
36 |
+ tarinfo.type = tarfile.LNKTYPE |
37 |
+ tarinfo.linkname = tar.inodes[inode] |
38 |
+ else: |
39 |
+ tar.inodes[inode] = arcname |
40 |
+ tarinfo.type = tarfile.REGTYPE |
41 |
+ tarinfo.size = lst.st_size |
42 |
elif stat.S_ISDIR(lst.st_mode): |
43 |
tarinfo.type = tarfile.DIRTYPE |
44 |
elif stat.S_ISLNK(lst.st_mode): |