1 |
commit: d9f4c8c06b9536de14d5b0d88c32957755df6108 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 11 18:24:16 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Tue Feb 11 18:24:16 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=d9f4c8c0 |
7 |
|
8 |
revdep_rebuild: Add logger parameter to scan_files(), scan() |
9 |
|
10 |
Convert earlier debug print()s to logging. |
11 |
|
12 |
--- |
13 |
pym/gentoolkit/revdep_rebuild/analyse.py | 13 ++++++------- |
14 |
pym/gentoolkit/revdep_rebuild/stuff.py | 8 ++++---- |
15 |
2 files changed, 10 insertions(+), 11 deletions(-) |
16 |
|
17 |
diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py |
18 |
index c416c3c..c774d9f 100644 |
19 |
--- a/pym/gentoolkit/revdep_rebuild/analyse.py |
20 |
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py |
21 |
@@ -16,14 +16,15 @@ from .assign import assign_packages |
22 |
from .cache import save_cache |
23 |
|
24 |
|
25 |
-def scan_files(libs_and_bins, cmd_max_args): |
26 |
+def scan_files(libs_and_bins, cmd_max_args, logger): |
27 |
|
28 |
scanned_files = {} # {bits: {soname: (filename, needed), ...}, ...} |
29 |
- for line in scan(['-nBF', '%F %f %S %n %M'], libs_and_bins, cmd_max_args): |
30 |
+ for line in scan(['-nBF', '%F %f %S %n %M'], |
31 |
+ libs_and_bins, cmd_max_args, logger): |
32 |
parts = line.split(' ') |
33 |
if len(parts) < 5: |
34 |
- print("scan_files(); error processing lib: %s" % line) |
35 |
- print("scan_files(); parts = %s" % str(parts)) |
36 |
+ logger.error("scan_files(); error processing lib: %s" % line) |
37 |
+ logger.error("scan_files(); parts = %s" % str(parts)) |
38 |
continue |
39 |
filename, sfilename, soname, needed, bits = parts |
40 |
filename = os.path.realpath(filename) |
41 |
@@ -41,8 +42,6 @@ def scan_files(libs_and_bins, cmd_max_args): |
42 |
else: |
43 |
scanned_files[bits][soname][filename].update(needed) |
44 |
|
45 |
- #print("scanned_files['64'] =") |
46 |
- #print(scanned_files['64']) |
47 |
return scanned_files |
48 |
|
49 |
|
50 |
@@ -184,7 +183,7 @@ def analyse(settings, logger, libraries=None, la_libraries=None, |
51 |
|
52 |
libs_and_bins = set(libraries + binaries) |
53 |
|
54 |
- scanned_files = scan_files(libs_and_bins, settings['CMD_MAX_ARGS']) |
55 |
+ scanned_files = scan_files(libs_and_bins, settings['CMD_MAX_ARGS'], logger) |
56 |
|
57 |
logger.warn(green(' * ') + bold('Checking dynamic linking consistency')) |
58 |
logger.debug('analyse(), Searching for %i libs, bins within %i libraries and links' % |
59 |
|
60 |
diff --git a/pym/gentoolkit/revdep_rebuild/stuff.py b/pym/gentoolkit/revdep_rebuild/stuff.py |
61 |
index 7f8c574..0608702 100644 |
62 |
--- a/pym/gentoolkit/revdep_rebuild/stuff.py |
63 |
+++ b/pym/gentoolkit/revdep_rebuild/stuff.py |
64 |
@@ -24,7 +24,7 @@ def call_program(args): |
65 |
return str(stdout) |
66 |
|
67 |
|
68 |
-def scan(params, files, max_args): |
69 |
+def scan(params, files, max_args, logger): |
70 |
''' Calls scanelf with given params and files to scan. |
71 |
@param params is list of parameters that should |
72 |
be passed into scanelf app. |
73 |
@@ -36,8 +36,8 @@ def scan(params, files, max_args): |
74 |
|
75 |
@return scanelf output (joined if was called several times) |
76 |
''' |
77 |
- #print("SCAN(), params = ", params, len(files)) |
78 |
- # change it to a list for group processing |
79 |
+ logger.debug(" scan(), scanelf params = %s, # files: %d" % (params, len(files))) |
80 |
+ # change it to a sorted list for group processing |
81 |
_files = sorted(files) |
82 |
out = [] |
83 |
for i in range(0, len(_files), max_args): |
84 |
@@ -46,7 +46,7 @@ def scan(params, files, max_args): |
85 |
output = [x for x in output if x != ''] |
86 |
if output: |
87 |
out.extend(output) |
88 |
- #print("SCAN(), final output length:", len(out)) |
89 |
+ logger.debug(" scan(), final output length: %d" % len(out)) |
90 |
return out |