include('/etc/mock/{{ chroot }}.cfg')

config_opts['root'] = '{{ task_id }}'

config_opts['nspawn_args'] = ['--capability=cap_ipc_lock']

{% if buildroot_pkgs %}
config_opts['chroot_additional_packages'] = '{{ buildroot_pkgs| join(" ") }}'
{% endif %}

{% if enable_net %}
config_opts['rpmbuild_networking'] = True
config_opts['use_host_resolv'] = True
{% else %}
config_opts['rpmbuild_networking'] = False
config_opts['use_host_resolv'] = False
{% endif %}

config_opts['use_bootstrap_container'] = {{ 'True' if use_bootstrap_container else 'False' }}

{% if use_bootstrap_container %}
config_opts['bootstrap_chroot_additional_packages'] = []
config_opts['bootstrap_module_enable'] = []
config_opts['bootstrap_module_install'] = []
{% endif %}

{% if repos %}
config_opts['{{ pkg_manager_conf }}.conf'] += """
{% for repo in repos %}
[{{ repo["id"] }}]
name='{{ repo["name"] }}'
baseurl={{ repo["baseurl"] }}
gpgcheck=0
enabled=1
skip_if_unavailable=1
metadata_expire=0
cost=1
best=1
{%- if "priority" in repo %}
priority={{ repo["priority"] }}
{%- endif %}
{% endfor %}
"""
{% endif %}
