From cce5ad78f461edbcd552f758ee808f1ce5348cb4 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Thu, 15 Feb 2024 15:50:33 +0100 Subject: [PATCH] copr-backend: install custom mock-custom-build.cfg.j2 Fix https://github.com/fedora-copr/copr/issues/3140 --- .../provision/files/mock-custom-build.cfg.j2 | 46 +++++++++++++++++++ .../provision/provision_builder_tasks.yml | 8 ++++ 2 files changed, 54 insertions(+) create mode 100644 roles/copr/backend/files/provision/files/mock-custom-build.cfg.j2 diff --git a/roles/copr/backend/files/provision/files/mock-custom-build.cfg.j2 b/roles/copr/backend/files/provision/files/mock-custom-build.cfg.j2 new file mode 100644 index 0000000000..f8c3110ab6 --- /dev/null +++ b/roles/copr/backend/files/provision/files/mock-custom-build.cfg.j2 @@ -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 %} diff --git a/roles/copr/backend/files/provision/provision_builder_tasks.yml b/roles/copr/backend/files/provision/provision_builder_tasks.yml index 186a1fb660..3e7f68b154 100644 --- a/roles/copr/backend/files/provision/provision_builder_tasks.yml +++ b/roles/copr/backend/files/provision/provision_builder_tasks.yml @@ -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