rpm-software-management / mock

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

New --scrub-all-chroots option appears to only work for system chroots (mock-core-configs) #1470

Open penguinpee opened 2 months ago

penguinpee commented 2 months ago

Short description of the problem

The new --scrub-all-chroots needs to be smarter with regards to user configs.

Output of rpm -q mock

mock-5.7-1.fc39.noarch

Steps to reproduce issue

  1. mock --scrub-all-chroots:
Unknown directory: churchyard-dill-py3.13_fedora-rawhide-x86_64-bootstrap
Unknown directory: gui1ty-reviews_fedora-rawhide-x86_64
Unknown directory: gui1ty-reviews_fedora-rawhide-x86_64-bootstrap
Unknown directory: gui1ty-extract-msg_fedora-rawhide-x86_64-bootstrap
Unknown directory: churchyard-dill-py3.13_fedora-rawhide-x86_64
Unknown directory: gui1ty-extract-msg_fedora-rawhide-x86_64

All of the above are chroots created with output of copr mock-config project chroot redirected into ~/.config/mock/${short_name}.cfg and accessible by ${short_name} using mock -r ${short_name} or fedpkg mockbuild --root ${short_name}.

The issue is the chroot on disk does not correspond to the name of the config file. The first Unknown directory (which is misleading, since the directory does exist) corresponds to a configuration file called dill.cfg with the following content:

# This is development/testing only mock profile, not exactly the same as
# is used on copr builders;  but it is basically similar.  If you need an
# exact mock configuration (because you e.g. try to reproduce failed
# build), such configuration is put alongside the built RPMs.

include('/etc/mock/fedora-rawhide-x86_64.cfg')

config_opts['root'] = 'churchyard-dill-py3.13_fedora-rawhide-x86_64'
config_opts['isolation'] = 'unchanged'

config_opts['dnf.conf'] += """

[copr_base]
name="Copr repository"
baseurl=https://download.copr.fedorainfracloud.org/results/churchyard/dill-py3.13/fedora-rawhide-x86_64/
gpgcheck=0
enabled=1
skip_if_unavailable=1
metadata_expire=0
cost=1
best=1

[http_kojipkgs_fedoraproject_org_repos_rawhide_latest_basearch]
name="Additional repo http_kojipkgs_fedoraproject_org_repos_rawhide_latest_basearch"
baseurl=http://kojipkgs.fedoraproject.org/repos/rawhide/latest/$basearch/
gpgcheck=0
enabled=1
skip_if_unavailable=1
metadata_expire=0
cost=1
best=1

So, --scrub-all-chroots would need to look at the config_opts['root'] parameter for configs not managed by mock-core-configs.

praiskup commented 2 months ago

Thank you for the report.

So, --scrub-all-chroots would need to look at the config_opts['root'] parameter for configs not managed by mock-core-configs.

Indeed, but this makes the process a bit more complicated. Help with this is welcome!