summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2014-02-10 08:29:40 -0800
committerBrian Dolbec <dolsen@gentoo.org>2014-02-11 00:02:48 -0800
commitaed173120942ee652be1844b6a020136de31f4c7 (patch)
treeb3f6736ef50a45a972f21e58f6f6872296c87374
parent4335bf979f374300ac6678765f490f92ee805ab4 (diff)
downloadgentoolkit-aed173120942ee652be1844b6a020136de31f4c7.tar.gz
revdep_rebuild: Fix tracebacks due to empy results returned from scanelf calls.
Add blank line removal to scan(). Add incorrect parts length detection to scan_files() (just in case)
-rw-r--r--pym/gentoolkit/revdep_rebuild/analyse.py7
-rw-r--r--pym/gentoolkit/revdep_rebuild/stuff.py5
2 files changed, 10 insertions, 2 deletions
diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py
index 7b17517..a32ea05 100644
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@ -60,7 +60,12 @@ def scan_files(libs_and_bins, cmd_max_args):
scanned_files = {} # {bits: {soname: (filename, needed), ...}, ...}
for line in scan(['-nBF', '%F %f %S %n %M'], libs_and_bins, cmd_max_args):
- filename, sfilename, soname, needed, bits = line.split(' ')
+ parts = line.split(' ')
+ if len(parts) < 5:
+ print("scan_files(); error processing lib: %s" % line)
+ print("scan_files(); parts = %s" % str(parts))
+ continue
+ filename, sfilename, soname, needed, bits = parts
filename = os.path.realpath(filename)
needed = needed.split(',')
bits = bits[8:] # 8: -> strlen('ELFCLASS')
diff --git a/pym/gentoolkit/revdep_rebuild/stuff.py b/pym/gentoolkit/revdep_rebuild/stuff.py
index 0bebce2..aa91be2 100644
--- a/pym/gentoolkit/revdep_rebuild/stuff.py
+++ b/pym/gentoolkit/revdep_rebuild/stuff.py
@@ -38,8 +38,11 @@ def scan(params, files, max_args):
'''
out = []
for i in range(0, len(files), max_args):
- out += call_program(
+ output = call_program(
['scanelf'] + params + files[i:i+max_args]).strip().split('\n')
+ output = [x for x in output if x != '']
+ if output:
+ out.extend(output)
return out