rpm-software-management / mock

Mock is a tool for a reproducible build of RPM packages.
GNU General Public License v2.0
381 stars 226 forks source link

--addrepo does not add repos to the boostrap chroot #1414

Open hroncok opened 1 month ago

hroncok commented 1 month ago

Short description of the problem

When debugging a problem with RHEL 8 mock bootstrap chroots on Fedora 40 I was about to verify a fix. I built the fixed package in Copr and run:

mock -r rhel+epel-8-x86_64 --bootstrap-chroot --no-bootstrap-image init --addrepo='https://download.copr.fedorainfracloud.org/results/churchyard/rhel8-python3-libexec-provides/rhel-8-$basearch/'

Unfortunately, when the bootstrap chroot was created, it did not use this repo.

I had to edit /etc/mock/templates/rhel-8.tpl and add the repo to the repos configuration manually. This was unexpected.

Output of rpm -q mock

mock-5.6-1.fc40.noarch

Steps to reproduce issue

  1. Be on Fedora 40+
  2. Follow https://rpm-software-management.github.io/mock/Feature-rhelchroots#subscription-configuration-with-simple-content-access
  3. mock -r rhel+epel-8-x86_64 --scurb=all
  4. mock -r rhel+epel-8-x86_64 --bootstrap-chroot --no-bootstrap-image init --addrepo='https://download.copr.fedorainfracloud.org/results/churchyard/rhel8-python3-libexec-provides/rhel-8-$basearch/'

This will fail with:

Start(bootstrap): installing dnf tooling
...
Red Hat Enterprise Linux - BaseOS                                18 kB/s | 4.1 kB     00:00
Red Hat Enterprise Linux - AppStream                             21 kB/s | 4.5 kB     00:00
Red Hat Enterprise Linux - CodeReady Linux Builder               19 kB/s | 4.5 kB     00:00
Extra Packages for Enterprise Linux 8 - x86_64                   58 kB/s |  33 kB     00:00
Error: 
 Problem 1: cannot install the best candidate for the job
  - nothing provides /usr/libexec/platform-python needed by python3-dnf-4.7.0-20.el8.noarch from rhel-baseos
 Problem 2: cannot install the best candidate for the job
  - nothing provides /usr/libexec/platform-python needed by subscription-manager-1.28.42-1.el8.x86_64 from rhel-baseos
 Problem 3: package python3-dnf-plugins-core-4.0.21-25.el8.noarch from rhel-baseos requires python3-dnf >= 4.7.0-6, but none of the providers can be installed
  - cannot install the best candidate for the job
  - nothing provides /usr/libexec/platform-python needed by python3-dnf-4.7.0-8.el8.noarch from rhel-baseos
  - nothing provides /usr/libexec/platform-python needed by python3-dnf-4.7.0-11.el8.noarch from rhel-baseos
  - nothing provides /usr/libexec/platform-python needed by python3-dnf-4.7.0-16.el8_8.noarch from rhel-baseos
  - nothing provides /usr/libexec/platform-python needed by python3-dnf-4.7.0-19.el8.noarch from rhel-baseos
  - nothing provides /usr/libexec/platform-python needed by python3-dnf-4.7.0-20.el8.noarch from rhel-baseos
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages or '--setopt=optional_metadata_types=filelists' to load additional filelists metadata)

Until my Merge Request is merged and shipped.

Notice that the added repo is not in the list of repos it fetched.

When I edited /etc/mock/templates/rhel-8.tpl, it looked like this:

Red Hat Enterprise Linux - BaseOS                                18 kB/s | 4.1 kB     00:00    
Red Hat Enterprise Linux - AppStream                             17 kB/s | 4.5 kB     00:00    
Red Hat Enterprise Linux - CodeReady Linux Builder               18 kB/s | 4.5 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   59 kB/s |  33 kB     00:00    
Copr repo for rhel8-python3-libexec-provides owned by churchyard 12 kB/s | 8.4 kB     00:00    
Dependencies resolved.
praiskup commented 1 month ago

Thank you for the report. One of the caveats is that, unless you --scrub=bootstrap|all, the bootstrap is cached and never updated anyway, #1289.

If you need to experiment quickly, there's a quick PR (it could break other use cases, though, not sure): #1415

hroncok commented 1 month ago

Right. I guess the cache could use the addrepos as additional keys?

praiskup commented 1 month ago

Triage time: we'd prefer to fix #1289 first