From: Zac Medico Date: Fri, 1 Jul 2011 04:00:52 +0000 (-0700) Subject: preserve-libs: only preserve soname symlinks X-Git-Tag: v2.2.0_alpha42 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a30cc13e70baad6abf41224afadf4a91dd3eb828;p=portage.git preserve-libs: only preserve soname symlinks This avoids calling the LinkageMapELF.isMasterLink() method, since the only symlinks that are strictly required are the soname symlinks. --- diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index b3e6f6a62..5a86291f8 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -2461,25 +2461,25 @@ class dblink(object): preserve_paths = set() for preserve_node in preserve_nodes: - # Make sure that at least one of the paths is not a symlink. - # This prevents symlinks from being erroneously preserved by - # themselves when the old instance installed symlinks that - # the new instance does not install. - have_lib = False + # Preserve the library itself, and also preserve the + # soname symlink which is the only symlink that is + # strictly required. + hardlinks = set() + soname_symlinks = set() + soname = linkmap.getSoname(next(iter(preserve_node.alt_paths))) for f in preserve_node.alt_paths: f_abs = os.path.join(root, f.lstrip(os.sep)) try: if stat.S_ISREG(os.lstat(f_abs).st_mode): - have_lib = True - break + hardlinks.add(f) + elif os.path.basename(f) == soname: + soname_symlinks.add(f) except OSError: - continue + pass - if have_lib: - # There's no point in preserving the "master" symlink, since - # the soname symlink is all that's strictly required. - preserve_paths.update(f for f in preserve_node.alt_paths - if not linkmap.isMasterLink(f)) + if hardlinks: + preserve_paths.update(hardlinks) + preserve_paths.update(soname_symlinks) return preserve_paths