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: misc/
Date: Sun, 23 Dec 2012 03:47:41 +0000 (UTC)	[thread overview]
Message-ID: <1356234451.718cf5013101bb2e8c1eced72fd4bc37e5330f97.blueness@gentoo> (raw)

commit:     718cf5013101bb2e8c1eced72fd4bc37e5330f97
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 23 03:47:31 2012 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Dec 23 03:47:31 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=718cf501

 misc/alt-revdep-pax: add printing forward linkings per elf object (-b)

---
 misc/alt-revdep-pax |   52 ++++++++++++++++++++++++++++++--------------------
 1 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/misc/alt-revdep-pax b/misc/alt-revdep-pax
index 6fb88fa..4ea90d4 100755
--- a/misc/alt-revdep-pax
+++ b/misc/alt-revdep-pax
@@ -365,28 +365,35 @@ def migrate_flags(importer, exporter_str_flags, exporter_bin_flags):
 	pax.setbinflags(importer, result_bin_flags)
 
 
-def run_binary(binary, verbose, mark, allyes):
-	if not os.path.exists(binary):
-		print('%s\tNo such OBJECT' % binary)
+def run_elf(elf, verbose, mark, allyes):
+
+	if not os.path.exists(elf):
+		print('%s\tNo such OBJECT' % elf)
 		return
-	( linkings, mappings ) = get_ldd_linkings(binary)
-	( binary_str_flags, binary_bin_flags ) = pax.getflags(binary)
-	print('%s (%s)\n' % ( binary, binary_str_flags ))
+
+	try:
+		(elf_str_flags, elf_bin_flags) = pax.getflags(elf)
+		print('%s (%s)\n' % (elf, elf_str_flags))
+	except pax.PaxError:
+		print('%s: No PAX flags found\n' % elf)
+		return
+
+	(object_linkings, soname2library) = get_object_linkings()
 
 	mismatched_libraries = []
 
-	for soname in linkings:
+	for soname in object_linkings[elf]:
 		try:
-			library = mappings[soname]
+			library = soname2library[soname]
 			( library_str_flags, library_bin_flags ) = pax.getflags(library)
 			if verbose:
 				print('\t%s\t%s ( %s )' % ( soname, library, library_str_flags ))
-			if binary_str_flags != library_str_flags:
+			if elf_str_flags != library_str_flags:
 				mismatched_libraries.append(library)
 				if not verbose:
 					print('\t%s\t%s ( %s )' % ( soname, library, library_str_flags ))
 		except pax.PaxError:
-			print('file for soname %s not found' % soname)
+			print('%s: file for soname not found' % soname)
 
 	if len(mismatched_libraries) == 0:
 		if not verbose:
@@ -394,7 +401,7 @@ def run_binary(binary, verbose, mark, allyes):
 	else:
 		print('\n'),
 		if mark:
-			print('\tWill mark libraries with %s\n' % binary_str_flags)
+			print('\tWill mark libraries with %s\n' % elf_str_flags)
 			for library in mismatched_libraries:
 				do_marking = False
 				while True:
@@ -413,12 +420,15 @@ def run_binary(binary, verbose, mark, allyes):
 
 				if do_marking:
 					try:
-						migrate_flags(library, binary_str_flags, binary_bin_flags)
+						migrate_flags(library, elf_str_flags, elf_bin_flags)
+					except pax.PaxError:
+						print('\n\tCould not set PAX flags on %s, text maybe busy' % library)
+
+					try:
+						( library_str_flags, library_bin_flags ) = pax.getflags(library)
+						print('\n\t\t%s ( %s )\n' % ( library, library_str_flags ))
 					except pax.PaxError:
-						print("\n\tCould not set pax flags on %s, file is probably busy" % library)
-						print("\tShut down all processes that use it and try again")
-					( library_str_flags, library_bin_flags ) = pax.getflags(library)
-					print('\n\t\t%s ( %s )\n' % ( library, library_str_flags ))
+						print('\n\t\t%s: Could not read PAX flags')
 
 
 def invert_so2library_mappings( so2library_mappings ):
@@ -555,8 +565,8 @@ def main():
 	do_forward = False
 	do_reverse = False
 
-	binary = None
-	soname = None
+	elf     = None
+	soname  = None
 	library = None
 
 	verbose = False
@@ -577,7 +587,7 @@ def main():
 			do_reverse = True
 			opt_count += 1
 		elif o == '-b':
-			binary = a
+			elf = a
 			opt_count += 1
 		elif o == '-s':
 			soname = a
@@ -605,8 +615,8 @@ def main():
 		run_forward(verbose)
 	elif do_reverse:
 		run_reverse(verbose, executable_only)
-	elif binary != None:
-		run_binary(binary, verbose, mark, allyes)
+	elif elf != None:
+		run_elf(elf, verbose, mark, allyes)
 	elif soname != None:
 		run_soname(soname, verbose, True, mark, allyes, executable_only)
 	elif library != None:


             reply	other threads:[~2012-12-23  3:47 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-23  3:47 Anthony G. Basile [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-02-13 21:38 [gentoo-commits] proj/elfix:master commit in: misc/ Anthony G. Basile
2014-02-13 19:07 Anthony G. Basile
2013-05-21 15:21 Anthony G. Basile
2013-02-09 21:50 Anthony G. Basile
2012-12-27  3:11 Anthony G. Basile
2012-12-26 21:43 Anthony G. Basile
2012-12-26 21:23 Anthony G. Basile
2012-12-26  3:42 Anthony G. Basile
2012-12-25 14:22 Anthony G. Basile
2012-12-24 23:26 Anthony G. Basile
2012-12-24 21:44 Anthony G. Basile
2012-12-24 21:08 Anthony G. Basile
2012-12-24  2:18 Anthony G. Basile
2012-12-24  1:54 Anthony G. Basile
2012-12-23 11:51 Anthony G. Basile
2012-12-23  4:53 Anthony G. Basile
2012-12-23  3:49 Anthony G. Basile
2012-12-23  3:49 Anthony G. Basile
2012-12-23  3:49 Anthony G. Basile
2012-12-23  2:36 Anthony G. Basile
2012-12-23  2:36 Anthony G. Basile
2012-12-23  2:34 Anthony G. Basile
2012-12-23  1:02 Anthony G. Basile
2012-12-22 14:44 Anthony G. Basile
2012-12-22  4:21 Anthony G. Basile
2012-12-22  3:58 Anthony G. Basile
2012-12-22  1:06 Anthony G. Basile
2012-12-19  3:52 Anthony G. Basile
2011-07-08  1:32 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=1356234451.718cf5013101bb2e8c1eced72fd4bc37e5330f97.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