From bce4fd1520fed9f35c8004f98ef3ed489efaa5db Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 3 Jan 2012 22:28:47 +0100 Subject: [PATCH] Support include directives in ld.so.conf. --- pym/portage/util/__init__.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py index 54e683985..db8eb94b1 100644 --- a/pym/portage/util/__init__.py +++ b/pym/portage/util/__init__.py @@ -25,6 +25,7 @@ import stat import string import sys import traceback +import glob import portage portage.proxy.lazyimport.lazyimport(globals(), @@ -1596,12 +1597,22 @@ def find_updated_config_files(target_root, config_protect): yield (x, None) def getlibpaths(root, env=None): + def read_ld_so_conf(path): + for l in grabfile(path): + if l.startswith('include '): + subpath = os.path.join(os.path.dirname(path), l[8:].strip()) + for p in glob.glob(subpath): + for r in read_ld_so_conf(p): + yield r + else: + yield l + """ 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 = env.get("LD_LIBRARY_PATH", "").split(":") - rval.extend(grabfile(os.path.join(root, "etc", "ld.so.conf"))) + rval.extend(read_ld_so_conf(os.path.join(root, "etc", "ld.so.conf"))) rval.append("/usr/lib") rval.append("/lib") -- 2.26.2