From 760a23b24eeb01cd79410d60d9f21e1d7fde1c7d Mon Sep 17 00:00:00 2001 From: clime Date: May 18 2018 13:41:12 +0000 Subject: [frontend][rpmbuild] add --with/--without rpmbuild options for build chroot --- diff --git a/frontend/coprs_frontend/coprs/forms.py b/frontend/coprs_frontend/coprs/forms.py index c615d0f..7c43028 100644 --- a/frontend/coprs_frontend/coprs/forms.py +++ b/frontend/coprs_frontend/coprs/forms.py @@ -793,8 +793,7 @@ class ChrootForm(FlaskForm): (adding packages to minimal chroot) """ - buildroot_pkgs = wtforms.TextField( - "Packages") + buildroot_pkgs = wtforms.TextField("Packages") repos = wtforms.TextAreaField('Repos', validators=[UrlRepoListValidator(), @@ -805,6 +804,8 @@ class ChrootForm(FlaskForm): comps = FileField("comps_xml") + with_opts = wtforms.TextField("With options") + without_opts = wtforms.TextField("Without options") class CoprLegalFlagForm(FlaskForm): comment = wtforms.TextAreaField("Comment") diff --git a/frontend/coprs_frontend/coprs/helpers.py b/frontend/coprs_frontend/coprs/helpers.py index 26e225c..8c88f23 100644 --- a/frontend/coprs_frontend/coprs/helpers.py +++ b/frontend/coprs_frontend/coprs/helpers.py @@ -638,5 +638,7 @@ def generate_build_config(copr, chroot_id): 'additional_packages': packages.split(), 'repos': repos, 'chroot': chroot_id, - 'use_bootstrap_container': copr.use_bootstrap_container + 'use_bootstrap_container': copr.use_bootstrap_container, + 'with_opts': chroot.with_opts.split(), + 'without_opts': chroot.without_opts.split(), } diff --git a/frontend/coprs_frontend/coprs/logic/complex_logic.py b/frontend/coprs_frontend/coprs/logic/complex_logic.py index 0fba27f..8d6c17e 100644 --- a/frontend/coprs_frontend/coprs/logic/complex_logic.py +++ b/frontend/coprs_frontend/coprs/logic/complex_logic.py @@ -212,7 +212,8 @@ class ProjectForking(object): for chroot in list(copr.copr_chroots): CoprChrootsLogic.create_chroot(self.user, fcopr, chroot.mock_chroot, chroot.buildroot_pkgs, - chroot.repos, comps=chroot.comps, comps_name=chroot.comps_name) + chroot.repos, comps=chroot.comps, comps_name=chroot.comps_name, + with_opts=chroot.with_opts, without_opts=chroot.without_opts) db.session.add(fcopr) return fcopr diff --git a/frontend/coprs_frontend/coprs/logic/coprs_logic.py b/frontend/coprs_frontend/coprs/logic/coprs_logic.py index dc6a291..5d6b40e 100644 --- a/frontend/coprs_frontend/coprs/logic/coprs_logic.py +++ b/frontend/coprs_frontend/coprs/logic/coprs_logic.py @@ -489,7 +489,7 @@ class CoprChrootsLogic(object): @classmethod def create_chroot(cls, user, copr, mock_chroot, - buildroot_pkgs=None, repos=None, comps=None, comps_name=None, module_md=None, module_md_name=None): + buildroot_pkgs=None, repos=None, comps=None, comps_name=None, module_md=None, module_md_name=None, with_opts="", without_opts=""): """ :type user: models.User :type mock_chroot: models.MockChroot @@ -503,12 +503,12 @@ class CoprChrootsLogic(object): "Only owners and admins may update their projects.") chroot = models.CoprChroot(copr=copr, mock_chroot=mock_chroot) - cls._update_chroot(buildroot_pkgs, repos, comps, comps_name, module_md, module_md_name, chroot) + cls._update_chroot(buildroot_pkgs, repos, comps, comps_name, module_md, module_md_name, chroot, with_opts, without_opts) return chroot @classmethod def update_chroot(cls, user, copr_chroot, - buildroot_pkgs=None, repos=None, comps=None, comps_name=None, module_md=None, module_md_name=None): + buildroot_pkgs=None, repos=None, comps=None, comps_name=None, module_md=None, module_md_name=None, with_opts="", without_opts=""): """ :type user: models.User :type copr_chroot: models.CoprChroot @@ -517,17 +517,23 @@ class CoprChrootsLogic(object): user, copr_chroot.copr, "Only owners and admins may update their projects.") - cls._update_chroot(buildroot_pkgs, repos, comps, comps_name, module_md, module_md_name, copr_chroot) + cls._update_chroot(buildroot_pkgs, repos, comps, comps_name, module_md, module_md_name, copr_chroot, with_opts, without_opts) return copr_chroot @classmethod - def _update_chroot(cls, buildroot_pkgs, repos, comps, comps_name, module_md, module_md_name, copr_chroot): + def _update_chroot(cls, buildroot_pkgs, repos, comps, comps_name, module_md, module_md_name, copr_chroot, with_opts, without_opts): if buildroot_pkgs is not None: copr_chroot.buildroot_pkgs = buildroot_pkgs if repos is not None: copr_chroot.repos = repos.replace("\n", " ") + if with_opts is not None: + copr_chroot.with_opts = with_opts + + if without_opts is not None: + copr_chroot.without_opts = without_opts + if comps_name is not None: copr_chroot.update_comps(comps) copr_chroot.comps_name = comps_name diff --git a/frontend/coprs_frontend/coprs/models.py b/frontend/coprs_frontend/coprs/models.py index a9923ee..17e3c58 100644 --- a/frontend/coprs_frontend/coprs/models.py +++ b/frontend/coprs_frontend/coprs/models.py @@ -330,7 +330,8 @@ class Copr(db.Model, helpers.Serializer, CoprSearchRelatedData): """ modified_chroots = [] for chroot in self.copr_chroots: - if ((chroot.buildroot_pkgs or chroot.repos) + if ((chroot.buildroot_pkgs or chroot.repos + or chroot.with_opts or chroot.without_opts) and chroot.is_active): modified_chroots.append(chroot) return modified_chroots @@ -879,6 +880,9 @@ class CoprChroot(db.Model, helpers.Serializer): module_md_zlib = db.Column(db.LargeBinary(), nullable=True) module_md_name = db.Column(db.String(127), nullable=True) + with_opts = db.Column(db.Text, default="", server_default="", nullable=False) + without_opts = db.Column(db.Text, default="", server_default="", nullable=False) + def update_comps(self, comps_xml): if isinstance(comps_xml, str): data = comps_xml.encode("utf-8") @@ -935,7 +939,7 @@ class CoprChroot(db.Model, helpers.Serializer): def to_dict(self): options = {"__columns_only__": [ - "buildroot_pkgs", "repos", "comps_name", "copr_id" + "buildroot_pkgs", "repos", "comps_name", "copr_id", "with_opts", "without_opts" ]} d = super(CoprChroot, self).to_dict(options=options) d["mock_chroot"] = self.mock_chroot.name diff --git a/frontend/coprs_frontend/coprs/templates/coprs/detail/edit_chroot.html b/frontend/coprs_frontend/coprs/templates/coprs/detail/edit_chroot.html index 7e1df93..1ae760c 100644 --- a/frontend/coprs_frontend/coprs/templates/coprs/detail/edit_chroot.html +++ b/frontend/coprs_frontend/coprs/templates/coprs/detail/edit_chroot.html @@ -32,6 +32,22 @@ {{ render_field(form.repos, rows=5, cols=50, placeholder='Optional - URL to additional yum repos, which can be used during build. Space separated. This should be baseurl from .repo file. E.g.: http://copr-be.cloud.fedoraproject.org/results/rhughes/f20-gnome-3-12/fedora-$releasever-$basearch/') }} + {{ render_field( + form.with_opts, + size=80, + info='You can specify rpmbuild --with options here for builds in the given chroot.', + placeholder='Space separated list of the rpmbuild with options' + ) + }} + + {{ render_field( + form.without_opts, + size=80, + info='You can specify rpmbuild --without options here for builds in the given chroot.', + placeholder='Space separated list of the rpmbuild without options' + ) + }} +