Skip to content
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

Add the possibility to load filelists conditionally #1635

Merged
merged 4 commits into from
Jan 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
repo: Load filelists based on the configuration
Prepare libdnf to not load the filelists metadata by default in the future.
They will be loaded only when requested through the `optional_metadata_types`
configuration option.
  • Loading branch information
jan-kolarik committed Jan 18, 2024
commit e588234b3aa4c7c20d9a7e4d67817c7abb47acf8
10 changes: 8 additions & 2 deletions libdnf/repo/Repo.cpp
Original file line number Diff line number Diff line change
@@ -432,12 +432,18 @@ std::string Repo::getMetadataContent(const std::string &metadataType)
std::unique_ptr<LrHandle> Repo::Impl::lrHandleInitBase()
{
std::unique_ptr<LrHandle> h(lr_handle_init());
std::vector<const char *> dlist = {MD_TYPE_PRIMARY, MD_TYPE_FILELISTS, MD_TYPE_PRESTODELTA,
MD_TYPE_GROUP_GZ, MD_TYPE_UPDATEINFO};
std::vector<const char *> dlist = {MD_TYPE_PRIMARY, MD_TYPE_PRESTODELTA, MD_TYPE_GROUP_GZ, MD_TYPE_UPDATEINFO};

auto & optionalMetadataTypes = conf->getMainConfig().optional_metadata_types().getValue();
auto loadFilelists = std::find(optionalMetadataTypes.begin(), optionalMetadataTypes.end(), "filelists") !=
optionalMetadataTypes.end();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great idea


#ifdef MODULEMD
dlist.push_back(MD_TYPE_MODULES);
#endif
if (loadFilelists) {
dlist.push_back(MD_TYPE_FILELISTS);
}
if (loadMetadataOther) {
dlist.push_back(MD_TYPE_OTHER);
}