summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-12-14 20:21:32 +0000
committerZac Medico <zmedico@gentoo.org>2008-12-14 20:21:32 +0000
commit11cdf03af901801600ca50edcbe4de5eb6bbc560 (patch)
tree77fb1909183ad7abd92c0fddd81d39075bab474d
parent50ecfe0c811bc94431d35a5c09ac725b0b0de07e (diff)
downloadportage-11cdf03af901801600ca50edcbe4de5eb6bbc560.tar.gz
portage-11cdf03af901801600ca50edcbe4de5eb6bbc560.tar.bz2
portage-11cdf03af901801600ca50edcbe4de5eb6bbc560.zip
Bug #250902 - Inside dblink._find_libs_to_preserve(), prevent symlinks from
being erroneously preserved by themselves when the old instance installed symlinks that the new instance does not install. svn path=/main/trunk/; revision=12251
-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