copr-backend: install custom mock-custom-build.cfg.j2

Fix https://github.com/fedora-copr/copr/issues/3140
This commit is contained in:
Jakub Kadlcik 2024-02-15 15:50:33 +01:00
parent 0ebb7aa380
commit cce5ad78f4
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,46 @@
include('/etc/mock/{{ chroot }}.cfg')
config_opts['rpmbuild_networking'] = True
config_opts['use_host_resolv'] = True
{# Hotfix for https://github.com/fedora-copr/copr/issues/3140 #}
{%- if not chroot.startswith("fedora-rawhide-") %}
# We don't do 'dnf builddep' for the custom method, so we don't need to install
# python3-dnf-plugins core or dnf5-plugins at all.
config_opts["bootstrap_image_ready"] = True
{% endif %}
# Don't mixup caches with the normal mock build.
config_opts["root"] = "copr-custom-" + config_opts["root"]
# Important e.g. to keep '/script' file available across several
# /bin/mock calls (when tmpfs_enable is on).
config_opts['plugin_conf']['tmpfs_opts']['keep_mounted'] = True
{%- for key, value in macros.items() %}
config_opts['macros']['{{ key }}'] = '{{ value }}'
{%- endfor %}
{% if repos %}
config_opts[f"{config_opts.package_manager}.conf"] += """
{% for repo in repos %}
[{{ repo["id"] }}]
name='{{ repo["name"] }}'
baseurl={{ repo["baseurl"] }}
gpgcheck=0
enabled=1
skip_if_unavailable=0
metadata_expire=0
cost=1
best=1
{%- if "priority" in repo and priority is not none %}
priority={{ repo["priority"] }}
{%- endif %}
{%- if "module_hotfixes" in repo %}
module_hotfixes={{ repo["module_hotfixes"] }}
{% endif -%}
{% endfor %}
"""
{% endif %}

View file

@ -271,3 +271,11 @@
loop:
- name: mock-core-configs
version: '39.4'
# Hotfix for https://github.com/fedora-copr/copr/issues/3140
- name: Install custom mock-custom-build.cfg.j2
copy:
src: files/mock-custom-build.cfg.j2
dest: /etc/copr-rpmbuild/mock-custom-build.cfg.j2
when:
- prepare_base_image is not defined