From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (unknown [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 9D8B21381FA for ; Tue, 27 May 2014 23:44:17 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 29D75E08DA; Tue, 27 May 2014 23:44:17 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B193BE08DA for ; Tue, 27 May 2014 23:44:16 +0000 (UTC) Received: from spoonbill.gentoo.org (unknown [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A94E533BDEB for ; Tue, 27 May 2014 23:44:15 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 425C2181A9 for ; Tue, 27 May 2014 23:44:14 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <1401234385.8209b9955e06f2238c7c4d2732652e7fb0f3c977.blueness@gentoo> Subject: [gentoo-commits] proj/elfix:master commit in: misc/ldd/ X-VCS-Repository: proj/elfix X-VCS-Files: misc/ldd/ldd.py X-VCS-Directories: misc/ldd/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: 8209b9955e06f2238c7c4d2732652e7fb0f3c977 X-VCS-Branch: master Date: Tue, 27 May 2014 23:44:14 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 3d1851a4-4a85-43b2-b3e5-3be979149704 X-Archives-Hash: 679f95367c77def4125c07c0e6ac5f52 commit: 8209b9955e06f2238c7c4d2732652e7fb0f3c977 Author: Anthony G. Basile gentoo org> AuthorDate: Tue May 27 23:46:25 2014 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Tue May 27 23:46:25 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=8209b995 misc/ldd: correct logic for ldpaths() --- misc/ldd/ldd.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/misc/ldd/ldd.py b/misc/ldd/ldd.py index 4d6f500..c1bcc19 100755 --- a/misc/ldd/ldd.py +++ b/misc/ldd/ldd.py @@ -53,15 +53,17 @@ def ldpaths(ld_so_conf='/etc/ld.so.conf'): paths = [] include_globs = [] - for l in lines: - if l == '': + for i in range(0,len(lines)): + if lines[i] == '': continue - if l == 'include': - f = lines[lines.index(l) + 1] + if lines[i] == 'include': + f = lines[i + 1] include_globs.append(f) continue - if l not in include_globs: - paths.append(os.path.realpath(l)) + if lines[i] not in include_globs: + real_path = os.path.realpath(lines[i]) + if os.path.exists(real_path): + paths.append(real_path) include_files = [] for g in include_globs: @@ -69,13 +71,17 @@ def ldpaths(ld_so_conf='/etc/ld.so.conf'): for c in include_files: paths = paths + ldpaths(os.path.realpath(c)) - return list(set(paths)) + paths = list(set(paths)) + paths.sort() + return paths def dynamic_dt_needed_paths( dt_needed, eclass, paths): for n in dt_needed: for p in paths: - print('%s' % p + '/' + n) + lib = p + os.sep + n + if os.path.exists(lib): + print('%s' % lib) return SCRIPT_DESCRIPTION = 'Print shared library dependencies' @@ -98,8 +104,6 @@ def main(): sys.exit(0) paths = ldpaths() - print(paths) - sys.exit(0) for f in args: with open(f, 'rb') as file: