ported LinkageMap fix from -r14820 to LinkageMapMachO and LinkageMapXCOFF. LinkageMa...
authorFabian Groffen <grobian@gentoo.org>
Thu, 19 Nov 2009 20:18:09 +0000 (20:18 -0000)
committerFabian Groffen <grobian@gentoo.org>
Thu, 19 Nov 2009 20:18:09 +0000 (20:18 -0000)
svn path=/main/branches/prefix/; revision=14849

pym/portage/dbapi/vartree.py

index c305f9c8092eeecbffecdd116695e5ce4c4abb92..9120a0cb623d52f5086d68bb67886ebcb5778c1e 100644 (file)
@@ -938,9 +938,11 @@ class LinkageMapMachO(object):
 
                # have to call scanmacho for preserved libs here as they aren't 
                # registered in NEEDED.MACHO.3 files
+               plibs = set()
                if self._dbapi.plib_registry and self._dbapi.plib_registry.getPreservedLibs():
                        args = [EPREFIX+"/usr/bin/scanmacho", "-qF", "%a;%F;%S;%n"]
                        for items in self._dbapi.plib_registry.getPreservedLibs().values():
+                               plibs.update(items)
                                args.extend(os.path.join(root, x.lstrip("." + os.sep)) \
                                                for x in items)
                        try:
@@ -963,9 +965,20 @@ class LinkageMapMachO(object):
                                                        level=logging.ERROR, noiselevel=-1)
                                                continue
                                        fields[1] = fields[1][root_len:]
+                                       plibs.discard(fields[1])
                                        lines.append(";".join(fields))
                                proc.wait()
 
+               if plibs:
+                       # Preserved libraries that did not appear in the scanmacho
+                       # output.  This is known to happen with statically linked
+                       # libraries.  Generate dummy lines for these, so we can
+                       # assume that every preserved library has an entry in
+                       # self._obj_properties.  This is important in order to
+                       # prevent findConsumers from raising an unwanted KeyError.
+                       for x in plibs:
+                               lines.append(";".join(['', x, '', '']))
+
                for l in lines:
                        l = l.rstrip("\n")
                        if not l:
@@ -1601,8 +1614,10 @@ class LinkageMapXCoff(LinkageMap):
 
                # have to call scanelf for preserved libs here as they aren't 
                # registered in NEEDED.XCOFF.1 files
+               plibs = set()
                if self._dbapi.plib_registry and self._dbapi.plib_registry.getPreservedLibs():
                        for items in self._dbapi.plib_registry.getPreservedLibs().values():
+                               plibs.update(items)
                                for x in items:
                                        args = [BASH_BINARY, "-c", ':'
                                                + '; member="' + x + '"'
@@ -1653,9 +1668,21 @@ class LinkageMapXCoff(LinkageMap):
                                                                        level=logging.ERROR, noiselevel=-1)
                                                                continue
                                                        fields[1] = fields[1][root_len:]
+                                                       plibs.discard(fields[1])
                                                        lines.append(";".join(fields))
                                                proc.wait()
 
+               if plibs:
+                       # Preserved libraries that did not appear in the bash
+                       # aixdll-query code output.  This is known to happen with
+                       # statically linked libraries.  Generate dummy lines for
+                       # these, so we can assume that every preserved library has
+                       # an entry in self._obj_properties.  This is important in
+                       # order to prevent findConsumers from raising an unwanted
+                       # KeyError.
+                       for x in plibs:
+                               lines.append(";".join(['', x, '', '', '']))
+
                for l in lines:
                        l = l.rstrip("\n")
                        if not l: