Recent Linux distributions ship with a drop-in directory for the dynamic loader configuration. This patch makes library() check for include statements. If a include statetement is found, all files that match will be read for additional library paths.
Signed-off-by: Cleber Rosa <[email protected]> --- client/bin/os_dep.py | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/client/bin/os_dep.py b/client/bin/os_dep.py index 3f95a98..cf8eaf5 100644 --- a/client/bin/os_dep.py +++ b/client/bin/os_dep.py @@ -1,4 +1,5 @@ import os +import glob """ One day, when this module grows up, it might actually try to fix things. @@ -22,8 +23,27 @@ def commands(*cmds): def library(lib): - lddirs = [x.rstrip() for x in open('/etc/ld.so.conf', 'r').readlines()] - for dir in ['/lib', '/usr/lib'] + lddirs: + lddirs = [] + # read lddirs from main ld.so.conf file + for line in open('/etc/ld.so.conf', 'r').readlines(): + if line.startswith('include '): + glob_pattern = line.split('include ')[1] + if not os.path.isabs(glob_pattern): + # prepend with a base path of '/etc' + glob_pattern = os.path.join('/etc', glob_pattern) + glob_result = glob.glob(glob_pattern) + for conf_file in glob_result: + for conf_file_line in open(conf_file, 'r').readlines(): + if os.path.isdir(conf_file_line): + lddirs.append(conf_file_line) + else: + if os.path.isdir(line): + lddirs.append(line.strip()) + + lddirs = set(lddirs) + lddirs = list(lddirs) + + for dir in ['/lib', '/usr/lib', '/lib64', '/usr/lib64'] + lddirs: file = os.path.join(dir, lib) if os.path.exists(file): return file -- 1.7.4.4 _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
