1 |
commit: aed173120942ee652be1844b6a020136de31f4c7 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Feb 10 16:29:40 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Tue Feb 11 08:02:48 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=aed17312 |
7 |
|
8 |
revdep_rebuild: Fix tracebacks due to empy results returned from scanelf calls. |
9 |
|
10 |
Add blank line removal to scan(). |
11 |
Add incorrect parts length detection to scan_files() (just in case) |
12 |
|
13 |
--- |
14 |
pym/gentoolkit/revdep_rebuild/analyse.py | 7 ++++++- |
15 |
pym/gentoolkit/revdep_rebuild/stuff.py | 5 ++++- |
16 |
2 files changed, 10 insertions(+), 2 deletions(-) |
17 |
|
18 |
diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py |
19 |
index 7b17517..a32ea05 100644 |
20 |
--- a/pym/gentoolkit/revdep_rebuild/analyse.py |
21 |
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py |
22 |
@@ -60,7 +60,12 @@ def scan_files(libs_and_bins, cmd_max_args): |
23 |
|
24 |
scanned_files = {} # {bits: {soname: (filename, needed), ...}, ...} |
25 |
for line in scan(['-nBF', '%F %f %S %n %M'], libs_and_bins, cmd_max_args): |
26 |
- filename, sfilename, soname, needed, bits = line.split(' ') |
27 |
+ parts = line.split(' ') |
28 |
+ if len(parts) < 5: |
29 |
+ print("scan_files(); error processing lib: %s" % line) |
30 |
+ print("scan_files(); parts = %s" % str(parts)) |
31 |
+ continue |
32 |
+ filename, sfilename, soname, needed, bits = parts |
33 |
filename = os.path.realpath(filename) |
34 |
needed = needed.split(',') |
35 |
bits = bits[8:] # 8: -> strlen('ELFCLASS') |
36 |
|
37 |
diff --git a/pym/gentoolkit/revdep_rebuild/stuff.py b/pym/gentoolkit/revdep_rebuild/stuff.py |
38 |
index 0bebce2..aa91be2 100644 |
39 |
--- a/pym/gentoolkit/revdep_rebuild/stuff.py |
40 |
+++ b/pym/gentoolkit/revdep_rebuild/stuff.py |
41 |
@@ -38,8 +38,11 @@ def scan(params, files, max_args): |
42 |
''' |
43 |
out = [] |
44 |
for i in range(0, len(files), max_args): |
45 |
- out += call_program( |
46 |
+ output = call_program( |
47 |
['scanelf'] + params + files[i:i+max_args]).strip().split('\n') |
48 |
+ output = [x for x in output if x != ''] |
49 |
+ if output: |
50 |
+ out.extend(output) |
51 |
return out |