Exemplo n.º 1
0
def list_unprocessed(test_dir, test_data, options):
    repo_roots_file = os.path.join(test_dir, 'repo_roots.json')
    if not os.path.exists(repo_roots_file):
        print(f'Cannot proceed - {repo_roots_file} does not exist')
    repo_roots = simur.load_json_data(repo_roots_file)
    root_lists = repo_roots.values()
    root_paths = [item for sub_list in root_lists for item in sub_list]

    test_data = sorted(test_data)
    this_dir = os.getcwd()
    output_file = os.path.join(this_dir, 'suspects.list')
    with open(output_file, 'w') as fp:
        for root in root_paths:
            root_end = len(root)
            fp.write(f'VCS root {root}:\n')
            triggered = False
            for data in test_data:
                if data.startswith(root):
                    data_next = data[root_end]
                    # Is it really the same? E.g ide vs ide_build
                    if data_next == '\\' or data_next == '/':
                        fp.write(f'{data}\n')
                        triggered = True
            if not triggered:
                fp.write('- OK -\n')
            fp.write('\n')
    print(f'Saved {output_file} with potentially missing files')
Exemplo n.º 2
0
def main():
    '''
    Update the all the current repos off-line.  It can be tedious if vcget
    should do all the clone:ing and pull:ing while a debugger is running
    '''
    presoak_file = simur.get_presoak_file()
    if not os.path.exists(presoak_file):
        print(f'No presoak file found ({presoak_file})')
        return 0

    presoak = simur.load_json_data(presoak_file)
    if not presoak:  # You may get an empty dictionary
        print(f'No presoak information found in {presoak_file}')
        return 0

    # Remove the error report file to get current status
    reportfile = simur.get_presoak_report_file()
    if os.path.exists(reportfile):
        os.remove(reportfile)

    print(f'Processing {presoak_file}')
    for directory in presoak.keys():
        print(f'Looking at {directory}')
        if presoak[directory] == 'presoak':
            print(f'  Cloning {directory}')
        else:
            print(f'  Already cloned: {directory}')
        git_dir = simur.find_and_update_git_cache(directory)
        print(f'  Updated, git dir {git_dir}')

    return 0
Exemplo n.º 3
0
def update_presoak_file(vcs_data):
    presoak_file = simur.get_presoak_file()
    data = simur.load_json_data(presoak_file)

    for file in vcs_data:
        what = vcs_data[file]
        if what['vcs'] == 'git':
            remote = what['remote']
            if remote:
                if not remote in data:
                    data[remote] = 'presoak'

    simur.store_json_data(presoak_file, data)
Exemplo n.º 4
0
def accumulate_processed(options):
    '''
    Look up all files ending with VCS_CACHE_PATTERN ('.simur.json')
    take out the contents and put in vcs_imports dictionary
    '''
    vcs_imports = {}
    caching_files = []
    roots = options.processed_dir.split(';')

    for the_dir in roots:
        simur_files = list_all_files(the_dir, simur.VCS_CACHE_PATTERN)
        caching_files.extend(simur_files)

    for cache_file in caching_files:
        if options.verbose:
            print(f'Take vcs exports from {cache_file}')
        in_data = simur.load_json_data(cache_file)
        vcs_imports.update(in_data)

    return vcs_imports
Exemplo n.º 5
0
def merge_vcs_data(vcs_cache, lib_data_file):
    lib_data = simur.load_json_data(lib_data_file)
    # Should we check if we overwrite anything?  But how do we know which one is
    # correct when getting data from a static library
    vcs_cache.update(lib_data)