summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/package/ebuild/doebuild.py39
-rw-r--r--pym/portage/util/__init__.py7
-rw-r--r--pym/portage/util/_dyn_libs/LinkageMapELF.py2
3 files changed, 44 insertions, 4 deletions
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 35a0b0ffa..4b4eaecad 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -1646,6 +1646,43 @@ def _post_src_install_soname_symlinks(mysettings, out):
raise
return
+ libpaths = set(portage.util.getlibpaths(
+ mysettings["ROOT"], env=mysettings))
+ libpath_inodes = set()
+ for libpath in libpaths:
+ libdir = os.path.join(mysettings["ROOT"], libpath.lstrip(os.sep))
+ try:
+ s = os.stat(libdir)
+ except OSError:
+ continue
+ else:
+ libpath_inodes.add((s.st_dev, s.st_ino))
+
+ is_libdir_cache = {}
+
+ def is_libdir(obj_parent):
+ try:
+ return is_libdir_cache[obj_parent]
+ except KeyError:
+ pass
+
+ rval = False
+ if obj_parent in libpaths:
+ rval = True
+ else:
+ parent_path = os.path.join(mysettings["ROOT"],
+ obj_parent.lstrip(os.sep))
+ try:
+ s = os.stat(parent_path)
+ except OSError:
+ pass
+ else:
+ if (s.st_dev, s.st_ino) in libpath_inodes:
+ rval = True
+
+ is_libdir_cache[obj_parent] = rval
+ return rval
+
missing_symlinks = []
# Parse NEEDED.ELF.2 like LinkageMapELF.rebuild() does.
@@ -1663,6 +1700,8 @@ def _post_src_install_soname_symlinks(mysettings, out):
obj, soname = fields[1:3]
if not soname:
continue
+ if not is_libdir(os.path.dirname(obj)):
+ continue
obj_file_path = os.path.join(image_dir, obj.lstrip(os.sep))
sym_file_path = os.path.join(os.path.dirname(obj_file_path), soname)
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 31a808b0c..f877362cd 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -1567,11 +1567,12 @@ def find_updated_config_files(target_root, config_protect):
else:
yield (x, None)
-def getlibpaths(root):
+def getlibpaths(root, env=None):
""" Return a list of paths that are used for library lookups """
-
+ if env is None:
+ env = os.environ
# the following is based on the information from ld.so(8)
- rval = os.environ.get("LD_LIBRARY_PATH", "").split(":")
+ rval = env.get("LD_LIBRARY_PATH", "").split(":")
rval.extend(grabfile(os.path.join(root, "etc", "ld.so.conf")))
rval.append("/usr/lib")
rval.append("/lib")
diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py
index fef75b62c..4b23421bb 100644
--- a/pym/portage/util/_dyn_libs/LinkageMapELF.py
+++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py
@@ -175,7 +175,7 @@ class LinkageMapELF(object):
root = self._root
root_len = len(root) - 1
self._clear_cache()
- self._defpath.update(getlibpaths(self._root))
+ self._defpath.update(getlibpaths(self._root, env=self._dbapi.settings))
libs = self._libs
obj_properties = self._obj_properties