From 806a1caba7bb27aad331d9a5358d8e03d1ae696d Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Tue, 7 May 2024 22:05:11 +0200 Subject: [PATCH] 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 --- tools/osbuild-depsolve-dnf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/osbuild-depsolve-dnf b/tools/osbuild-depsolve-dnf index adfc4040..3f3863be 100755 --- a/tools/osbuild-depsolve-dnf +++ b/tools/osbuild-depsolve-dnf @@ -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