Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/
Date: Fri, 01 Jul 2011 04:03:07
Message-Id: a30cc13e70baad6abf41224afadf4a91dd3eb828.zmedico@gentoo
1 commit: a30cc13e70baad6abf41224afadf4a91dd3eb828
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 1 04:00:52 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 1 04:00:52 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a30cc13e
7
8 preserve-libs: only preserve soname symlinks
9
10 This avoids calling the LinkageMapELF.isMasterLink() method, since the
11 only symlinks that are strictly required are the soname symlinks.
12
13 ---
14 pym/portage/dbapi/vartree.py | 26 +++++++++++++-------------
15 1 files changed, 13 insertions(+), 13 deletions(-)
16
17 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
18 index b3e6f6a..5a86291 100644
19 --- a/pym/portage/dbapi/vartree.py
20 +++ b/pym/portage/dbapi/vartree.py
21 @@ -2461,25 +2461,25 @@ class dblink(object):
22
23 preserve_paths = set()
24 for preserve_node in preserve_nodes:
25 - # Make sure that at least one of the paths is not a symlink.
26 - # This prevents symlinks from being erroneously preserved by
27 - # themselves when the old instance installed symlinks that
28 - # the new instance does not install.
29 - have_lib = False
30 + # Preserve the library itself, and also preserve the
31 + # soname symlink which is the only symlink that is
32 + # strictly required.
33 + hardlinks = set()
34 + soname_symlinks = set()
35 + soname = linkmap.getSoname(next(iter(preserve_node.alt_paths)))
36 for f in preserve_node.alt_paths:
37 f_abs = os.path.join(root, f.lstrip(os.sep))
38 try:
39 if stat.S_ISREG(os.lstat(f_abs).st_mode):
40 - have_lib = True
41 - break
42 + hardlinks.add(f)
43 + elif os.path.basename(f) == soname:
44 + soname_symlinks.add(f)
45 except OSError:
46 - continue
47 + pass
48
49 - if have_lib:
50 - # There's no point in preserving the "master" symlink, since
51 - # the soname symlink is all that's strictly required.
52 - preserve_paths.update(f for f in preserve_node.alt_paths
53 - if not linkmap.isMasterLink(f))
54 + if hardlinks:
55 + preserve_paths.update(hardlinks)
56 + preserve_paths.update(soname_symlinks)
57
58 return preserve_paths