From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RCc3h-0004vi-SF for garchives@archives.gentoo.org; Sat, 08 Oct 2011 18:55:42 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 09D1121C254; Sat, 8 Oct 2011 18:54:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id BD58F21C252 for ; Sat, 8 Oct 2011 18:54:09 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 794C41B403B for ; Sat, 8 Oct 2011 18:54:09 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id CCD9B80058 for ; Sat, 8 Oct 2011 18:54:08 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: Subject: [gentoo-commits] proj/elfix:elfix-0.2.x commit in: scripts/ X-VCS-Repository: proj/elfix X-VCS-Files: scripts/revdep-pax X-VCS-Directories: scripts/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: a8b83eba788dc6512aaf103ad271d6990dd21359 Date: Sat, 8 Oct 2011 18:54:08 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 312a27dd429dbecd85ccff3be0d49283 commit: a8b83eba788dc6512aaf103ad271d6990dd21359 Author: Anthony G. Basile gentoo org> AuthorDate: Fri Oct 7 01:56:14 2011 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Sat Oct 8 18:53:27 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/elfix.git;a=3D= commit;h=3Da8b83eba scripts/revdep-pax: use ldd to get mappings rather than NEEDS --- scripts/revdep-pax | 39 +++++++++++++++++++++++++++++++++++---- 1 files changed, 35 insertions(+), 4 deletions(-) diff --git a/scripts/revdep-pax b/scripts/revdep-pax index 4873518..1a5a2bb 100755 --- a/scripts/revdep-pax +++ b/scripts/revdep-pax @@ -5,6 +5,25 @@ import subprocess import re import pax =20 +def get_ldd_linkings(elf): + try: + ldd_output =3D subprocess.check_output(["/usr/bin/ldd", elf]) + except: + return [] + ldd_lines =3D ldd_output.split('\n') + linkings =3D [] + for m in range(0,len(ldd_lines)): + if not re.search('=3D>', ldd_lines[m]): + continue + ldd_lines[m] =3D ldd_lines[m].strip() + mapp =3D re.split('=3D>', ldd_lines[m] ) + soname =3D mapp[0].strip() + filename =3D re.sub('\(.*$', '', mapp[1]).strip() + if filename =3D=3D '': + continue + filename =3D os.path.realpath(filename) + linkings.append(soname) + return linkings =20 def get_forward_linkings(): var_db_pkg =3D '/var/db/pkg' @@ -21,7 +40,8 @@ def get_forward_linkings(): line =3D line.strip() link =3D re.split('\s', line) elf =3D link[0] - linkings =3D re.split(',', link[1]) + linkings =3D get_ldd_linkings(elf) + #linkings =3D re.split(',', link[1]) #this uses NEEDS to determine = linkage forward_linkings[elf] =3D linkings=20 except: break @@ -46,7 +66,7 @@ def get_soname2file_mappings(): ldconfig_output =3D subprocess.check_output(["/sbin/ldconfig", "-p"]) ldconfig_lines =3D ldconfig_output.split('\n') ldconfig_lines.pop(0) #first line is a header - ldconfig_lines.pop() #last line empty because of previous split + ldconfig_lines.pop() #last line empty because of previous split mappings =3D {} for m in range(0,len(ldconfig_lines)): ldconfig_lines[m] =3D ldconfig_lines[m].strip() @@ -65,15 +85,25 @@ soname2file_mappings =3D get_soname2file_mappings() =20 =20 """ Print out mapping: binary -> library, library, library ... """ +unmapped =3D [] for elf in forward_linkings: print elf for elf_dep in forward_linkings[elf]: print "\t", elf_dep - #print "\t\t", soname2file_mappings[elf_dep] + #try: + # print "\t\t", soname2file_mappings[elf_dep] + #except: + # unmapped.append(elf_dep) + # print "%s doesn't have a mapping" % elf_dep =20 raw_input() =20 -""" Print out mapping: library -> binary, binary, binary ... """ +print unmapped + +raw_input() + + +""" Print out mapping: library -> binary, binary, binary ... for elf_dep in reverse_linkings: print elf_dep for elf in reverse_linkings[elf_dep]: @@ -84,3 +114,4 @@ raw_input() =20 for s in soname2file_mappings: print s, soname2file_mappings[s] +"""