On 11/29/20 1:28 AM, Miro Hrončok wrote:
> Hello,
>
> I was wondering whether it might be possible to use microdnf instead of dnf in
> the boostrap mock chroots. Since dnf depends on Python, using the boostrap mode
> now complicates upgrading Pythons to a newer version.
>
>
https://pagure.io/releng/issue/9308#comment-703106
>
> Basically, if/when Koji uses the bootstrap mock mode, as soon as we start
> bootstrapping (different meaning) Python in a side tag, dnf becomes temporarily
> uninstallable in that side tag and we can no longer do any builds.
>
> This can be worked around by not using the boostrap mock option in Koji (ideally
> only for Python upgrade side tags, but I am not yet sure if that's possible),
or
> by eliminating Python libraries out of the bootstrap chroot, hence the idea
> about using microdnf.
>
> I've started with this config:
>
> include('/etc/mock/fedora-rawhide-x86_64.cfg')
> config_opts['root'] = 'fedora-rawhide-microdnf'
> config_opts['package_manager'] = 'dnf'
> config_opts['dnf_command'] = '/usr/bin/microdnf'
> config_opts['dnf_install_command'] = 'install microdnf'
> config_opts['system_dnf_command'] = '/usr/bin/dnf'
> config_opts['dnf_common_opts'] = ['--allowerasing']
>
> But it fails pretty soon with:
>
> error: (--setopt) Unknown tsflag: nocontexts
>
> And when I patch that option out, I still get:
>
> error: The "--installroot" argument must be used together with
"--config",
> "--noplugins", "--setopt=cachedir=<path>",
"--setopt=reposdir=<path>",
> "--setopt=varsdir=<path>" arguments.
>
> But I guess that if I figure the right options for dnf_common_opts, this might
> work...? Is there some crucial functionality that microdnf might be missing that
> would prevent it from creating mock chroots like this?
I guess I should have searched a bit better before asking the questiong.
I found the microdnf option in mock:
https://github.com/rpm-software-management/mock/issues/76
https://github.com/rpm-software-management/microdnf/pull/28
But using config_opts['package_manager'] = 'microdnf' still installs dnf
into
the bootstrap chroot, which is confusing. But I got around that with:
include('/etc/mock/fedora-rawhide-x86_64.cfg')
config_opts['root'] = 'fedora-rawhide-microdnf'
config_opts['package_manager'] = 'microdnf'
config_opts['microdnf_command'] = '/usr/bin/microdnf'
config_opts['microdnf_install_command'] = 'dnf-install microdnf
distribution-gpg-keys'
config_opts['system_dnf_command'] = '/usr/bin/dnf'
config_opts['microdnf_common_opts'] = ['--allowerasing']
However, it still ends with:
Curl error (37): Couldn't read a file:// file for
file:///usr/share/distribution-gpg-keys/fedora/RPM-GPG-KEY-fedora-0-primary
[Couldn't open file
/usr/share/distribution-gpg-keys/fedora/RPM-GPG-KEY-fedora-0-primary]
Running `mock -r fedora-rawhide-microdnf --init` twice works around that
problem, and it successfully crates the boostraop chroot, but then, trying to
create the actual one, it fails with:
Start: microdnf install
Directory /var/lib/mock/fedora-rawhide-microdnf/root doesn't look like it has an
OS tree. Refusing.
This is a legitimate bug with microdnf and deserves a bug report in
Red Hat Bugzilla or GitHub.
The installroot support in microdnf should generally work, as I
verified it for image builds with kiwi[1] this past week.
I think the next release of microdnf should have enough for the
bootstrap phase (especially with the modularity stuff now sorted out),
but using it in mock in all stages requires getting a builddep
implementation[2].
[1]: