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 v2] preserve-libs: ignore dropped non-soname symlink (bug 692698)
Date: Sat, 24 Aug 2019 01:17:24
Message-Id: 20190824011701.16740-1-zmedico@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] preserve-libs: ignore dropped non-soname symlink (bug 692698) by Zac Medico
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 Bug: https://bugs.gentoo.org/692698
9 Signed-off-by: Zac Medico <zmedico@g.o>
10 ---
11 [PATCH v2] Prevent preservation of libnspr4.so hardlink reported
12 by Arfrever for dev-libs/nspr-4.21 to dev-libs/nspr-4.22 upgrade.
13
14 lib/portage/dbapi/vartree.py | 15 +++++++++++----
15 1 file changed, 11 insertions(+), 4 deletions(-)
16
17 diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py
18 index 4f069474b..fa1e1523c 100644
19 --- a/lib/portage/dbapi/vartree.py
20 +++ b/lib/portage/dbapi/vartree.py
21 @@ -3133,10 +3133,6 @@ class dblink(object):
22 os = portage.os
23
24 f = f_abs[root_len:]
25 - if not unmerge and self.isowner(f):
26 - # We have an indentically named replacement file,
27 - # so we don't try to preserve the old copy.
28 - continue
29 try:
30 consumers = linkmap.findConsumers(f,
31 exclude_providers=(installed_instance.isowner,))
32 @@ -3184,16 +3180,27 @@ class dblink(object):
33 hardlinks = set()
34 soname_symlinks = set()
35 soname = linkmap.getSoname(next(iter(preserve_node.alt_paths)))
36 + have_replacement_soname_link = False
37 + have_replacement_hardlink = False
38 for f in preserve_node.alt_paths:
39 f_abs = os.path.join(root, f.lstrip(os.sep))
40 try:
41 if stat.S_ISREG(os.lstat(f_abs).st_mode):
42 hardlinks.add(f)
43 + if not unmerge and self.isowner(f):
44 + have_replacement_hardlink = True
45 + if os.path.basename(f) == soname:
46 + have_replacement_soname_link = True
47 elif os.path.basename(f) == soname:
48 soname_symlinks.add(f)
49 + if not unmerge and self.isowner(f):
50 + have_replacement_soname_link = True
51 except OSError:
52 pass
53
54 + if have_replacement_hardlink and have_replacement_soname_link:
55 + continue
56 +
57 if hardlinks:
58 preserve_paths.update(hardlinks)
59 preserve_paths.update(soname_symlinks)
60 --
61 2.21.0