1 |
commit: cfeb731d0dc40988cf11f6c225e7082f563d5b18 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 11 07:26:27 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Tue Feb 11 08:08:38 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=cfeb731d |
7 |
|
8 |
revdep_rebuild/analyse.py: Fix the bug that caused some breakage to not be detected. |
9 |
|
10 |
scan_files() was not tracking the filenames and needed correctly. |
11 |
This was causing data loss for files that need to be checked. |
12 |
I found there could be several filenames for any given soname. |
13 |
Each filename has a set of needed libs to track. |
14 |
find_broken2 and main_checks2 needed updating for the different scanned_files structure. |
15 |
|
16 |
--- |
17 |
pym/gentoolkit/revdep_rebuild/analyse.py | 50 ++++++++++++++++++++------------ |
18 |
1 file changed, 31 insertions(+), 19 deletions(-) |
19 |
|
20 |
diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py |
21 |
index e2e1edd..131849b 100644 |
22 |
--- a/pym/gentoolkit/revdep_rebuild/analyse.py |
23 |
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py |
24 |
@@ -32,11 +32,17 @@ def scan_files(libs_and_bins, cmd_max_args): |
25 |
if not soname: |
26 |
soname = sfilename |
27 |
|
28 |
- try: |
29 |
- scanned_files[bits][soname] = (filename, needed) |
30 |
- except KeyError: |
31 |
+ if bits not in scanned_files: |
32 |
scanned_files[bits] = {} |
33 |
- scanned_files[bits][soname] = (filename, needed) |
34 |
+ if soname not in scanned_files[bits]: |
35 |
+ scanned_files[bits][soname] = {} |
36 |
+ if filename not in scanned_files[bits][soname]: |
37 |
+ scanned_files[bits][soname][filename] = set(needed) |
38 |
+ else: |
39 |
+ scanned_files[bits][soname][filename].update(needed) |
40 |
+ |
41 |
+ #print("scanned_files['64'] =") |
42 |
+ #print(scanned_files['64']) |
43 |
return scanned_files |
44 |
|
45 |
|
46 |
@@ -91,18 +97,22 @@ def extract_dependencies_from_la(la, libraries, to_check, logger): |
47 |
def find_broken2(scanned_files, logger): |
48 |
broken_libs = {} |
49 |
for bits, libs in scanned_files.items(): |
50 |
- logger.debug('Checking for bits: %s' % bits) |
51 |
- alllibs = '|'.join(libs.keys()) + '|' |
52 |
- for soname, needed in libs.items(): |
53 |
- for l in needed[1]: |
54 |
- if not l+'|' in alllibs: |
55 |
- try: |
56 |
- broken_libs[bits][l].add(soname) |
57 |
- except KeyError: |
58 |
+ logger.debug('find_broken2(), Checking for %s bit libs' % bits) |
59 |
+ alllibs = '|'.join(sorted(libs)) + '|' |
60 |
+ #print(alllibs) |
61 |
+ #print() |
62 |
+ for soname, filepaths in libs.items(): |
63 |
+ for filename, needed in filepaths.items(): |
64 |
+ for l in needed: |
65 |
+ if l+'|' not in alllibs: |
66 |
try: |
67 |
- broken_libs[bits][l] = set([soname]) |
68 |
+ broken_libs[bits][l].add(soname) |
69 |
except KeyError: |
70 |
- broken_libs = {bits: {l: set([soname])}} |
71 |
+ try: |
72 |
+ broken_libs[bits][l] = set([soname]) |
73 |
+ except KeyError: |
74 |
+ broken_libs = {bits: {l: set([soname])}} |
75 |
+ #print("BROKEN:", soname, l) |
76 |
|
77 |
return broken_libs |
78 |
|
79 |
@@ -110,12 +120,14 @@ def find_broken2(scanned_files, logger): |
80 |
def main_checks2(broken, scanned_files, logger): |
81 |
broken_pathes = [] |
82 |
for bits, _broken in broken.items(): |
83 |
- for soname, needed in _broken.items(): |
84 |
- logger.info('Broken files that requires: %s (%s bits)' % (bold(soname), bits)) |
85 |
+ for lib, needed in _broken.items(): |
86 |
+ #print("lib, needed:", lib, needed) |
87 |
+ logger.info('Broken files that requires: %s (%s bits)' % (bold(lib), bits)) |
88 |
for n in needed: |
89 |
- fp = scanned_files[bits][n][0] |
90 |
- logger.info(yellow(' * ') + n + ' (' + fp + ')') |
91 |
- broken_pathes.append(fp) |
92 |
+ #print(sorted(needed)) |
93 |
+ for fp in sorted(scanned_files[bits][n]): |
94 |
+ logger.info(yellow(' * ') + n + ' (' + fp + ')') |
95 |
+ broken_pathes.append(fp) |
96 |
return broken_pathes |