#853 allow to build using --forcearch
Merged 4 years ago by praiskup. Opened 4 years ago by dturecek.
copr/ dturecek/copr allow-forcearch  into  master

@@ -0,0 +1,20 @@ 

+ """

+ add comment to mock_chroot table

+ 

+ Revision ID: 6800e08934eb

+ Revises: 12abab545d7a

+ Create Date: 2019-07-30 08:49:53.205823

+ """

+ 

+ import sqlalchemy as sa

+ from alembic import op

+ 

+ 

+ revision = '6800e08934eb'

+ down_revision = '12abab545d7a'

+ 

+ def upgrade():

+     op.add_column('mock_chroot', sa.Column('comment', sa.Text, nullable=True))

+ 

+ def downgrade():

+     op.drop_column('mock_chroot', 'comment')

@@ -0,0 +1,23 @@ 

+ from flask_script import Command, Option

+ from coprs import db

+ from coprs.logic.coprs_logic import MockChrootsLogic

+ 

+ 

+ class CommentChrootCommand(Command):

+ 

+     """

+     Add comment to a mock_chroot.

+     """

+ 

+     def run(self, chrootname, comment):

+         chroot = MockChrootsLogic.get_from_name(chrootname).first()

+         if not chroot:

+             print("There is no mock chroot named {0}.".format(chrootname))

+             return

+         chroot.comment = comment

+         db.session.commit()

+ 

+     option_list = (

+         Option("chrootname"),

+         Option("comment"),

+     )

@@ -1175,6 +1175,8 @@ 

      # will skip all projects using this chroot

      final_prunerepo_done = db.Column(db.Boolean, default=False, server_default="0", nullable=False)

  

+     comment = db.Column(db.Text, nullable=True)

+ 

      @classmethod

      def latest_fedora_branched_chroot(cls, arch='x86_64'):

          return (cls.query

@@ -1,6 +1,6 @@ 

  {% from "_helpers.html" import render_field, render_checkbox_field, render_form_errors, copr_details_href, copr_url %}

  

- {% macro copr_form(form, view, copr = None, username = None, group = None) %}

+ {% macro copr_form(form, view, copr = None, username = None, group = None, comments = None) %}

    {# if using for updating, we need to pass name to url_for, but otherwise we need to pass nothing #}

  

    {{ render_form_errors(form) }}
@@ -67,12 +67,15 @@ 

            <label>

              {{ form|attr(ch) }}

              {{ form|attr(ch)|attr('label') }}

+             {% set chrootname = form|attr(ch)|attr('label')|attr('text') %}

              {% if copr and form|attr(ch)|attr('data') %}

-               {% set chrootname = form|attr(ch)|attr('label')|attr('text') %}

                <a style="margin-left:20px" class="btn btn-xs btn-default" href="{{ copr_url('coprs_ns.chroot_edit', copr, chrootname = chrootname)}}">

                  <span class="pficon pficon-edit"> Edit </span>

                </a>

              {% endif %}

+             {% if comments[chrootname] %}

+               <small class="text-muted"> {{ comments[chrootname] }} </small>

+             {% endif %}

            </label>

          </div>

        {% endfor %}{% endfor %}

@@ -8,6 +8,6 @@ 

  

  <h2> Project Details </h2>

  <p> Edit project information and build settings. </p>

- {{ copr_form(form, view=view, copr=copr) }}

+ {{ copr_form(form, view=view, copr=copr, comments=comments) }}

  

  {% endblock %}

@@ -28,7 +28,7 @@ 

  from coprs import helpers

  from coprs import models

  from coprs.exceptions import ObjectNotFound

- from coprs.logic.coprs_logic import CoprsLogic, PinnedCoprsLogic

+ from coprs.logic.coprs_logic import CoprsLogic, PinnedCoprsLogic, MockChrootsLogic

  from coprs.logic.stat_logic import CounterStatLogic

  from coprs.logic.modules_logic import ModulesLogic, ModulemdGenerator, ModuleBuildFacade

  from coprs.rmodels import TimedStatEvents
@@ -421,9 +421,12 @@ 

      if not form:

          form = forms.CoprFormFactory.create_form_cls(

              copr.mock_chroots, copr=copr)(obj=copr)

+     comments = {}

+     for chroot in MockChrootsLogic.get_multiple(active_only=True):

+         comments[chroot.name] = chroot.comment

      return flask.render_template(

          "coprs/detail/settings/edit.html",

-         copr=copr, form=form, view=view)

+         copr=copr, form=form, view=view, comments=comments)

  

  

  @coprs_ns.route("/<username>/<coprname>/edit/")

@@ -23,6 +23,7 @@ 

      "alter_chroot": "AlterChrootCommand",

      "display_chroots": "DisplayChrootsCommand",

      "drop_chroot": "DropChrootCommand",

+     "comment_chroot": "CommentChrootCommand",

  

      # User commands

      "alter_user": "AlterUserCommand",

This is a work in progress.

Metadata Update from @praiskup:
- Pull-request tagged with: needs-work

4 years ago

Pull-Request has been closed by msuchy

4 years ago

Pull-Request has been reopened by msuchy

4 years ago

From meeting discussion, we could re-use this PR for the following RFE:
https://bugzilla.redhat.com/show_bug.cgi?id=1500672

rebased onto 82a414c720e2021215bc6ce7cd5756a8921cdb9b

4 years ago

Can you please rebase and fix the alembic revision ids, and mention the bug ID this is also fixing?

There's MockChrootsLogic.get_from_name() call

I'd prefer larger than 100 characters string her, because I expect this one to be html string, and I'd like to add there link to external html pages (perhaps text is fine I think)

rebased onto 58254d3

4 years ago

As far as I know, there isn't an associated bug/issue. Otherwise, I think it's done.

Metadata Update from @praiskup:
- Pull-request untagged with: needs-work

4 years ago

Commit 08b4849 fixes this pull-request

Pull-Request has been merged by praiskup

4 years ago