Fixed .la files parser. Some minor logging fixes.
authorSlawek <lis.slawek@gmail.com>
Tue, 26 Apr 2011 07:08:24 +0000 (09:08 +0200)
committerPaul Varner <fuzzyray@gentoo.org>
Tue, 12 Jul 2011 21:29:01 +0000 (16:29 -0500)
pym/gentoolkit/revdep_rebuild/analyse.py
pym/gentoolkit/revdep_rebuild/collect.py
pym/gentoolkit/revdep_rebuild/rebuild.py

index 521d8b9e5a22509a81a67f8ea93b48f693b76f06..be696d14f34276260cd14f1b860920d3ed435caa 100644 (file)
@@ -40,6 +40,15 @@ def prepare_checks(files_to_check, libraries, bits, cmd_max_args):
 
 def extract_dependencies_from_la(la, libraries, to_check, logger):
        broken = []
+
+       libnames = []
+       for l in libraries:
+               m = re.match('.+\/(.+)\.(so|la|a)(\..+)?', l)
+               if m is not None:
+                       ln = m.group(1)
+                       if ln not in libnames:
+                               libnames += [ln, ]
+
        for f in la:
                if not os.path.exists(f):
                        continue
@@ -51,10 +60,12 @@ def extract_dependencies_from_la(la, libraries, to_check, logger):
                                if m is not None:
                                        for el in m.group(1).split(' '):
                                                el = el.strip()
-                                               if len(el) < 1 or el.startswith('-'):
+                                               if len(el) < 1 or el.startswith('-L'):
                                                        continue
 
-                                               if el in la or el in libraries:
+                                               if el.startswith('-l') and 'lib'+el[2:] in libnames:
+                                                       pass
+                                               elif el in la or el in libraries:
                                                        pass
                                                else:
                                                        if to_check:
@@ -66,7 +77,7 @@ def extract_dependencies_from_la(la, libraries, to_check, logger):
                                                                if not _break:
                                                                        continue
 
-                                                       logger.info(yellow(' * ') + f + ' is broken (requires: ' + bold(el))
+                                                       logger.info(yellow(' * ') + f + ' is broken (requires: ' + bold(el)+')')
                                                        broken.append(f)
        return broken
 
@@ -178,13 +189,15 @@ def analyse(settings, logger, libraries=None, la_libraries=None,
                #call_program(['scanelf', '-M', str(bits), '-BF', '%F',] + libraries+libraries_links).strip().split('\n')
 
                found_libs, dependencies = prepare_checks(libs_and_bins, _libraries, bits, settings['CMD_MAX_ARGS'])
-
+               #print dependencies
                broken = find_broken(found_libs, _libraries, _libs_to_check)
-               broken_la = extract_dependencies_from_la(la_libraries, _libraries, _libs_to_check, logger)
 
                bits /= 2
                bits = int(bits)
 
+       broken_la = extract_dependencies_from_la(la_libraries, libraries+libraries_links, _libs_to_check, logger)
+
+
        broken_pathes = main_checks(found_libs, broken, dependencies, logger)
        broken_pathes += broken_la
 
index b408edc103d8fa65d16d11a355e537287903ddd3..b7ed4698296283caf67b36154c160f7d7c4b38a7 100644 (file)
@@ -172,7 +172,7 @@ def collect_libraries_from_dir(dirs, mask, logger):
                                                                        prv & stat.S_IXOTH == stat.S_IXOTH:
                                                                found_files.append(l)
                except Exception as ex:
-                       logger.debug(yellow('Exception during collecting libraries: %s' %str(ex)))
+                       logger.debug(yellow('Exception during collecting libraries: ' + blue('%s')  %str(ex)))
 
 
        if found_directories:
@@ -219,7 +219,7 @@ def collect_binaries_from_dir(dirs, mask, logger):
                                                                prv & stat.S_IXOTH == stat.S_IXOTH:
                                                        found_files.append(l)
                except Exception as e:
-                       logger.debug(yellow('Exception during binaries collecting: %s' %str(e)))
+                       logger.debug(yellow('Exception during binaries collecting: '+blue('%s') %str(e)))
 
        if found_directories:
                found_files += collect_binaries_from_dir(found_directories, mask, logger)
@@ -240,7 +240,7 @@ if __name__ == '__main__':
        libraries, la_libraries, libraries_links, symlink_pairs = collect_libraries_from_dir(lib_dirs, masked_dirs, logging)
        binaries = collect_binaries_from_dir(bin_dirs, masked_dirs, logging)
 
-       print 'Found: %i binaries and %i libraries.' %(len(binaries), len(libraries))
+       logging.debug('Found: %i binaries and %i libraries.' %(len(binaries), len(libraries)))
 
 
 
index ef3a476c63040ecee67867daf85d0676f0bf37bd..f77d98cfe3ebfe0a1efc4af12a7564a761d5da82 100644 (file)
@@ -32,7 +32,7 @@ from settings import DEFAULTS
 
 
 APP_NAME = sys.argv[0]
-VERSION = '0.1-r6'
+VERSION = '0.1-r7'
 
 __productname__ = "revdep-ng"
 
@@ -232,5 +232,5 @@ def main(settings=None, logger=None):
                        'again or manually emerge given packages.')
 
        success = rebuild(logger, assigned, settings)
-       logger.debug("rebuild return code =", success)
+       logger.debug("rebuild return code = %i" %success)
        return success