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 1RCIgq-0006bt-Ao for garchives@archives.gentoo.org; Fri, 07 Oct 2011 22:14:48 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5E1DC21C104; Fri, 7 Oct 2011 22:14:41 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1C9FB21C104 for ; Fri, 7 Oct 2011 22:14:41 +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 A56591B401A for ; Fri, 7 Oct 2011 22:14:40 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id EFB3780042 for ; Fri, 7 Oct 2011 22:14:39 +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: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: ae012c0b97d99d8d0abdfabbea4931c1616b8519 Date: Fri, 7 Oct 2011 22:14:39 +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: 839efa38a8d193d2931f6074b3b61a1f commit: ae012c0b97d99d8d0abdfabbea4931c1616b8519 Author: Anthony G. Basile gentoo org> AuthorDate: Fri Oct 7 22:14:35 2011 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Fri Oct 7 22:14:35 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/elfix.git;a=3D= commit;h=3Dae012c0b scripts/revdep-pax: added main() and command line opts --- scripts/revdep-pax | 60 +++++++++++++++++++++++++++++++++++++++++++++-= ------ 1 files changed, 52 insertions(+), 8 deletions(-) diff --git a/scripts/revdep-pax b/scripts/revdep-pax index 48b11d4..6a28a72 100755 --- a/scripts/revdep-pax +++ b/scripts/revdep-pax @@ -1,5 +1,7 @@ #!/usr/bin/env python =20 +import sys +import getopt import os import subprocess import re @@ -31,7 +33,7 @@ def get_ldd_linkings(elf): =20 =20 def get_forward_linkings(): - """ I'm still not sure we wan to use /var/db/pkg vs some path of binari= es """ + # I'm still not sure we wan to use /var/db/pkg vs some path of binaries var_db_pkg =3D '/var/db/pkg' forward_linkings =3D {} so2filename_mappings =3D {} @@ -70,7 +72,7 @@ def invert_linkings( forward_linkings ): return reverse_linkings=20 =20 =20 -def print_forward_linkings( forward_linkings ): +def print_forward_linkings( forward_linkings, so2filename_mappings ): missing_elfs =3D [] missing_links =3D [] for elf in forward_linkings: @@ -87,7 +89,6 @@ def print_forward_linkings( forward_linkings ): except: missing_links.append(elf_dep) =20 - missing_elfs =3D set(missing_elfs) print '\n\n' print '**** Missing elfs ****' @@ -135,11 +136,54 @@ def print_reverse_linkings( reverse_linkings ): print '\n\n' =20 =20 -( forward_linkings, so2filename_mappings ) =3D get_forward_linkings() -reverse_linkings =3D invert_linkings( forward_linkings ) - -print_forward_linkings( forward_linkings ) -#print_reverse_linkings( reverse_linkings ) +def usage(): + print 'TODO' =20 =20 +def main(): + try: + opts, args =3D getopt.getopt(sys.argv[1:], 'hfrb:l:') + except getopt.GetoptError, err: + print str(err) # will print something like 'option -a not recognized' + usage() + sys.exit(1) + + if len(opts) =3D=3D 0: + usage() + sys.exit(1) + + binary =3D None + library =3D None + + do_forward =3D False + do_reverse =3D False + + for o, a in opts: + if o =3D=3D '-h': + usage() + sys.exit(1) + elif o =3D=3D '-f': + do_forward =3D True + elif o =3D=3D '-r': + do_reverse =3D True + elif o =3D=3D '-b': + binary =3D a + elif o =3D=3D '-l': + library =3D a + else: + print 'Option included in getopt but not handled here!' + usage() + sys.exit(1) + + if do_forward: + ( forward_linkings, so2filename_mappings ) =3D get_forward_linkings() + print_forward_linkings( forward_linkings, so2filename_mappings ) + + if do_reverse: + ( forward_linkings, so2filename_mappings ) =3D get_forward_linkings() + reverse_linkings =3D invert_linkings( forward_linkings ) + print_reverse_linkings( reverse_linkings ) + +if __name__ =3D=3D '__main__': + main() =20