Exemplo n.º 1
0
def mirror_repos(mirror_dir, gerrit_url):
    """Updates repository mirrors

    This function creates a multiprocessing pool that will parallelize the
    repo mirroring process. It will create as many worker threads as there are
    cpus on the system.

    Arguments:

        :arg str mirror_dir: Path to directory containing repos.
        :arg str gerrit_url: URL to the Gerrit server. Used for cloning repos.
    """
    log.info('Updating git mirrors.')
    gerrit = GerritHandler(gerrit_url)
    projects = gerrit.projects_list()

    pool = Pool()
    jobs = [(project, mirror_dir, gerrit_url) for project in projects]
    pool.map(update_repo_parallel, jobs)
    pool.close()
    pool.join()
Exemplo n.º 2
0
def mirror_repos(mirror_dir, gerrit_url):
    """Updates repository mirrors

    This function creates a multiprocessing pool that will parallelize the
    repo mirroring process. It will create as many worker threads as there are
    cpus on the system.

    Arguments:

        :arg str mirror_dir: Path to directory containing repos.
        :arg str gerrit_url: URL to the Gerrit server. Used for cloning repos.
    """
    log.info('Updating git mirrors.')
    gerrit = GerritHandler(gerrit_url)
    projects = gerrit.projects_list()

    pool = Pool()
    jobs = [(project, mirror_dir, gerrit_url) for project in projects]
    pool.map(update_repo_parallel, jobs)
    pool.close()
    pool.join()
Exemplo n.º 3
0
def projects():
    """Returns a list of projects by querying Gerrit.

    GET /gerrit/projects

    JSON::

        {
          "projects": [
            "groupbasedpolicy",
            "spectrometer",
            "releng/autorelease",
            "snmp4sdn",
            "ovsdb",
            "nemo",
            ...
            ]
        }
    """
    gerrit = GerritHandler(app.config['GERRIT_URL'])
    return jsonify({'projects': gerrit.projects_list()})
Exemplo n.º 4
0
def projects():
    """Returns a list of projects by querying Gerrit.

    GET /gerrit/projects

    JSON::

        {
          "projects": [
            "groupbasedpolicy",
            "spectrometer",
            "releng/autorelease",
            "snmp4sdn",
            "ovsdb",
            "nemo",
            ...
            ]
        }
    """
    gerrit = GerritHandler(app.config['GERRIT_URL'])
    return jsonify({'projects': gerrit.projects_list()})