Merged from trunk -r12248:12253
authorFabian Groffen <grobian@gentoo.org>
Tue, 16 Dec 2008 18:31:32 +0000 (18:31 -0000)
committerFabian Groffen <grobian@gentoo.org>
Tue, 16 Dec 2008 18:31:32 +0000 (18:31 -0000)
   | 12251   | Bug #250902 - Inside dblink._find_libs_to_preserve(),        |
   | zmedico | prevent symlinks from being erroneously preserved by         |
   |         | themselves when the old instance installed symlinks that the |
   |         | new instance does not install.                               |

   | 12252   | Bug #250902 - Inside dblink._find_unused_preserved_libs(),   |
   | zmedico | show a warning instead of raising a KeyError if the          |
   |         | preserved libs registry contains a symlink that points to a  |
   |         | lib which is not preserved.                                  |

   | 12253   | Inside display_preserved_libs(), filter out any consumers    |
   | zmedico | that belong to the same package as the provider.             |

svn path=/main/branches/prefix/; revision=12256

pym/_emerge/__init__.py
pym/portage/dbapi/vartree.py

index 815643d0a244a4847f5bf25eb30d9dcab0aa2aa8..718c68aa238ce807ad58d685d8e597c86b4346d7 100644 (file)
@@ -11542,10 +11542,16 @@ def display_preserved_libs(vardbapi):
                else:
                        search_for_owners = set()
                        for cpv in plibdata:
+                               pkg_dblink = vardbapi._dblink(cpv)
                                for f in plibdata[cpv]:
                                        if f in consumer_map:
                                                continue
-                                       consumers = list(linkmap.findConsumers(f))
+                                       consumers = []
+                                       for c in linkmap.findConsumers(f):
+                                               # Filter out any consumers that belong
+                                               # to the same package as the provider.
+                                               if not pkg_dblink.isowner(c, pkg_dblink.myroot):
+                                                       consumers.append(c)
                                        consumers.sort()
                                        consumer_map[f] = consumers
                                        search_for_owners.update(consumers[:MAX_DISPLAY+1])
index 715e4a75dfb266e23ed96c88cbe356e0b0fdeeba..5dccef3cf4de26445cc62dd9cbb7a6f16aa7b6c0 100644 (file)
@@ -3112,7 +3112,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
 
@@ -3251,7 +3266,14 @@ class dblink(object):
                                unlink_list.update(node.alt_paths)
                        unlink_list = sorted(unlink_list)
                        for obj in unlink_list:
-                               cpv = path_cpv_map[obj]
+                               cpv = path_cpv_map.get(obj)
+                               if cpv is None:
+                                       # This means that a symlink is in the preserved libs
+                                       # registry, but the actual lib it points to is not.
+                                       self._display_merge("!!! symlink to lib is preserved, " + \
+                                               "but not the lib itself:\n!!! '%s'\n" % (obj,),
+                                               level=logging.ERROR, noiselevel=-1)
+                                       continue
                                removed = cpv_lib_map.get(cpv)
                                if removed is None:
                                        removed = set()