1 |
commit: 1ef7ee6bde1b12946471db650f27d0b0de9226e5 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 11 03:34:45 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Tue Feb 11 08:08:06 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=1ef7ee6b |
7 |
|
8 |
revdep_rebuild/analyse.py: Remove unused or commented out code |
9 |
|
10 |
--- |
11 |
pym/gentoolkit/revdep_rebuild/analyse.py | 132 ------------------------------- |
12 |
1 file changed, 132 deletions(-) |
13 |
|
14 |
diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py |
15 |
index 9cee906..e2e1edd 100644 |
16 |
--- a/pym/gentoolkit/revdep_rebuild/analyse.py |
17 |
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py |
18 |
@@ -16,43 +16,6 @@ from .assign import assign_packages |
19 |
from .cache import save_cache |
20 |
|
21 |
|
22 |
-def prepare_checks(files_to_check, libraries, bits, cmd_max_args): |
23 |
- ''' Calls scanelf for all files_to_check, |
24 |
- then returns found libraries and dependencies |
25 |
- ''' |
26 |
- |
27 |
- # libs found by scanelf |
28 |
- libs = [] |
29 |
- # list of lists of files (from file_to_check) that uses |
30 |
- # library (for dependencies[id] and libs[id] => id==id) |
31 |
- dependencies = [] |
32 |
- |
33 |
- bits = [] |
34 |
- |
35 |
- |
36 |
-# from runner import ScanRunner |
37 |
-# sr = ScanRunner(['-M', str(bits), '-nBF', '%F %n'], files_to_check, cmd_max_args) |
38 |
-# sr.wait() |
39 |
- |
40 |
- for line in scan(['-M', str(bits), '-nBF', '%F %n %M'], files_to_check, cmd_max_args): |
41 |
- #call_program(['scanelf', '-M', str(bits), '-nBF', '%F %n',]+files_to_check).strip().split('\n'): |
42 |
- r = line.strip().split(' ') |
43 |
- if len(r) < 2: # no dependencies? |
44 |
- continue |
45 |
- |
46 |
- deps = r[1].split(',') |
47 |
- for d in deps: |
48 |
- if d in libs: |
49 |
- i = libs.index(d) |
50 |
- dependencies[i].append(r[0]) |
51 |
- else: |
52 |
- #print d, 'bits:', r[2][8:] # 8: -> strlen('ELFCLASS') |
53 |
- libs.append(d) |
54 |
- dependencies.append([r[0],]) |
55 |
- |
56 |
- return (libs, dependencies) |
57 |
- |
58 |
- |
59 |
def scan_files(libs_and_bins, cmd_max_args): |
60 |
|
61 |
scanned_files = {} # {bits: {soname: (filename, needed), ...}, ...} |
62 |
@@ -125,32 +88,6 @@ def extract_dependencies_from_la(la, libraries, to_check, logger): |
63 |
return broken |
64 |
|
65 |
|
66 |
-def find_broken(found_libs, system_libraries, to_check): |
67 |
- ''' Search for broken libraries. |
68 |
- Check if system_libraries contains found_libs, where |
69 |
- system_libraries is list of obsolute pathes and found_libs |
70 |
- is list of library names. |
71 |
- ''' |
72 |
- |
73 |
- # join libraries and looking at it as string |
74 |
- # is way faster than for-jumping |
75 |
- |
76 |
- broken = [] |
77 |
- syslibs = '|'.join(system_libraries) |
78 |
- |
79 |
- if not to_check: |
80 |
- for found in found_libs: |
81 |
- if found + '|' not in syslibs: |
82 |
- broken.append(found_libs.index(found)) |
83 |
- else: |
84 |
- for tc in to_check: |
85 |
- for found in found_libs: |
86 |
- if tc in found:# and found+'|' not in syslibs: |
87 |
- broken.append(found_libs.index(found)) |
88 |
- |
89 |
- return broken |
90 |
- |
91 |
- |
92 |
def find_broken2(scanned_files, logger): |
93 |
broken_libs = {} |
94 |
for bits, libs in scanned_files.items(): |
95 |
@@ -170,24 +107,6 @@ def find_broken2(scanned_files, logger): |
96 |
return broken_libs |
97 |
|
98 |
|
99 |
-def main_checks(found_libs, broken_list, dependencies, logger): |
100 |
- ''' Checks for broken dependencies. |
101 |
- found_libs have to be the same as returned by prepare_checks |
102 |
- broken_list is list of libraries found by scanelf |
103 |
- dependencies is the value returned by prepare_checks |
104 |
- ''' |
105 |
- |
106 |
- broken_pathes = [] |
107 |
- |
108 |
- for broken in broken_list: |
109 |
- found = found_libs[broken] |
110 |
- logger.info('Broken files that requires: ' + bold(found)) |
111 |
- for dep_path in dependencies[broken]: |
112 |
- logger.info(yellow(' * ') + dep_path) |
113 |
- broken_pathes.append(dep_path) |
114 |
- return broken_pathes |
115 |
- |
116 |
- |
117 |
def main_checks2(broken, scanned_files, logger): |
118 |
broken_pathes = [] |
119 |
for bits, _broken in broken.items(): |
120 |
@@ -275,57 +194,6 @@ def analyse(settings, logger, libraries=None, la_libraries=None, |
121 |
|
122 |
return assign_packages(broken_pathes, logger, settings) |
123 |
|
124 |
- #import sys |
125 |
- #sys.exit() |
126 |
- |
127 |
- #l = [] |
128 |
- #for line in call_program(['scanelf', '-M', '64', '-BF', '%F',] + libraries).strip().split('\n'): |
129 |
- #l.append(line) |
130 |
- #libraries = l |
131 |
- |
132 |
- ## old version from here |
133 |
- #found_libs = [] |
134 |
- #dependencies = [] |
135 |
- |
136 |
- #if _libs_to_check: |
137 |
- #nltc = [] |
138 |
- #for ltc in _libs_to_check: |
139 |
- #if os.path.isfile(ltc): |
140 |
- #ltc = scan(['-nBSF', '%S'], [ltc,], settings['CMD_MAX_ARGS'])[0].split()[0] |
141 |
- #nltc += [ltc,] |
142 |
- #_libs_to_check = nltc |
143 |
- |
144 |
- #_bits, linkg = platform.architecture() |
145 |
- #if _bits.startswith('32'): |
146 |
- #bits = 32 |
147 |
- #elif _bits.startswith('64'): |
148 |
- #bits = 64 |
149 |
- |
150 |
- #import time |
151 |
- #broken = [] |
152 |
- #for av_bits in glob.glob('/lib[0-9]*') or ('/lib32',): |
153 |
- #bits = int(av_bits[4:]) |
154 |
- |
155 |
- ##_libraries = scan(['-M', str(bits), '-BF', '%F'], libraries+libraries_links, settings['CMD_MAX_ARGS']) |
156 |
- #_libraries = libraries+libraries_links |
157 |
- |
158 |
- #found_libs, dependencies = prepare_checks(libs_and_bins, _libraries, bits, settings['CMD_MAX_ARGS']) |
159 |
- #broken = find_broken(found_libs, _libraries, _libs_to_check) |
160 |
- |
161 |
- #bits /= 2 |
162 |
- #bits = int(bits) |
163 |
- |
164 |
- #broken_la = extract_dependencies_from_la(la_libraries, libraries+libraries_links, _libs_to_check, logger) |
165 |
- |
166 |
- |
167 |
- #broken_pathes = main_checks(found_libs, broken, dependencies, logger) |
168 |
- #broken_pathes += broken_la |
169 |
- |
170 |
- #logger.warn(green(' * ') + bold('Assign files to packages')) |
171 |
- |
172 |
- #return assign_packages(broken_pathes, logger, settings) |
173 |
- |
174 |
- |
175 |
|
176 |
if __name__ == '__main__': |
177 |
print("This script shouldn't be called directly") |