Skip to content

Commit

Permalink
Accept also "all" whenever optional metadata are checked
Browse files Browse the repository at this point in the history
  • Loading branch information
m-blaha committed Nov 22, 2024
1 parent 9a7ba60 commit 67b5754
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion dnf5/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,8 @@ static void print_resolve_hints(dnf5::Context & context) {
if (broken_file_dep) {
const std::string_view arg{"--setopt=optional_metadata_types=filelists"};
auto optional_metadata = conf.get_optional_metadata_types_option().get_value();
if (!optional_metadata.contains("filelists")) {
if (!optional_metadata.contains(libdnf5::METADATA_TYPE_FILELISTS) &&
!optional_metadata.contains(libdnf5::METADATA_TYPE_ALL)) {
hints.emplace_back(libdnf5::utils::sformat(_("{} to load additional filelists metadata"), arg));
}
}
Expand Down
11 changes: 6 additions & 5 deletions libdnf5/repo/repo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,24 +411,25 @@ void Repo::load_available_repo() {
p_impl->solv_repo->load_repo_main(p_impl->downloader->repomd_filename, primary_fn);

auto optional_metadata = p_impl->config.get_main_config().get_optional_metadata_types_option().get_value();
const bool all_metadata = optional_metadata.contains(libdnf5::METADATA_TYPE_ALL);

if (optional_metadata.contains(libdnf5::METADATA_TYPE_FILELISTS)) {
if (all_metadata || optional_metadata.contains(libdnf5::METADATA_TYPE_FILELISTS)) {
p_impl->solv_repo->load_repo_ext(RepodataType::FILELISTS, *p_impl->downloader.get());
}

if (optional_metadata.contains(libdnf5::METADATA_TYPE_OTHER)) {
if (all_metadata || optional_metadata.contains(libdnf5::METADATA_TYPE_OTHER)) {
p_impl->solv_repo->load_repo_ext(RepodataType::OTHER, *p_impl->downloader.get());
}

if (optional_metadata.contains(libdnf5::METADATA_TYPE_PRESTO)) {
if (all_metadata || optional_metadata.contains(libdnf5::METADATA_TYPE_PRESTO)) {
p_impl->solv_repo->load_repo_ext(RepodataType::PRESTO, *p_impl->downloader.get());
}

if (optional_metadata.contains(libdnf5::METADATA_TYPE_UPDATEINFO)) {
if (all_metadata || optional_metadata.contains(libdnf5::METADATA_TYPE_UPDATEINFO)) {
p_impl->solv_repo->load_repo_ext(RepodataType::UPDATEINFO, *p_impl->downloader.get());
}

if (optional_metadata.contains(libdnf5::METADATA_TYPE_COMPS)) {
if (all_metadata || optional_metadata.contains(libdnf5::METADATA_TYPE_COMPS)) {
p_impl->solv_repo->load_repo_ext(RepodataType::COMPS, *p_impl->downloader.get());
}

Expand Down
3 changes: 2 additions & 1 deletion libdnf5/repo/repo_sack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ constexpr const char * STORED_TRANSACTION_NAME = "@stored_transaction";

void load_repos_common(libdnf5::BaseWeakPtr & base) {
auto optional_metadata = base->get_config().get_optional_metadata_types_option().get_value();
if (!optional_metadata.contains(libdnf5::METADATA_TYPE_FILELISTS)) {
if (!optional_metadata.contains(libdnf5::METADATA_TYPE_FILELISTS) &&
!optional_metadata.contains(libdnf5::METADATA_TYPE_ALL)) {
// Configures the pool_addfileprovides_queue() method to only add files from primary.xml.
// This ensures the method works correctly even if filelist.xml metadata are not loaded.
// When searching for file provides outside of primary.xml this flag incurs a big performance
Expand Down

0 comments on commit 67b5754

Please sign in to comment.