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 1RCc3i-0004vl-7k 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 5D95C21C259; Sat, 8 Oct 2011 18:54:15 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1F62321C259 for ; Sat, 8 Oct 2011 18:54:10 +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 D1FC21B4021 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 359B780051 for ; Sat, 8 Oct 2011 18:54:09 +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: <44f64229fd2997488871601913b5d25c66106109.blueness@gentoo> 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: 44f64229fd2997488871601913b5d25c66106109 Date: Sat, 8 Oct 2011 18:54:09 +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: 77416f8fbbecb889aaae6ef1c5c8c818 commit: 44f64229fd2997488871601913b5d25c66106109 Author: Anthony G. Basile gentoo org> AuthorDate: Fri Oct 7 22:14:35 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=3D44f64229 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