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 1RBtuJ-0002oU-Q4 for garchives@archives.gentoo.org; Thu, 06 Oct 2011 19:47:04 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7789F21C271; Thu, 6 Oct 2011 19:46:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3845521C271 for ; Thu, 6 Oct 2011 19:46:31 +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 A62881B4041 for ; Thu, 6 Oct 2011 19:46:30 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 0560680042 for ; Thu, 6 Oct 2011 19:46:30 +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: <406e2dc4ad36b188872149359a5f65dd4cd79fe8.blueness@gentoo> Subject: [gentoo-commits] proj/elfix:master 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: 406e2dc4ad36b188872149359a5f65dd4cd79fe8 Date: Thu, 6 Oct 2011 19:46:30 +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: 21ec9b1490c8eeebbe68aae10960e2e9 commit: 406e2dc4ad36b188872149359a5f65dd4cd79fe8 Author: Anthony G. Basile gentoo org> AuthorDate: Thu Oct 6 19:46:25 2011 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Thu Oct 6 19:46:25 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/elfix.git;a=3D= commit;h=3D406e2dc4 scripts/revdep-pax: organize into functions --- scripts/revdep-pax | 89 ++++++++++++++++++++++++++++------------------= ------ 1 files changed, 48 insertions(+), 41 deletions(-) diff --git a/scripts/revdep-pax b/scripts/revdep-pax index ac21bae..df78e35 100755 --- a/scripts/revdep-pax +++ b/scripts/revdep-pax @@ -1,56 +1,63 @@ #!/usr/bin/env python =20 from os import listdir -#from os import path +#from os import listdir, path import re =20 import pax =20 -var_db_pkg =3D '/var/db/pkg' - -binaries =3D {} -for cat in listdir(var_db_pkg): - catdir =3D '%s/%s' % (var_db_pkg, cat) - for pkg in listdir(catdir): - pkgdir =3D '%s/%s' % (catdir, pkg) - need =3D '%s/%s' % (pkgdir, 'NEEDED') - try: - g =3D open(need, 'r') - needs =3D g.readlines() - for line in needs: - line =3D line.strip() - linking =3D re.split('\s', line) - binary =3D linking[0] - print binary - library_list =3D re.split(',', linking[1]) - print "\t%s" % library_list - binaries[binary] =3D library_list - except: - break =20 -""" Print out mapping: binary -> library, library, library ... -for binary in binaries: - print binary - for library in binaries[binary]: - print "\t", library -""" +def forward_linkings(): + var_db_pkg =3D '/var/db/pkg' + elf_objects =3D {} + for cat in listdir(var_db_pkg): + catdir =3D '%s/%s' % (var_db_pkg, cat) + for pkg in listdir(catdir): + pkgdir =3D '%s/%s' % (catdir, pkg) + need =3D '%s/%s' % (pkgdir, 'NEEDED') + try: + g =3D open(need, 'r') + needs =3D g.readlines() + for line in needs: + line =3D line.strip() + linking =3D re.split('\s', line) + elf =3D linking[0] + elf_deps =3D re.split(',', linking[1]) + elf_objects[elf] =3D elf_deps=20 + except: + break + + return elf_objects=20 + + +def reverse_linkings( binaries ): + libraries =3D {} + for binary in binaries: + for library in binaries[binary]: + libraries[library] =3D [] + + for binary in binaries: + for library in binaries[binary]: + libraries[library].append(binary) =20 -libraries =3D {} -for binary in binaries: - for library in binaries[binary]: - libraries[library] =3D [] + return libraries =20 -for binary in binaries: - for library in binaries[binary]: - libraries[library].append(binary) + +elf_objects =3D forward_linkings() +elf_deps =3D reverse_linkings( elf_objects ) + +""" Print out mapping: binary -> library, library, library ... +for elf in elf_objects: + print elf + for elf_deps in elf_objects[elf]: + print "\t", elf_deps +""" =20 """ Print out mapping: library -> binary, binary, binary ... -for library in libraries: - print library - for binary in libraries[library]: - print "\t", binary +for elf in elf_deps: + print elf + for elf_object in elf_deps[elf]: + print "\t", elf_object #if not path.exists(binary): # print "%s doesn't exist!" % binary """ - -