tools/osbuild-depsolve-dnf: support optional metadata

Filelist repo metadata is required when using newer versions of libdnf
with old repositories or packages that specify dependencies on files.
For example, depsolving with RHEL 9.3 repos on Fedora 40 fails to
resolve platform-python with the message

  nothing provides /usr/libexec/platform-python needed by platform-python-...

Not loading filelists is beneficial because it greatly reduces the size
of the metadata to download.  Filelists were downloaded by default for
repositories in the past, but with newer versions of dnf/libdnf (in
Fedora 40), they are downloaded on-demand (e.g. when running a query
that requires file information).  Newer package guidelines prohibit
depending on file paths, so filelists are not needed for package
depsolving with newer distro repositories.

Add an 'optional-metadata' property to the 'arguments' object of the
depsolve request, so that callers can enable any optional metadata they
need.

Further reading:
- https://libdnf.readthedocs.io/en/stable/tutorial-py/#case-for-loading-the-filelists
- https://github.com/rpm-software-management/dnf/releases/tag/4.19.0
- https://dnf.readthedocs.io/en/stable/user_faq.html#starting-with-fedora-40-i-noticed-repository-metadata-is-synchronized-much-faster-what-happened
This commit is contained in:
Achilleas Koutsou 2024-05-07 22:05:11 +02:00 committed by Michael Vogt
parent ad13333f36
commit 806a1caba7

View file

@ -64,6 +64,9 @@ class Solver():
self.base.conf.substitutions['arch'] = arch
self.base.conf.substitutions['basearch'] = dnf.rpm.basearch(arch)
self.base.conf.substitutions['releasever'] = releasever
self.base.conf.optional_metadata_types.extend(arguments.get("optional-metadata", []))
if proxy:
self.base.conf.proxy = proxy