From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 183BA1381FB for ; Sat, 29 Dec 2012 01:17:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EE8EE21C07A; Sat, 29 Dec 2012 01:16:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2D9AB21C152 for ; Sat, 29 Dec 2012 01:16:13 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1BE1E33D813 for ; Sat, 29 Dec 2012 01:16:12 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 9779FE5450 for ; Sat, 29 Dec 2012 01:16:09 +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: <1356743322.fde0fdf864aac2291787d2b6c8a77f84b66d4297.blueness@gentoo> Subject: [gentoo-commits] proj/elfix:elfix-0.7.x commit in: misc/ X-VCS-Repository: proj/elfix X-VCS-Files: misc/link_map.py misc/link_map_test misc/link_maps X-VCS-Directories: misc/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: fde0fdf864aac2291787d2b6c8a77f84b66d4297 X-VCS-Branch: elfix-0.7.x Date: Sat, 29 Dec 2012 01:16: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 X-Archives-Salt: 98c915f9-55f9-4ccb-beb4-b51bd6837dd9 X-Archives-Hash: 7fd4d975e813e2f2739c0a91812acbde commit: fde0fdf864aac2291787d2b6c8a77f84b66d4297 Author: Anthony G. Basile gentoo org> AuthorDate: Wed Dec 26 21:43:20 2012 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Sat Dec 29 01:08:42 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=fde0fdf8 misc/link_map.py: place class in its own module --- misc/{link_maps => link_map.py} | 61 +++++++++++---------------------------- misc/link_map_test | 61 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 44 deletions(-) diff --git a/misc/link_maps b/misc/link_map.py similarity index 83% rename from misc/link_maps rename to misc/link_map.py index 508af24..5b0e822 100755 --- a/misc/link_maps +++ b/misc/link_map.py @@ -1,12 +1,24 @@ #!/usr/bin/env python +# +# LinkMap.py: this file is part of the elfix package +# Copyright (C) 2011 Anthony G. Basile +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . -import os -import sys import re -import pax import portage - class LinkMap: def __init__(self): @@ -22,6 +34,7 @@ class LinkMap: See /usr/lib/portage/bin/misc-functions.sh ~line 520 """ + vardb = portage.db[portage.root]["vartree"].dbapi self.pkgs = [] @@ -183,43 +196,3 @@ class LinkMap: return ( object_linkings, object_reverse_linkings, library2soname, soname2library ) - -def main(): - - # Run as root to be able to real all files - uid = os.getuid() - if uid != 0: - print('RUN AS ROOT: cannot read all flags') - sys.exit(0) - - link_maps = LinkMap() - ( object_linkings, object_reverse_linkings, library2soname, soname2library ) = link_maps.get_maps() - - layout = "{0:<30} => {1:<30}" - - #Print out all ELF objects and the NEEDED sonames and full library paths - for abi in object_linkings: - for elf in object_linkings[abi]: - sonames = object_linkings[abi][elf] - print('%s: %s' % (abi,elf)) - for soname in sorted(object_linkings[abi][elf]): - try: - print('\t%s' % layout.format(soname, soname2library[(soname,abi)])) - except KeyError: - print('\t%s' % layout.format(soname, '***' )) - print('') - - # Print out all ELF objects and the NEEDED sonames and full library paths - for abi in object_linkings: - for soname in object_reverse_linkings[abi]: - try: - print('%s: %s' % (abi, layout.format(soname, soname2library[(soname,abi)]))) - except KeyError: - print('%s: %s' % (abi, layout.format(soname, '***' ))) - for elf in sorted(object_reverse_linkings[abi][soname]): - print('\t%s' % elf) - print('') - - -if __name__ == '__main__': - main() diff --git a/misc/link_map_test b/misc/link_map_test new file mode 100755 index 0000000..9a1af8e --- /dev/null +++ b/misc/link_map_test @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# +# link_map_test: this file is part of the elfix package +# Copyright (C) 2011 Anthony G. Basile +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import os +import sys +from link_map import LinkMap + +def main(): + + # Run as root to be able to real all files + uid = os.getuid() + if uid != 0: + print('RUN AS ROOT: cannot read all flags') + sys.exit(0) + + link_map = LinkMap() + ( object_linkings, object_reverse_linkings, library2soname, soname2library ) = link_map.get_maps() + + layout = "{0:<30} => {1:<30}" + + #Print out all ELF objects and the NEEDED sonames and full library paths + for abi in object_linkings: + for elf in object_linkings[abi]: + sonames = object_linkings[abi][elf] + print('%s: %s' % (abi,elf)) + for soname in sorted(object_linkings[abi][elf]): + try: + print('\t%s' % layout.format(soname, soname2library[(soname,abi)])) + except KeyError: + print('\t%s' % layout.format(soname, '***' )) + print('') + + # Print out all ELF objects and the NEEDED sonames and full library paths + for abi in object_linkings: + for soname in object_reverse_linkings[abi]: + try: + print('%s: %s' % (abi, layout.format(soname, soname2library[(soname,abi)]))) + except KeyError: + print('%s: %s' % (abi, layout.format(soname, '***' ))) + for elf in sorted(object_reverse_linkings[abi][soname]): + print('\t%s' % elf) + print('') + + +if __name__ == '__main__': + main()