aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2014-02-10 19:34:45 -0800
committerBrian Dolbec <dolsen@gentoo.org>2014-02-11 00:08:06 -0800
commit1ef7ee6bde1b12946471db650f27d0b0de9226e5 (patch)
tree28d8f2c73e0d994fa9500a9c7c2297ba251373e0
parentrevdep_rebuild: Remove duplicate files for the scanelf checks. (diff)
downloadgentoolkit-1ef7ee6bde1b12946471db650f27d0b0de9226e5.tar.gz
gentoolkit-1ef7ee6bde1b12946471db650f27d0b0de9226e5.tar.bz2
gentoolkit-1ef7ee6bde1b12946471db650f27d0b0de9226e5.zip
revdep_rebuild/analyse.py: Remove unused or commented out code
-rw-r--r--pym/gentoolkit/revdep_rebuild/analyse.py132
1 files changed, 0 insertions, 132 deletions
diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py
index 9cee906..e2e1edd 100644
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@ -16,43 +16,6 @@ from .assign import assign_packages
from .cache import save_cache
-def prepare_checks(files_to_check, libraries, bits, cmd_max_args):
- ''' Calls scanelf for all files_to_check,
- then returns found libraries and dependencies
- '''
-
- # libs found by scanelf
- libs = []
- # list of lists of files (from file_to_check) that uses
- # library (for dependencies[id] and libs[id] => id==id)
- dependencies = []
-
- bits = []
-
-
-# from runner import ScanRunner
-# sr = ScanRunner(['-M', str(bits), '-nBF', '%F %n'], files_to_check, cmd_max_args)
-# sr.wait()
-
- for line in scan(['-M', str(bits), '-nBF', '%F %n %M'], files_to_check, cmd_max_args):
- #call_program(['scanelf', '-M', str(bits), '-nBF', '%F %n',]+files_to_check).strip().split('\n'):
- r = line.strip().split(' ')
- if len(r) < 2: # no dependencies?
- continue
-
- deps = r[1].split(',')
- for d in deps:
- if d in libs:
- i = libs.index(d)
- dependencies[i].append(r[0])
- else:
- #print d, 'bits:', r[2][8:] # 8: -> strlen('ELFCLASS')
- libs.append(d)
- dependencies.append([r[0],])
-
- return (libs, dependencies)
-
-
def scan_files(libs_and_bins, cmd_max_args):
scanned_files = {} # {bits: {soname: (filename, needed), ...}, ...}
@@ -125,32 +88,6 @@ def extract_dependencies_from_la(la, libraries, to_check, logger):
return broken
-def find_broken(found_libs, system_libraries, to_check):
- ''' Search for broken libraries.
- Check if system_libraries contains found_libs, where
- system_libraries is list of obsolute pathes and found_libs
- is list of library names.
- '''
-
- # join libraries and looking at it as string
- # is way faster than for-jumping
-
- broken = []
- syslibs = '|'.join(system_libraries)
-
- if not to_check:
- for found in found_libs:
- if found + '|' not in syslibs:
- broken.append(found_libs.index(found))
- else:
- for tc in to_check:
- for found in found_libs:
- if tc in found:# and found+'|' not in syslibs:
- broken.append(found_libs.index(found))
-
- return broken
-
-
def find_broken2(scanned_files, logger):
broken_libs = {}
for bits, libs in scanned_files.items():
@@ -170,24 +107,6 @@ def find_broken2(scanned_files, logger):
return broken_libs
-def main_checks(found_libs, broken_list, dependencies, logger):
- ''' Checks for broken dependencies.
- found_libs have to be the same as returned by prepare_checks
- broken_list is list of libraries found by scanelf
- dependencies is the value returned by prepare_checks
- '''
-
- broken_pathes = []
-
- for broken in broken_list:
- found = found_libs[broken]
- logger.info('Broken files that requires: ' + bold(found))
- for dep_path in dependencies[broken]:
- logger.info(yellow(' * ') + dep_path)
- broken_pathes.append(dep_path)
- return broken_pathes
-
-
def main_checks2(broken, scanned_files, logger):
broken_pathes = []
for bits, _broken in broken.items():
@@ -275,57 +194,6 @@ def analyse(settings, logger, libraries=None, la_libraries=None,
return assign_packages(broken_pathes, logger, settings)
- #import sys
- #sys.exit()
-
- #l = []
- #for line in call_program(['scanelf', '-M', '64', '-BF', '%F',] + libraries).strip().split('\n'):
- #l.append(line)
- #libraries = l
-
- ## old version from here
- #found_libs = []
- #dependencies = []
-
- #if _libs_to_check:
- #nltc = []
- #for ltc in _libs_to_check:
- #if os.path.isfile(ltc):
- #ltc = scan(['-nBSF', '%S'], [ltc,], settings['CMD_MAX_ARGS'])[0].split()[0]
- #nltc += [ltc,]
- #_libs_to_check = nltc
-
- #_bits, linkg = platform.architecture()
- #if _bits.startswith('32'):
- #bits = 32
- #elif _bits.startswith('64'):
- #bits = 64
-
- #import time
- #broken = []
- #for av_bits in glob.glob('/lib[0-9]*') or ('/lib32',):
- #bits = int(av_bits[4:])
-
- ##_libraries = scan(['-M', str(bits), '-BF', '%F'], libraries+libraries_links, settings['CMD_MAX_ARGS'])
- #_libraries = libraries+libraries_links
-
- #found_libs, dependencies = prepare_checks(libs_and_bins, _libraries, bits, settings['CMD_MAX_ARGS'])
- #broken = find_broken(found_libs, _libraries, _libs_to_check)
-
- #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
-
- #logger.warn(green(' * ') + bold('Assign files to packages'))
-
- #return assign_packages(broken_pathes, logger, settings)
-
-
if __name__ == '__main__':
print("This script shouldn't be called directly")