From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/elfix:elfix-0.2.x commit in: scripts/
Date: Sat, 8 Oct 2011 18:54:08 +0000 (UTC) [thread overview]
Message-ID: <1c3eb9ed50bc21b46ac4eb75a96a565163bc5b43.blueness@gentoo> (raw)
commit: 1c3eb9ed50bc21b46ac4eb75a96a565163bc5b43
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 6 19:46:25 2011 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 8 18:53:27 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=1c3eb9ed
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
from os import listdir
-#from os import path
+#from os import listdir, path
import re
import pax
-var_db_pkg = '/var/db/pkg'
-
-binaries = {}
-for cat in listdir(var_db_pkg):
- catdir = '%s/%s' % (var_db_pkg, cat)
- for pkg in listdir(catdir):
- pkgdir = '%s/%s' % (catdir, pkg)
- need = '%s/%s' % (pkgdir, 'NEEDED')
- try:
- g = open(need, 'r')
- needs = g.readlines()
- for line in needs:
- line = line.strip()
- linking = re.split('\s', line)
- binary = linking[0]
- print binary
- library_list = re.split(',', linking[1])
- print "\t%s" % library_list
- binaries[binary] = library_list
- except:
- break
-""" 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 = '/var/db/pkg'
+ elf_objects = {}
+ for cat in listdir(var_db_pkg):
+ catdir = '%s/%s' % (var_db_pkg, cat)
+ for pkg in listdir(catdir):
+ pkgdir = '%s/%s' % (catdir, pkg)
+ need = '%s/%s' % (pkgdir, 'NEEDED')
+ try:
+ g = open(need, 'r')
+ needs = g.readlines()
+ for line in needs:
+ line = line.strip()
+ linking = re.split('\s', line)
+ elf = linking[0]
+ elf_deps = re.split(',', linking[1])
+ elf_objects[elf] = elf_deps
+ except:
+ break
+
+ return elf_objects
+
+
+def reverse_linkings( binaries ):
+ libraries = {}
+ for binary in binaries:
+ for library in binaries[binary]:
+ libraries[library] = []
+
+ for binary in binaries:
+ for library in binaries[binary]:
+ libraries[library].append(binary)
-libraries = {}
-for binary in binaries:
- for library in binaries[binary]:
- libraries[library] = []
+ return libraries
-for binary in binaries:
- for library in binaries[binary]:
- libraries[library].append(binary)
+
+elf_objects = forward_linkings()
+elf_deps = 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
+"""
""" 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
"""
-
-
next reply other threads:[~2011-10-08 18:55 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-08 18:54 Anthony G. Basile [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-10-17 21:09 [gentoo-commits] proj/elfix:elfix-0.2.x commit in: scripts/ Anthony G. Basile
2011-10-17 21:09 Anthony G. Basile
2011-10-17 21:09 Anthony G. Basile
2011-10-17 21:09 Anthony G. Basile
2011-10-17 21:09 Anthony G. Basile
2011-10-17 21:09 Anthony G. Basile
2011-10-17 21:09 Anthony G. Basile
2011-10-17 21:09 Anthony G. Basile
2011-10-12 10:49 Anthony G. Basile
2011-10-12 10:48 Anthony G. Basile
2011-10-12 10:48 Anthony G. Basile
2011-10-12 10:47 Anthony G. Basile
2011-10-12 10:47 Anthony G. Basile
2011-10-08 18:54 Anthony G. Basile
2011-10-08 18:54 Anthony G. Basile
2011-10-08 18:54 Anthony G. Basile
2011-10-08 18:54 Anthony G. Basile
2011-10-08 18:54 Anthony G. Basile
2011-10-08 18:54 Anthony G. Basile
2011-10-08 18:54 Anthony G. Basile
2011-10-08 18:54 Anthony G. Basile
2011-10-08 18:54 Anthony G. Basile
2011-10-08 18:54 Anthony G. Basile
2011-10-08 18:54 Anthony G. Basile
2011-10-08 18:54 Anthony G. Basile
2011-10-08 18:54 Anthony G. Basile
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1c3eb9ed50bc21b46ac4eb75a96a565163bc5b43.blueness@gentoo \
--to=blueness@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox