Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] preserve-libs: ignore dropped non-soname symlink (bug 692698)
Date: Fri, 23 Aug 2019 20:51:17
Message-Id: 20190823205051.3098-1-zmedico@gentoo.org
1 Fix the dblink _find_libs_to_preserve method to ignore a dropped
2 non-soname symlink. For example, pam-1.3.1-r1 drops the non-soname
3 symlink named libpam_misc.so, and we don't want this to trigger
4 unnecessary preservation of the corresponding library, since the
5 corresponding libpam_misc.so.0 soname symlink and the hardlink
6 that it references are still provided by pam-1.3.1-r1.
7
8 Signed-off-by: Zac Medico <zmedico@g.o>
9 ---
10 lib/portage/dbapi/vartree.py | 13 +++++++++----
11 1 file changed, 9 insertions(+), 4 deletions(-)
12
13 diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py
14 index 4f069474b..53c728066 100644
15 --- a/lib/portage/dbapi/vartree.py
16 +++ b/lib/portage/dbapi/vartree.py
17 @@ -3133,10 +3133,6 @@ class dblink(object):
18 os = portage.os
19
20 f = f_abs[root_len:]
21 - if not unmerge and self.isowner(f):
22 - # We have an indentically named replacement file,
23 - # so we don't try to preserve the old copy.
24 - continue
25 try:
26 consumers = linkmap.findConsumers(f,
27 exclude_providers=(installed_instance.isowner,))
28 @@ -3184,16 +3180,25 @@ class dblink(object):
29 hardlinks = set()
30 soname_symlinks = set()
31 soname = linkmap.getSoname(next(iter(preserve_node.alt_paths)))
32 + have_replacement_soname_link = False
33 + have_replacement_hardlink = False
34 for f in preserve_node.alt_paths:
35 f_abs = os.path.join(root, f.lstrip(os.sep))
36 try:
37 if stat.S_ISREG(os.lstat(f_abs).st_mode):
38 hardlinks.add(f)
39 + if not unmerge and self.isowner(f):
40 + have_replacement_hardlink = True
41 elif os.path.basename(f) == soname:
42 soname_symlinks.add(f)
43 + if not unmerge and self.isowner(f):
44 + have_replacement_soname_link = True
45 except OSError:
46 pass
47
48 + if have_replacement_hardlink and have_replacement_soname_link:
49 + continue
50 +
51 if hardlinks:
52 preserve_paths.update(hardlinks)
53 preserve_paths.update(soname_symlinks)
54 --
55 2.21.0

Replies