Exemplo n.º 1
0
def copr_module_raw(copr, id):
    module = ModulesLogic.get(id).first()
    response = flask.make_response(module.yaml)
    response.mimetype = "text/plain"
    response.headers["Content-Disposition"] = \
        "filename={}.yaml".format("-".join([str(module.id), module.name, module.version, module.release]))
    return response
Exemplo n.º 2
0
def copr_module(copr, id):
    module = ModulesLogic.get(id).first()
    formatter = HtmlFormatter(style="autumn", linenos=False, noclasses=True)
    pretty_yaml = highlight(module.yaml, get_lexer_by_name("YAML"), formatter)
    return flask.render_template("coprs/detail/module.html",
                                 copr=copr,
                                 module=module,
                                 yaml=pretty_yaml)
Exemplo n.º 3
0
def render_generate_module_repo_file(copr, name_release, module_nsv):
    module = ModulesLogic.get_by_nsv_str(copr, module_nsv).one()
    mock_chroot = coprs_logic.MockChrootsLogic.get_from_name(
        name_release, noarch=True).first()
    url = os.path.join(copr.main_dir.repo_url, '')  # adds trailing slash
    repo_url = generate_repo_url(mock_chroot, copr.modules_url)
    baseurl = "{}+{}/latest/$basearch".format(repo_url.rstrip("/"), module_nsv)
    pubkey_url = urljoin(url, "pubkey.gpg")
    response = flask.make_response(
        flask.render_template("coprs/copr-modules.cfg",
                              copr=copr,
                              module=module,
                              baseurl=baseurl,
                              pubkey_url=pubkey_url))
    response.mimetype = "text/plain"
    response.headers["Content-Disposition"] = \
        "filename={0}.cfg".format(copr.repo_name)
    return response
Exemplo n.º 4
0
def copr_module(copr, id):
    module = ModulesLogic.get(id).first()
    formatter = HtmlFormatter(style="autumn", linenos=False, noclasses=True)
    pretty_yaml = highlight(module.yaml, get_lexer_by_name("YAML"), formatter)

    # Get the list of chroots with unique name_release attribute
    # Once we use jinja in 2.10 version, we can simply use
    # {{ copr.active_chroots |unique(attribute='name_release') }}
    unique_chroots = []
    unique_name_releases = set()
    for chroot in copr.active_chroots_sorted:
        if chroot.name_release in unique_name_releases:
            continue
        unique_chroots.append(chroot)
        unique_name_releases.add(chroot.name_release)

    return flask.render_template("coprs/detail/module.html",
                                 copr=copr,
                                 module=module,
                                 yaml=pretty_yaml,
                                 unique_chroots=unique_chroots)
Exemplo n.º 5
0
def render_copr_modules(copr):
    query = ModulesLogic.get_multiple_by_copr(copr=copr)
    return flask.render_template("coprs/detail/modules.html",
                                 copr=copr,
                                 modules=query)