From: Slawek Date: Tue, 26 Apr 2011 07:08:24 +0000 (+0200) Subject: Fixed .la files parser. Some minor logging fixes. X-Git-Tag: gentoolkit-0.3.0.5~38 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8d6b825b2d8e5eb69568619223721ae5c7e0aa07;p=gentoolkit.git Fixed .la files parser. Some minor logging fixes. --- diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py index 521d8b9..be696d1 100644 --- a/pym/gentoolkit/revdep_rebuild/analyse.py +++ b/pym/gentoolkit/revdep_rebuild/analyse.py @@ -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 diff --git a/pym/gentoolkit/revdep_rebuild/collect.py b/pym/gentoolkit/revdep_rebuild/collect.py index b408edc..b7ed469 100644 --- a/pym/gentoolkit/revdep_rebuild/collect.py +++ b/pym/gentoolkit/revdep_rebuild/collect.py @@ -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))) diff --git a/pym/gentoolkit/revdep_rebuild/rebuild.py b/pym/gentoolkit/revdep_rebuild/rebuild.py index ef3a476..f77d98c 100644 --- a/pym/gentoolkit/revdep_rebuild/rebuild.py +++ b/pym/gentoolkit/revdep_rebuild/rebuild.py @@ -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