preserve-libs: ignore dropped non-soname symlink (bug 692698)
Fix the dblink _find_libs_to_preserve method to ignore a dropped
non-soname symlink. For example, pam-1.3.1-r1 drops the non-soname
symlink named libpam_misc.so, and we don't want this to trigger
unnecessary preservation of the corresponding library, since the
corresponding libpam_misc.so.0 soname symlink and the hardlink
that it references are still provided by pam-1.3.1-r1.
Bug: https://bugs.gentoo.org/692698
Signed-off-by: Zac Medico <zmedico@gentoo.org>
diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py
index 4f06947..fa1e152 100644
--- a/lib/portage/dbapi/vartree.py
+++ b/lib/portage/dbapi/vartree.py
@@ -3133,10 +3133,6 @@
os = portage.os
f = f_abs[root_len:]
- if not unmerge and self.isowner(f):
- # We have an indentically named replacement file,
- # so we don't try to preserve the old copy.
- continue
try:
consumers = linkmap.findConsumers(f,
exclude_providers=(installed_instance.isowner,))
@@ -3184,16 +3180,27 @@
hardlinks = set()
soname_symlinks = set()
soname = linkmap.getSoname(next(iter(preserve_node.alt_paths)))
+ have_replacement_soname_link = False
+ have_replacement_hardlink = False
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):
hardlinks.add(f)
+ if not unmerge and self.isowner(f):
+ have_replacement_hardlink = True
+ if os.path.basename(f) == soname:
+ have_replacement_soname_link = True
elif os.path.basename(f) == soname:
soname_symlinks.add(f)
+ if not unmerge and self.isowner(f):
+ have_replacement_soname_link = True
except OSError:
pass
+ if have_replacement_hardlink and have_replacement_soname_link:
+ continue
+
if hardlinks:
preserve_paths.update(hardlinks)
preserve_paths.update(soname_symlinks)