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/, doc/
Date: Wed, 28 Dec 2011 20:37:59 +0000 (UTC)	[thread overview]
Message-ID: <68bea515fdb194cfecf57c3f51fda445bb62f7d0.blueness@gentoo> (raw)

commit:     68bea515fdb194cfecf57c3f51fda445bb62f7d0
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 28 20:37:52 2011 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Dec 28 20:37:52 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=68bea515

scripts/revdep-pax: added an allyes option

---
 doc/revdep-pax.1   |   16 ++++++++++------
 doc/revdep-pax.pod |   16 ++++++++++------
 scripts/revdep-pax |   44 +++++++++++++++++++++++++++-----------------
 3 files changed, 47 insertions(+), 29 deletions(-)

diff --git a/doc/revdep-pax.1 b/doc/revdep-pax.1
index 3d2974c..698e90c 100644
--- a/doc/revdep-pax.1
+++ b/doc/revdep-pax.1
@@ -137,11 +137,11 @@ revdep\-pax \- find mismatching PaX markings between ELF objects and their libra
 .PP
 \&\fBrevdep-pax\fR \-r [\-ve]
 .PP
-\&\fBrevdep-pax\fR \-b \s-1OBJECT\s0 [\-mv]
+\&\fBrevdep-pax\fR \-b \s-1OBJECT\s0 [\-myv]
 .PP
-\&\fBrevdep-pax\fR \-s \s-1SONAME\s0 [\-mve]
+\&\fBrevdep-pax\fR \-s \s-1SONAME\s0 [\-myve]
 .PP
-\&\fBrevdep-pax\fR \-l \s-1LIBRARY\s0 [\-mve]
+\&\fBrevdep-pax\fR \-l \s-1LIBRARY\s0 [\-myve]
 .PP
 \&\fBrevdep-pax\fR [\-h]
 .SH "DESCRIPTION"
@@ -181,9 +181,6 @@ so that the PaX flags of the target inherit the flags of the source.
 .IP "\fB\-l\fR   \s-1LIBRARY\s0 Retrieve only the reverse mappings for this \s-1LIBRARY\s0." 4
 .IX Item "-l   LIBRARY Retrieve only the reverse mappings for this LIBRARY."
 .IP "" 4
-.IP "\fB\-m\fR   Prompt the user to mark the found object with the PaX flags of the source." 4
-.IX Item "-m   Prompt the user to mark the found object with the PaX flags of the source."
-.IP "" 4
 .IP "\fB\-v\fR   Report all mappings, not just the mismatched ones." 4
 .IX Item "-v   Report all mappings, not just the mismatched ones."
 .IP "" 4
@@ -191,6 +188,13 @@ so that the PaX flags of the target inherit the flags of the source.
 .el .IP "\fB\-e\fR   Limit the markings or report to only those executables in the current shell's \f(CW$PATH\fR." 4
 .IX Item "-e   Limit the markings or report to only those executables in the current shell's $PATH."
 .IP "" 4
+.IP "\fB\-m\fR   Prompt the user to mark the found object with the PaX flags of the source." 4
+.IX Item "-m   Prompt the user to mark the found object with the PaX flags of the source."
+.IP "" 4
+.ie n .IP "\fB\-y\fR   Assume ""yes"" to all prompts for making (\s-1USE\s0 \s-1CAREFULLY\s0!)" 4
+.el .IP "\fB\-y\fR   Assume ``yes'' to all prompts for making (\s-1USE\s0 \s-1CAREFULLY\s0!)" 4
+.IX Item "-y   Assume yes to all prompts for making (USE CAREFULLY!)"
+.IP "" 4
 .IP "\fB\-h\fR   Print out a short help message and exit." 4
 .IX Item "-h   Print out a short help message and exit."
 .PD

diff --git a/doc/revdep-pax.pod b/doc/revdep-pax.pod
index 03ff277..19bf750 100644
--- a/doc/revdep-pax.pod
+++ b/doc/revdep-pax.pod
@@ -8,11 +8,11 @@ B<revdep-pax> -f [-v]
 
 B<revdep-pax> -r [-ve]
 
-B<revdep-pax> -b OBJECT [-mv]
+B<revdep-pax> -b OBJECT [-myv]
 
-B<revdep-pax> -s SONAME [-mve]
+B<revdep-pax> -s SONAME [-myve]
 
-B<revdep-pax> -l LIBRARY [-mve]
+B<revdep-pax> -l LIBRARY [-myve]
 
 B<revdep-pax> [-h]
 
@@ -60,15 +60,19 @@ so that the PaX flags of the target inherit the flags of the source.
 
 =item
 
-=item B<-m>   Prompt the user to mark the found object with the PaX flags of the source.
+=item B<-v>   Report all mappings, not just the mismatched ones.
 
 =item
 
-=item B<-v>   Report all mappings, not just the mismatched ones.
+=item B<-e>   Limit the markings or report to only those executables in the current shell's $PATH.
 
 =item
 
-=item B<-e>   Limit the markings or report to only those executables in the current shell's $PATH.
+=item B<-m>   Prompt the user to mark the found object with the PaX flags of the source.
+
+=item
+
+=item B<-y>   Assume "yes" to all prompts for making (USE CAREFULLY!)
 
 =item
 

diff --git a/scripts/revdep-pax b/scripts/revdep-pax
index be6a387..e22d3a7 100755
--- a/scripts/revdep-pax
+++ b/scripts/revdep-pax
@@ -228,7 +228,7 @@ def migrate_flags(importer, exporter_str_flags, exporter_bin_flags):
 	pax.setflags(importer, result_bin_flags)
 
 
-def run_binary(binary, verbose, mark):
+def run_binary(binary, verbose, mark, allyes):
 	( linkings, mappings ) = get_ldd_linkings(binary)
 	( binary_str_flags, binary_bin_flags ) = pax.getflags(binary)
 	print '%s (%s)\n' % ( binary, binary_str_flags )
@@ -259,7 +259,10 @@ def run_binary(binary, verbose, mark):
 			for library in mismatched_libraries:
 				do_marking = False
 				while True:
-					ans = raw_input('\tSet flags for %s (y/n): ' % library)
+					if allyes:
+						ans = 'y'
+					else:
+						ans = raw_input('\tSet flags for %s (y/n): ' % library)
 					if ans == 'y':
 						do_marking = True
 						break
@@ -286,7 +289,7 @@ def invert_so2library_mappings( so2library_mappings ):
 	return library2soname_mappings
 
 
-def run_soname(name, verbose, use_soname, mark, executable_only):
+def run_soname(name, verbose, use_soname, mark, allyes, executable_only):
 	shell_path = path = os.getenv('PATH').split(':')
 
 	( forward_linkings, so2library_mappings ) = get_forward_linkings()
@@ -340,7 +343,10 @@ def run_soname(name, verbose, use_soname, mark, executable_only):
 						continue
 				do_marking = False
 				while True:
-					ans = raw_input('\tSet flags for %s (y/n): ' % binary)
+					if allyes:
+						ans = 'y'
+					else:
+						ans = raw_input('\tSet flags for %s (y/n): ' % binary)
 					if ans == 'y':
 						do_marking = True
 						break
@@ -365,21 +371,22 @@ def run_usage():
 	print 'Program Name : revdep-pax'
 	print 'Description  : Get or set pax flags on an ELF object'
 	print
-	print 'Usage        : revdep-pax -f [-v]            print out all forward mappings for all system binaries'
-	print '             : revdep-pax -r [-ve]           print out all reverse mappings for all system sonames'
-	print '             : revdep-pax -b OBJECT  [-mv]   print all forward mappings only for OBJECT'
-	print '             : revdep-pax -s SONAME  [-mve]  print all reverse mappings only for SONAME'
-	print '             : revdep-pax -l LIBRARY [-mve]  print all reverse mappings only for LIBRARY file'
-	print '             : revdep-pax [-h]               print out this help'
-	print '             : -v                            verbose, otherwise just print mismatching objects'
-	print '             : -e                            only print out executables in shell $PATH'
-	print '             : -m                            don\'t just report, but mark the mismatching objects'
+	print 'Usage        : revdep-pax -f [-v]             print out all forward mappings for all system binaries'
+	print '             : revdep-pax -r [-ve]            print out all reverse mappings for all system sonames'
+	print '             : revdep-pax -b OBJECT  [-myv]   print all forward mappings only for OBJECT'
+	print '             : revdep-pax -s SONAME  [-myve]  print all reverse mappings only for SONAME'
+	print '             : revdep-pax -l LIBRARY [-myve]  print all reverse mappings only for LIBRARY file'
+	print '             : revdep-pax [-h]                print out this help'
+	print '             : -v                             verbose, otherwise just print mismatching objects'
+	print '             : -e                             only print out executables in shell $PATH'
+	print '             : -m                             don\'t just report, but mark the mismatching objects'
+	print '             : -y                             assume "yes" to all prompts for making (USE CAREFULLY!)'
 	print
 
 
 def main():
 	try:
-		opts, args = getopt.getopt(sys.argv[1:], 'hfrb:s:l:vem')
+		opts, args = getopt.getopt(sys.argv[1:], 'hfrb:s:l:vemy')
 	except getopt.GetoptError, err:
 		print str(err) # will print something like 'option -a not recognized'
 		run_usage()
@@ -400,6 +407,7 @@ def main():
 	verbose = False
 	executable_only = False
 	mark = False
+	allyes = False
 
 	opt_count = 0
 
@@ -428,6 +436,8 @@ def main():
 			executable_only = True
 		elif o == '-m':
 			mark = True
+		elif o == '-y':
+			allyes = True
 		else:
 			print 'Option included in getopt but not handled here!'
 			print 'Please file a bug'
@@ -442,18 +452,18 @@ def main():
 		run_reverse(verbose, executable_only)
 	elif binary != None:
 		try:
-			run_binary(binary, verbose, mark)
+			run_binary(binary, verbose, mark, allyes)
 		except:
 			print 'Please check that %s exists!' % binary
 	elif soname != None:
 		try:
-			run_soname(soname, verbose, True, mark, executable_only)
+			run_soname(soname, verbose, True, mark, allyes, executable_only)
 		except:
 			print 'Please check that %s exists!' % soname
 	elif library != None:
 		try:
 			library = os.path.realpath(library)
-			run_soname(library, verbose, False, mark, executable_only)
+			run_soname(library, verbose, False, mark, allyes, executable_only)
 		except:
 			print 'Please check that %s exists!' % library
 



             reply	other threads:[~2011-12-28 20:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-28 20:37 Anthony G. Basile [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-08-12 23:34 [gentoo-commits] proj/elfix:master commit in: scripts/, doc/ Anthony G. Basile
2012-08-12 22:28 Anthony G. Basile
2011-11-29  4:19 Anthony G. Basile
2011-11-26 19:08 Anthony G. Basile
2011-11-26 19:08 Anthony G. Basile
2011-11-26 18:51 Anthony G. Basile
2011-11-26 18:43 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=68bea515fdb194cfecf57c3f51fda445bb62f7d0.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