-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tools/osbuild-depsolve-dnf: enable loading of optional metadata #1775
Conversation
Here's a small depsolve request that demonstrates the issue: {
"command": "depsolve",
"arch": "x86_64",
"module_platform_id": "platform:el9",
"releasever": "9",
"cachedir": "/tmp/rpmmd.cache",
"arguments": {
"repos": [
{
"id": "baseos",
"name": "baseos",
"baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-x86_64-baseos-n9.3-20230808",
"check_gpg": false
},
{
"id": "appstream",
"name": "appstream",
"baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-x86_64-appstream-n9.3-20230808",
"check_gpg": false
}
],
"transactions": [
{
"package-specs": [
"insights-client"
]
}
]
}
}
Make sure the cache directory is empty before testing. |
Maybe this would be better as an option on the depsolve request so that we can get the speed and efficiency of depsolving without downloading filelists when we know we don't need them and still be able to depsolve older distro versions when we need to. |
I think that's the best option, maybe even a generic option to control what metadata is needed, set by the distro definition. I wouldn't want to unnecessarily download them when they aren't needed -- I don't actually remember why I set it in the dnf5 version, it was likely just a side effect of trying to get things working with the current repos. |
abc8526
to
acebc09
Compare
Made it an option for both dnf and dnf5. This is a change in the default behaviour for the dnf5 depsolver, but I think that's okay given we don't use it in prod yet. Discussions on the name of the option are welcome. {
"command": "depsolve",
"arch": "...",
"module_platform_id": "...",
"cachedir": "...",
"optional-metadata": ["comps", "filelists"],
"arguments": {
"repos": [ ... ],
"transactions": [ ... ]
}
} |
I like the example above, |
I think |
acebc09
to
25e8adc
Compare
I went with {
"command": "depsolve",
"arch": "...",
"module_platform_id": "...",
"cachedir": "...",
"arguments": {
"repos": [ ... ],
"optional-metadata": ["comps", "filelists"],
"transactions": [ ... ]
}
} Moving it to the arguments makes more sense since it is an option that is only relevant for the |
25e8adc
to
066b929
Compare
New property on the arguments object that controls the types of metadata to download for repositories and use when depsolving. See osbuild/osbuild#1775
066b929
to
3327d51
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Schutzbot not happy though, not really sure why.
Happy now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks nice! How much extra work would it be if the existing test_depsolve.py be extended to include the "optional-metadata" in the files and the test?
Not sure. I think it might be as simple as enabling the option (or not) and checking if the local cache includes any files called |
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
We originally enabled filelists unconditionally in dnf5. Let's make it optional as part of the 'optional-metadata' option in the arguments so that the caller can decide if it's needed, for example when using dnf5 with older repositories that have packages with file dependencies, but don't download them when they're not needed, since the filelists are quite large.
Run depsolve tests both with and without adding filelists to optional metadata.
Use a fresh cache for each depsolve in tests. This will let us check if filelists are downloaded or not according to the option.
When the filelists are enabled in the optional metadata, the local cache for the depsolve will include a filelist file for each repository. Count the files matching *filelists* using glob() and compare them with the number of repositories when the option is enabled. When the option is not enabled, there should be no filelists.
73084e8
to
972bc3b
Compare
I added a test but there's a small issue. The test doesn't check for the version of dnf, so if it's run with a version older than 4.19.0, it will fail. It's also tricky to check which version we're testing against because in out GitHub tests we use tox, which sets up venvs, so if we import dnf to check its version, we'll be checking the version in the venv, but the test is actually run against the system dnf version because we shell out to osbuild-depsolve-dnf, which runs in the system-wide env. |
Now that I think about it, this might be an issue with release testing in EL9, though I'm not sure what tests we run there. Perhaps we should exclude it here: tests/unit-tests/run-unit-tests.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
New property on the arguments object that controls the types of metadata to download for repositories and use when depsolving. See osbuild/osbuild#1775
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
This is required so that callers can enable loading of filelists when using newer versions of libdnf with old repositories or packages that specify dependencies on files. For example, depsolving against RHEL 9.3 repos on Fedora 40 fails to resolve platform-python with the message
Further reading: