{% from "_helpers.html" import render_field, render_form_errors, copr_url, render_pypi_python_versions_field, render_additional_build_options, render_srpm_build_method_box with context %} {% from "coprs/detail/_method_forms.html" import copr_method_form_fileds_custom %} {# This file contains forms for the "New Build" action General Form Helpers: (contain everything except build source) - copr_build_form_begin - copr_build_form_end Specific Forms: (contain only build source) - copr_build_form_url - copr_build_form_upload One Button Forms: - copr_build_repeat_form - copr_build_cancel_form - copr_build_delete_form How to create a Specific Form: 1. include copr_build_form_begin 2. render all the fields that specify the build source 3. include copr_build_form_end #} {##### GENERAL FORM HELPERS #####} {% macro copr_build_form_begin(form, view, copr, build=None, hide_panels=False) %} {{ render_form_errors(form) }}
{% if not hide_panels %}

{{ counter('instructions') }}. Provide the source

{% endif %} {% endmacro %} {% macro copr_build_form_end(form, view, copr, hide_panels=False) %} {% if not hide_panels %}

{{ counter('instructions') }}. Select chroots and other options

{% endif %} {{ render_additional_build_options(form, copr) }} {% if not hide_panels %}
{% endif %}

You agree to build only allowed content in Copr. Check if your license is allowed.

{% endmacro %} {% macro source_description(description) %}
{{ description | safe }}
{% endmacro %} {##### SPECIFIC FORMS #####} {% macro copr_build_form_url(form, view, copr) %} {{ copr_build_form_begin(form, view, copr) }} {{ source_description('Please upload your SRPM or .spec files on a public server and provide link(s) to the form below. This is the only option to submit more builds at once.')}} {{ render_field(form.pkgs, label='URLs to files', rows = 10, cols = 50) }} {{ copr_build_form_end(form, view, copr) }} {% endmacro %} {% macro copr_build_form_upload(form, view, copr) %} {{ copr_build_form_begin(form, view, copr) }} {{ source_description("Upload your SRPM or .spec directly to Copr.")}}
{{ form.pkgs }}
{{ copr_build_form_end(form, view, copr) }} {% endmacro %} {% macro copr_build_form_scm(form, view, copr) %} {{ copr_build_form_begin(form, view, copr) }} {{ source_description('Build from Git or SVN repository. Please provide the Git or SVN URL.')}} {{ render_field(form.scm_type) }} {{ render_field(form.clone_url, placeholder="URL to your Git or SVN repository.") }} {{ render_field(form.committish, placeholder="Optional - Specific branch, tag, or commit that you want to build.") }} {{ render_field(form.subdirectory, placeholder="Optional - Subdirectory where source files and .spec are located.") }} {{ render_field(form.spec, placeholder="Optional - Path to your .spec file under the specified subdirectory.") }} {{ render_srpm_build_method_box(form) }} {{ copr_build_form_end(form, view, copr) }} {% endmacro %} {% macro copr_build_form_distgit(form, view, copr) %} {{ copr_build_form_begin(form, view, copr) }} {{ source_description('Build package from a ' 'DistGit' ' repository' )}} {{ render_field(form.package_name) }} {{ render_field(form.distgit) }} {{ render_field(form.committish) }} {{ render_field(form.namespace) }} {{ copr_build_form_end(form, view, copr) }} {% endmacro %} {% macro copr_build_form_pypi(form, view, copr) %} {{ copr_build_form_begin(form, view, copr) }} {{ source_description( 'This method uses ' 'pyp2rpm ' 'or pyp2spec ' 'to create the RPM for you automatically from PyPI - ' 'the Python Package Index. Please provide the package name.' ) }} {{ render_field(form.pypi_package_name, placeholder="Package name in the Python Package Index.") }} {{ render_field(form.pypi_package_version, placeholder="Optional - Version of the package PyPI") }} {{ render_field( form.spec_generator, info="Tool for generating specfile from a PyPI package. The options " "are full-featured pyp2rpm with cross " "distribution support, and pyp2spec that is " "being actively developed and considered to be the future." ) }} {# End the previous instructions box #}

{{ counter('instructions') }}. Options specific for pyp2rpm

{{ render_field( form.spec_template, placeholder="Distribution specific spec template", info="Limited to pyp2rpm spec generator") }} {{ render_pypi_python_versions_field(form.python_versions) }} {{ copr_build_form_end(form, view, copr) }} {% endmacro %} {% macro copr_build_form_rubygems(form, view, copr) %} {{ copr_build_form_begin(form, view, copr) }} {{ source_description('This method uses gem2rpm to create the RPM for you automatically from RubyGems.org. Please provide the gem name.')}} {{ render_field(form.gem_name, placeholder="Gem name from RubyGems.org") }} {{ copr_build_form_end(form, view, copr) }} {% endmacro %} {% macro copr_build_form_custom(form, view, copr) %} {{ copr_build_form_begin(form, view, copr) }} {{ source_description('Provide custom script to build sources.')}} {{ copr_method_form_fileds_custom(form) }} {{ copr_build_form_end(form, view, copr) }} {% endmacro %} {% macro copr_build_form_rebuild(form, view, copr, build, allow_user_ssh) %} {{ copr_build_form_begin(form, view, copr, build, hide_panels=True) }} {% if allow_user_ssh %}

SSH access to the builder

{{ render_field(form.ssh_public_keys, label='Public SSH keys', placeholder='Newline separated public SSH keys, e.g. ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDR+QU9...', rows=8, cols=50) }} {% endif %}

New Build Options

{{ copr_build_form_end(form, view, copr, hide_panels=True) }} {% endmacro %} {% macro copr_build_cancel_form(build, page, class="") %} {% if build.cancelable %}
{% endif %} {% endmacro %} {% macro copr_build_repeat_form(build, page, class="") %}
{% endmacro %} {# TODO Refactor, all of the forms are the same #} {% macro copr_resubmit_allow_user_ssh_form(build, page, class="") %}
{% endmacro %} {% macro copr_build_delete_form(build, page, class="") %}
{% endmacro %} {% macro copr_delete_builds(copr, class="") %} {% endmacro %}