예제 #1
0
def process(args):

    fs = abdt_fs.make_default_accessor()

    exit_code = 0

    for repo in fs.repo_config_path_list():
        parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
        abdi_repoargs.setup_parser(parser)

        with open(repo) as f:
            repo_params = parser.parse_args(
                line.strip() for line in f)

        if not os.path.isdir(repo_params.repo_path):
            print "'{}' is missing repo '{}'".format(
                repo, repo_params.repo_path)
            if args.fix:
                repo_url = abdi_repoargs.get_repo_url(repo_params)
                print "cloning '{}' ..".format(repo_url)
                abdi_repo.setup_repo(repo_url, repo_params.repo_path)
            else:
                exit_code = 1

    if exit_code != 0 and not args.fix:
        print "use '--fix' to attempt to fix the issues"

    return exit_code
예제 #2
0
def _check_repo_cloned(args, repo_name, repo_config):
    """Return False if the supplied repo isn't cloned or fixed.

    Will print details of errors found. Will continue when errors are found,
    unless they interfere with the operation of fsck.

    :args: argeparse arguments to arcyd fsck
    :repo_name: string name of the repository
    :repo_config: argparse namespace of the repo's config
    :returns: True or False

    """
    all_ok = True
    if not os.path.isdir(repo_config.repo_path):
        print("'{}' is missing repo '{}'".format(
            repo_name, repo_config.repo_path))
        if args.fix:
            repo_url = abdi_repoargs.get_repo_url(repo_config)
            repo_push_url = abdi_repoargs.get_repo_push_url(repo_config)
            print("cloning '{}' ..".format(repo_url))
            abdi_repo.setup_repo(
                repo_url, repo_config.repo_path, repo_push_url)
        else:
            all_ok = False

    return all_ok
예제 #3
0
def process(args):

    fs = abdt_fs.make_default_accessor()

    exit_code = 0

    with fs.lockfile_context():
        for repo in fs.repo_config_path_list():
            parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
            abdi_repoargs.setup_parser(parser)

            with open(repo) as f:
                repo_params = parser.parse_args(
                    line.strip() for line in f)

            if not os.path.isdir(repo_params.repo_path):
                print "'{}' is missing repo '{}'".format(
                    repo, repo_params.repo_path)
                if args.fix:
                    repo_url = abdi_repoargs.get_repo_url(repo_params)
                    print "cloning '{}' ..".format(repo_url)
                    abdi_repo.setup_repo(repo_url, repo_params.repo_path)
                else:
                    exit_code = 1
            else:
                is_ignoring = phlgitx_ignoreident.is_repo_definitely_ignoring
                if not is_ignoring(repo_params.repo_path):
                    print "'{}' is not ignoring ident attributes".format(
                        repo_params.repo_path)
                    if args.fix:
                        print "setting {} to ignore ident ..".format(
                            repo_params.repo_path)

                        phlgitx_ignoreident.ensure_repo_ignoring(
                            repo_params.repo_path)
                    else:
                        exit_code = 1

    if exit_code != 0 and not args.fix:
        print "use '--fix' to attempt to fix the issues"

    return exit_code