public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/elfix:master commit in: scripts/
Date: Mon, 10 Oct 2011 23:42:36 +0000 (UTC)	[thread overview]
Message-ID: <24f72fe5d67a7bd2af60b7b50a78c03eea4e29c7.blueness@gentoo> (raw)

commit:     24f72fe5d67a7bd2af60b7b50a78c03eea4e29c7
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 10 23:42:31 2011 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Oct 10 23:42:31 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=24f72fe5

scripts/revdep-pax: code and variable name cleanup

---
 scripts/revdep-pax |   67 ++++++++++++++++++++++++++++++++-------------------
 1 files changed, 42 insertions(+), 25 deletions(-)

diff --git a/scripts/revdep-pax b/scripts/revdep-pax
index 4e35f1e..75ec724 100755
--- a/scripts/revdep-pax
+++ b/scripts/revdep-pax
@@ -8,13 +8,16 @@ import re
 import pax
 
 def get_ldd_linkings(binary):
+
 	try:
-		#When subprocess.DEVNULL makes it to python, change this: http://bugs.python.org/issue5870
+		#TODO: when subprocess.DEVNULL makes it to python, change this: http://bugs.python.org/issue5870
 		ldd_output = subprocess.check_output(['/usr/bin/ldd', binary], stderr=subprocess.PIPE)
 	except:
-		# We should record these binaries which are probably statically linked
+		#TODO: we should record these binaries which are probably statically linked
 		return []
+
 	ldd_lines = ldd_output.split('\n')
+
 	linkings = []
 	mappings = {}
 	for m in range(0,len(ldd_lines)):
@@ -30,14 +33,16 @@ def get_ldd_linkings(binary):
 		library = os.path.realpath(library)
 		linkings.append(soname)
 		mappings[soname] = library 
+
 	return ( linkings, mappings )
 
 
 def get_forward_linkings():
-	# I'm still not sure we wan to use /var/db/pkg vs some path of binaries
+	#TODO: I'm still not sure we wan to use /var/db/pkg vs some path of binaries
 	var_db_pkg = '/var/db/pkg'
+
 	forward_linkings = {}
-	so2filename_mappings = {}
+	so2library_mappings = {}
 	for cat in os.listdir(var_db_pkg):
 		catdir = '%s/%s' % (var_db_pkg, cat)
 		for pkg in os.listdir(catdir):
@@ -52,11 +57,11 @@ def get_forward_linkings():
 					binary = link[0]
 					( linkings, mappings ) = get_ldd_linkings(binary)
 					forward_linkings[binary] = linkings 
-					so2filename_mappings.update(mappings)
+					so2library_mappings.update(mappings)
 			except:
 				continue
 
-	return ( forward_linkings, so2filename_mappings )
+	return ( forward_linkings, so2library_mappings )
 
 
 def invert_linkings( forward_linkings ):
@@ -72,7 +77,7 @@ def invert_linkings( forward_linkings ):
 	return reverse_linkings 
 
 
-def print_forward_linkings( forward_linkings, so2filename_mappings, verbose ):
+def print_forward_linkings( forward_linkings, so2library_mappings, verbose ):
 	missing_binaries = []
 	missing_links = []
 	for binary in forward_linkings:
@@ -87,7 +92,7 @@ def print_forward_linkings( forward_linkings, so2filename_mappings, verbose ):
 		count = 0
 		for soname in forward_linkings[binary]:
 			try:
-				library = so2filename_mappings[soname]
+				library = so2library_mappings[soname]
 				library_flags = pax.getflags(library)
 				s = "%s\n\t%s\t%s ( %s )" % ( s, soname, library, library_flags )
 				if binary_flags != library_flags:
@@ -103,33 +108,38 @@ def print_forward_linkings( forward_linkings, so2filename_mappings, verbose ):
 			if count != 0:
 				print s
 
+	print
+
 	missing_binaries = set(missing_binaries)
-	print '\n\n'
+	print
+	print
 	print '**** Missing binaries ****'
 	for m in missing_binaries:
 		print m
 
 	missing_links = set(missing_links)
-	print '\n\n'
+	print
+	print
 	print '**** Missing forward linkings ****'
 	for m in missing_links:
 		print m
 
-	print '\n\n'
+	print
+	print
 
 
-def print_reverse_linkings( reverse_linkings, so2filename_mappings, verbose ):
+def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose ):
 	missing_sonames = []
 	missing_links = []
 
 	for soname in reverse_linkings:
 
 		try:
-			library = so2filename_mappings[soname]
+			library = so2library_mappings[soname]
 			library_flags = pax.getflags(library)
 			s = "%s\t%s ( %s )" % ( soname, library, library_flags )
 		except:
-			missing_libraries.append(soname)
+			missing_sonames.append(soname)
 			continue
 
 		count = 0
@@ -150,19 +160,23 @@ def print_reverse_linkings( reverse_linkings, so2filename_mappings, verbose ):
 			if count != 0:
 				print s
 
+	print
+
 	missing_sonames = set(missing_sonames)
-	print '\n\n'
+	print
+	print
 	print '**** Missing sonames ****'
 	for m in missing_sonames:
 		print m
 
 	missing_links = set(missing_links)
-	print '\n\n'
+	print
+	print
 	print '**** Missing reverse linkings ****'
 	for m in missing_links:
 		print m
-
-	print '\n\n'
+	print
+	print
 
 
 def run_usage():
@@ -183,14 +197,14 @@ def run_usage():
 
 
 def run_forward(verbose):
-	( forward_linkings, so2filename_mappings ) = get_forward_linkings()
-	print_forward_linkings( forward_linkings, so2filename_mappings, verbose)
+	( forward_linkings, so2library_mappings ) = get_forward_linkings()
+	print_forward_linkings( forward_linkings, so2library_mappings, verbose)
 
 
 def run_reverse(verbose):
-	( forward_linkings, so2filename_mappings ) = get_forward_linkings()
+	( forward_linkings, so2library_mappings ) = get_forward_linkings()
 	reverse_linkings = invert_linkings( forward_linkings )
-	print_reverse_linkings( reverse_linkings, so2filename_mappings, verbose )
+	print_reverse_linkings( reverse_linkings, so2library_mappings, verbose )
 
 
 def run_binary(binary, verbose):
@@ -219,10 +233,10 @@ def run_binary(binary, verbose):
 
 
 def run_soname(soname, verbose):
-	( forward_linkings, so2filename_mappings ) = get_forward_linkings()
+	( forward_linkings, so2library_mappings ) = get_forward_linkings()
 	reverse_linkings = invert_linkings( forward_linkings )
 	linkings = reverse_linkings[soname]
-	library = so2filename_mappings[soname]
+	library = so2library_mappings[soname]
 
 	library_flags = pax.getflags(library)
 	print soname, '\t', library, '(', library_flags, ')'
@@ -241,7 +255,8 @@ def run_soname(soname, verbose):
 			print "cannot obtain pax flags for %s" % binary
 
 	if count == 0:
-		print '\nNo mismatches'
+		print
+		print 'No mismatches'
 
 def main():
 	try:
@@ -282,6 +297,8 @@ def main():
 			print 'Please file a bug'
 			sys.exit(1)
 
+	#TODO: Add code to only allow one of -h, -f -r -b -s
+
 	if do_usage:
 		run_usage()
 



             reply	other threads:[~2011-10-10 23:42 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-10 23:42 Anthony G. Basile [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-11-18 18:21 [gentoo-commits] proj/elfix:master commit in: scripts/ Anthony G. Basile
2019-04-22 22:14 Anthony G. Basile
2015-10-27 19:37 Anthony G. Basile
2015-01-04 15:42 Anthony G. Basile
2014-12-22 17:29 Anthony G. Basile
2014-10-17 20:02 Anthony G. Basile
2014-01-23 16:22 Anthony G. Basile
2014-01-20 22:44 Anthony G. Basile
2013-05-20 19:47 Anthony G. Basile
2013-03-14  2:39 Anthony G. Basile
2013-01-06 17:19 Anthony G. Basile
2012-12-28 19:34 Anthony G. Basile
2012-12-23  3:49 Anthony G. Basile
2012-12-23  2:36 Anthony G. Basile
2012-12-23  1:04 Anthony G. Basile
2012-12-22 22:20 Anthony G. Basile
2012-12-22 20:17 Anthony G. Basile
2012-12-22 19:42 Anthony G. Basile
2012-12-22 19:29 Anthony G. Basile
2012-12-22 19:02 Anthony G. Basile
2012-12-22 18:31 Anthony G. Basile
2012-12-22 16:36 Anthony G. Basile
2012-12-22  1:04 Anthony G. Basile
2012-12-20  4:26 Anthony G. Basile
2012-12-19  4:09 Anthony G. Basile
2012-12-19  3:51 Anthony G. Basile
2012-12-15 20:03 Anthony G. Basile
2012-12-14  2:19 Anthony G. Basile
2012-12-14  2:16 Anthony G. Basile
2012-12-14  2:04 Anthony G. Basile
2012-12-14  1:59 Anthony G. Basile
2012-12-14  1:26 Anthony G. Basile
2012-12-14  1:20 Anthony G. Basile
2012-07-27 22:01 Anthony G. Basile
2012-07-23 19:18 Anthony G. Basile
2012-07-23 15:46 Anthony G. Basile
2012-07-23 15:27 Anthony G. Basile
2012-07-23 14:58 Anthony G. Basile
2012-07-23 14:15 Anthony G. Basile
2012-07-23 13:06 Anthony G. Basile
2012-07-23 11:47 Anthony G. Basile
2012-07-22 23:11 Anthony G. Basile
2012-07-22 22:22 Anthony G. Basile
2012-07-21 16:28 Anthony G. Basile
2012-07-21 15:44 Anthony G. Basile
2012-07-21 15:41 Anthony G. Basile
2012-07-21 13:53 Anthony G. Basile
2011-12-28 23:19 Anthony G. Basile
2011-12-28 23:18 Anthony G. Basile
2011-12-28 16:37 Anthony G. Basile
2011-12-28 15:39 Anthony G. Basile
2011-12-28 15:31 Anthony G. Basile
2011-12-26 22:24 Anthony G. Basile
2011-12-26 20:25 Anthony G. Basile
2011-12-04 21:43 Anthony G. Basile
2011-11-27  0:17 Anthony G. Basile
2011-11-26 22:08 Anthony G. Basile
2011-11-26 21:15 Anthony G. Basile
2011-11-26 19:08 Anthony G. Basile
2011-11-26 19:07 Anthony G. Basile
2011-10-17 20:55 Anthony G. Basile
2011-10-17 20:15 Anthony G. Basile
2011-10-17 19:28 Anthony G. Basile
2011-10-16 18:27 Anthony G. Basile
2011-10-16 18:27 Anthony G. Basile
2011-10-16 18:04 Anthony G. Basile
2011-10-13  4:36 Anthony G. Basile
2011-10-13  2:27 Anthony G. Basile
2011-10-13  0:36 Anthony G. Basile
2011-10-11  0:50 Anthony G. Basile
2011-10-10 23:21 Anthony G. Basile
2011-10-10 17:30 Anthony G. Basile
2011-10-10 17:29 Anthony G. Basile
2011-10-08 18:35 Anthony G. Basile
2011-10-08  2:03 Anthony G. Basile
2011-10-08  0:46 Anthony G. Basile
2011-10-07 22:14 Anthony G. Basile
2011-10-07 19:58 Anthony G. Basile
2011-10-07  1:56 Anthony G. Basile
2011-10-06 23:39 Anthony G. Basile
2011-10-06 20:14 Anthony G. Basile
2011-10-06 19:46 Anthony G. Basile
2011-10-06  4:19 Anthony G. Basile
2011-10-06  4:07 Anthony G. Basile
2011-10-06  3:14 Anthony G. Basile
2011-10-06  3:13 Anthony G. Basile
2011-10-06  2:20 Anthony G. Basile
2011-09-08 23:50 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=24f72fe5d67a7bd2af60b7b50a78c03eea4e29c7.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