1 |
commit: 9e7b34d3ae586ca8d0aa9419282b23702e34ecb6 |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Nov 29 04:19:34 2011 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Nov 29 04:19:34 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=9e7b34d3 |
7 |
|
8 |
scripts/revdep-pax: -e works with both -v and not -v |
9 |
|
10 |
--- |
11 |
doc/revdep-pax.1 | 6 ++-- |
12 |
doc/revdep-pax.pod | 2 +- |
13 |
scripts/revdep-pax | 90 +++++++++++++++++++++++----------------------------- |
14 |
3 files changed, 44 insertions(+), 54 deletions(-) |
15 |
|
16 |
diff --git a/doc/revdep-pax.1 b/doc/revdep-pax.1 |
17 |
index b991d90..3d2974c 100644 |
18 |
--- a/doc/revdep-pax.1 |
19 |
+++ b/doc/revdep-pax.1 |
20 |
@@ -187,9 +187,9 @@ so that the PaX flags of the target inherit the flags of the source. |
21 |
.IP "\fB\-v\fR Report all mappings, not just the mismatched ones." 4 |
22 |
.IX Item "-v Report all mappings, not just the mismatched ones." |
23 |
.IP "" 4 |
24 |
-.ie n .IP "\fB\-e\fR If \-m is chosen, then limit the markings to only those executables in the current shell's $PATH. If \-v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4 |
25 |
-.el .IP "\fB\-e\fR If \-m is chosen, then limit the markings to only those executables in the current shell's \f(CW$PATH\fR. If \-v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4 |
26 |
-.IX Item "-e If -m is chosen, then limit the markings to only those executables in the current shell's $PATH. If -v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for -r, -s or -l." |
27 |
+.ie n .IP "\fB\-e\fR Limit the markings or report to only those executables in the current shell's $PATH." 4 |
28 |
+.el .IP "\fB\-e\fR Limit the markings or report to only those executables in the current shell's \f(CW$PATH\fR." 4 |
29 |
+.IX Item "-e Limit the markings or report to only those executables in the current shell's $PATH." |
30 |
.IP "" 4 |
31 |
.IP "\fB\-h\fR Print out a short help message and exit." 4 |
32 |
.IX Item "-h Print out a short help message and exit." |
33 |
|
34 |
diff --git a/doc/revdep-pax.pod b/doc/revdep-pax.pod |
35 |
index 98175bd..03ff277 100644 |
36 |
--- a/doc/revdep-pax.pod |
37 |
+++ b/doc/revdep-pax.pod |
38 |
@@ -68,7 +68,7 @@ so that the PaX flags of the target inherit the flags of the source. |
39 |
|
40 |
=item |
41 |
|
42 |
-=item B<-e> If -m is chosen, then limit the markings to only those executables in the current shell's $PATH. If -v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for -r, -s or -l. |
43 |
+=item B<-e> Limit the markings or report to only those executables in the current shell's $PATH. |
44 |
|
45 |
=item |
46 |
|
47 |
|
48 |
diff --git a/scripts/revdep-pax b/scripts/revdep-pax |
49 |
index fdc96fe..42a71fd 100755 |
50 |
--- a/scripts/revdep-pax |
51 |
+++ b/scripts/revdep-pax |
52 |
@@ -83,7 +83,7 @@ def print_forward_linkings( forward_linkings, so2library_mappings, verbose ): |
53 |
|
54 |
try: |
55 |
( binary_flags, binary_pax_flags ) = pax.getflags(binary) |
56 |
- sv = '%s ( %s )' % ( binary, binary_flags ) |
57 |
+ sv = '%s ( %s )\n' % ( binary, binary_flags ) |
58 |
s = sv |
59 |
except: |
60 |
missing_binaries.append(binary) |
61 |
@@ -102,31 +102,25 @@ def print_forward_linkings( forward_linkings, so2library_mappings, verbose ): |
62 |
missing_links.append(soname) |
63 |
|
64 |
if verbose: |
65 |
- print sv |
66 |
- print |
67 |
+ print '%s\n' % sv |
68 |
if count == 0: |
69 |
- print '\tNo mismatches' |
70 |
+ print '\tNo mismatches\n\n' |
71 |
else: |
72 |
- print '\tMismatches' |
73 |
- print |
74 |
+ print '\tMismatches\n\n' |
75 |
else: |
76 |
if count != 0: |
77 |
- print s |
78 |
- print |
79 |
+ print '%s\n\n' % s |
80 |
|
81 |
missing_binaries = set(missing_binaries) |
82 |
- print |
83 |
- print '**** Missing binaries ****' |
84 |
+ print '\n**** Missing binaries ****\n' |
85 |
for m in missing_binaries: |
86 |
- print m |
87 |
+ print '\t%s' % m |
88 |
+ print |
89 |
|
90 |
missing_links = set(missing_links) |
91 |
- print |
92 |
- print '**** Missing forward linkings ****' |
93 |
+ print '\n**** Missing forward linkings ****\n' |
94 |
for m in missing_links: |
95 |
- print m |
96 |
- |
97 |
- print |
98 |
+ print '\t%s' % m |
99 |
print |
100 |
|
101 |
|
102 |
@@ -136,11 +130,10 @@ def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose, exec |
103 |
missing_links = [] |
104 |
|
105 |
for soname in reverse_linkings: |
106 |
- |
107 |
try: |
108 |
library = so2library_mappings[soname] |
109 |
( library_flags, library_pax_flags ) = pax.getflags(library) |
110 |
- sv = '%s\t%s ( %s )' % ( soname, library, library_flags ) |
111 |
+ sv = '%s\t%s ( %s )\n' % ( soname, library, library_flags ) |
112 |
s = sv |
113 |
except: |
114 |
missing_sonames.append(soname) |
115 |
@@ -153,54 +146,49 @@ def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose, exec |
116 |
if executable_only: |
117 |
if os.path.dirname(binary) in shell_path: |
118 |
sv = '%s\n\t%s ( %s )' % ( sv, binary, binary_flags ) |
119 |
+ if library_flags != binary_flags: |
120 |
+ s = '%s\n\t%s ( %s )' % ( s, binary, binary_flags ) |
121 |
+ count = count + 1 |
122 |
else: |
123 |
sv = '%s\n\t%s ( %s )' % ( sv, binary, binary_flags ) |
124 |
- if library_flags != binary_flags: |
125 |
- s = '%s\n\t%s ( %s )' % ( s, binary, binary_flags ) |
126 |
- count = count + 1 |
127 |
+ if library_flags != binary_flags: |
128 |
+ s = '%s\n\t%s ( %s )' % ( s, binary, binary_flags ) |
129 |
+ count = count + 1 |
130 |
except: |
131 |
missing_links.append(binary) |
132 |
|
133 |
if verbose: |
134 |
- print sv |
135 |
- print |
136 |
+ print '%s\n' % sv |
137 |
if count == 0: |
138 |
- print '\tNo mismatches' |
139 |
+ print '\tNo mismatches\n\n' |
140 |
else: |
141 |
- print '\tMismatches' |
142 |
- print |
143 |
+ print '\tMismatches\n\n' |
144 |
else: |
145 |
if count != 0: |
146 |
- print s |
147 |
- print |
148 |
+ print '%s\n\n' % s |
149 |
|
150 |
missing_sonames = set(missing_sonames) |
151 |
- print |
152 |
- print '**** Missing sonames ****' |
153 |
+ print '\n**** Missing sonames ****\n' |
154 |
for m in missing_sonames: |
155 |
- print m |
156 |
+ print '\t%s' % m |
157 |
+ print |
158 |
|
159 |
missing_links = set(missing_links) |
160 |
- print |
161 |
- print '**** Missing reverse linkings ****' |
162 |
+ print '\n**** Missing reverse linkings ****\n' |
163 |
for m in missing_links: |
164 |
- print m |
165 |
- |
166 |
- print |
167 |
+ print '\t%s' % m |
168 |
print |
169 |
|
170 |
|
171 |
def run_forward(verbose): |
172 |
( forward_linkings, so2library_mappings ) = get_forward_linkings() |
173 |
print_forward_linkings( forward_linkings, so2library_mappings, verbose) |
174 |
- print |
175 |
|
176 |
|
177 |
def run_reverse(verbose, executable_only): |
178 |
( forward_linkings, so2library_mappings ) = get_forward_linkings() |
179 |
reverse_linkings = invert_linkings( forward_linkings ) |
180 |
print_reverse_linkings( reverse_linkings, so2library_mappings, verbose, executable_only) |
181 |
- print |
182 |
|
183 |
|
184 |
def run_binary(binary, verbose, mark): |
185 |
@@ -225,13 +213,11 @@ def run_binary(binary, verbose, mark): |
186 |
print 'file for soname %s not found' % soname |
187 |
|
188 |
if len(mismatched_libraries) == 0: |
189 |
- print |
190 |
- print '\tNo mismatches' |
191 |
+ if not verbose: |
192 |
+ print '\tNo mismatches' |
193 |
print |
194 |
else: |
195 |
print |
196 |
- print '\tMismatches' |
197 |
- print |
198 |
if mark: |
199 |
print '\tWill mark libraries with %s' % binary_flags |
200 |
print |
201 |
@@ -292,20 +278,24 @@ def run_soname(name, verbose, use_soname, mark, executable_only): |
202 |
else: |
203 |
print '\t%s ( %s )' % ( binary, binary_flags ) |
204 |
if library_flags != binary_flags: |
205 |
- mismatched_binaries.append(binary) |
206 |
- if not verbose: |
207 |
- print '\t%s ( %s )' % ( binary, binary_flags ) |
208 |
+ if executable_only: |
209 |
+ if os.path.dirname(binary) in shell_path: |
210 |
+ mismatched_binaries.append(binary) |
211 |
+ if not verbose: |
212 |
+ print '\t%s ( %s )' % ( binary, binary_flags ) |
213 |
+ else: |
214 |
+ mismatched_binaries.append(binary) |
215 |
+ if not verbose: |
216 |
+ print '\t%s ( %s )' % ( binary, binary_flags ) |
217 |
except: |
218 |
print 'cannot obtain pax flags for %s' % binary |
219 |
|
220 |
if len(mismatched_binaries) == 0: |
221 |
- print |
222 |
- print '\tNo mismatches' |
223 |
+ if not verbose: |
224 |
+ print '\tNo mismatches' |
225 |
print |
226 |
else: |
227 |
print |
228 |
- print '\tMismatches' |
229 |
- print |
230 |
if mark: |
231 |
print '\tWill mark binaries with %s' % library_flags |
232 |
print |
233 |
@@ -344,7 +334,7 @@ def run_usage(): |
234 |
print ' : revdep-pax -l LIBRARY [-mve] print all reverse mappings only for LIBRARY file' |
235 |
print ' : revdep-pax [-h] print out this help' |
236 |
print ' : -v verbose, otherwise just print mismatching objects' |
237 |
- print ' : -e assuming verbose, only print out executables in shell $PATH' |
238 |
+ print ' : -e only print out executables in shell $PATH' |
239 |
print ' : -m don\'t just report, but mark the mismatching objects' |
240 |
print |