summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/dbapi/vartree.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 4abc1e126..d992a3292 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -2583,7 +2583,22 @@ class dblink(object):
preserve_paths = set()
for preserve_node in preserve_nodes:
- preserve_paths.update(preserve_node.alt_paths)
+ # 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
+ 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
+ except OSError:
+ continue
+
+ if have_lib:
+ preserve_paths.update(preserve_node.alt_paths)
return preserve_paths