diff --git a/dnf5-plugins/changelog_plugin/changelog.cpp b/dnf5-plugins/changelog_plugin/changelog.cpp index 4970c426d..ddb9d5f7a 100644 --- a/dnf5-plugins/changelog_plugin/changelog.cpp +++ b/dnf5-plugins/changelog_plugin/changelog.cpp @@ -111,7 +111,7 @@ void ChangelogCommand::configure() { context.set_load_system_repo(true); context.set_load_available_repos(Context::LoadAvailableRepos::ENABLED); context.get_base().get_config().get_optional_metadata_types_option().add( - libdnf5::Option::Priority::RUNTIME, libdnf5::OPTIONAL_METADATA_TYPES); + libdnf5::Option::Priority::RUNTIME, libdnf5::METADATA_TYPE_OTHER); } void ChangelogCommand::run() { diff --git a/dnf5/main.cpp b/dnf5/main.cpp index dcf0bb526..c0bdf5f2c 100644 --- a/dnf5/main.cpp +++ b/dnf5/main.cpp @@ -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)); } } diff --git a/doc/dnf5.conf.5.rst b/doc/dnf5.conf.5.rst index 642ccdcc8..5cc240744 100644 --- a/doc/dnf5.conf.5.rst +++ b/doc/dnf5.conf.5.rst @@ -388,9 +388,11 @@ repository configuration file should aside from repo ID consists of baseurl, met ``optional_metadata_types`` :ref:`list ` - List of the following: ``comps``, ``filelists``, ``other``, ``presto``, ``updateinfo`` + List of the following: ``comps``, ``filelists``, ``other``, ``presto``, ``updateinfo``, ``all`` - Defines which types of metadata are to be loaded in addition to primary and modules, which are loaded always as they are essential. Note that the list can be extended by individual DNF commands during runtime. + Specifies the types of metadata to load in addition to the essential ``primary`` and ``modules`` metadata, which are always loaded. Note that individual DNF commands may extend this list at runtime. + + Note: The list includes only metadata types recognized by DNF. However, a repository's metadata may include various other types (e.g., AppStream or metadata stored as databases instead of XML files). The special value ``all`` represents all metadata types present in the repository, including those unknown to DNF. Default: ``comps,updateinfo`` diff --git a/include/libdnf5/conf/const.hpp b/include/libdnf5/conf/const.hpp index d75610586..db349c204 100644 --- a/include/libdnf5/conf/const.hpp +++ b/include/libdnf5/conf/const.hpp @@ -63,6 +63,7 @@ constexpr const char * METADATA_TYPE_FILELISTS = "filelists"; constexpr const char * METADATA_TYPE_OTHER = "other"; constexpr const char * METADATA_TYPE_PRESTO = "presto"; constexpr const char * METADATA_TYPE_UPDATEINFO = "updateinfo"; +constexpr const char * METADATA_TYPE_ALL = "all"; const std::set OPTIONAL_METADATA_TYPES{ METADATA_TYPE_COMPS, METADATA_TYPE_FILELISTS, METADATA_TYPE_OTHER, METADATA_TYPE_PRESTO, METADATA_TYPE_UPDATEINFO}; diff --git a/libdnf5/repo/repo.cpp b/libdnf5/repo/repo.cpp index c621eab67..16ac99fec 100644 --- a/libdnf5/repo/repo.cpp +++ b/libdnf5/repo/repo.cpp @@ -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()); } diff --git a/libdnf5/repo/repo_downloader.cpp b/libdnf5/repo/repo_downloader.cpp index b142aabbe..eecbd75e5 100644 --- a/libdnf5/repo/repo_downloader.cpp +++ b/libdnf5/repo/repo_downloader.cpp @@ -470,38 +470,42 @@ LibrepoHandle RepoDownloader::init_remote_handle(const char * destdir, bool mirr } void RepoDownloader::common_handle_setup(LibrepoHandle & h) { - std::vector dlist; - auto optional_metadata = get_optional_metadata(); - dlist.push_back(MD_FILENAME_PRIMARY); + if (optional_metadata.extract(libdnf5::METADATA_TYPE_ALL)) { + h.set_opt(LRO_YUMDLIST, LR_RPMMD_FULL); + } else { + std::vector dlist; + dlist.push_back(MD_FILENAME_PRIMARY); #ifdef WITH_MODULEMD - dlist.push_back(MD_FILENAME_MODULES); + dlist.push_back(MD_FILENAME_MODULES); #endif - if (optional_metadata.extract(libdnf5::METADATA_TYPE_FILELISTS)) { - dlist.push_back(MD_FILENAME_FILELISTS); - } - if (optional_metadata.extract(libdnf5::METADATA_TYPE_OTHER)) { - dlist.push_back(MD_FILENAME_OTHER); - } - if (optional_metadata.extract(libdnf5::METADATA_TYPE_PRESTO)) { - dlist.push_back(MD_FILENAME_PRESTODELTA); - } - if (optional_metadata.extract(libdnf5::METADATA_TYPE_COMPS)) { - dlist.push_back(MD_FILENAME_GROUP_GZ); - } - if (optional_metadata.extract(libdnf5::METADATA_TYPE_UPDATEINFO)) { - dlist.push_back(MD_FILENAME_UPDATEINFO); - } + if (optional_metadata.extract(libdnf5::METADATA_TYPE_FILELISTS)) { + dlist.push_back(MD_FILENAME_FILELISTS); + } + if (optional_metadata.extract(libdnf5::METADATA_TYPE_OTHER)) { + dlist.push_back(MD_FILENAME_OTHER); + } + if (optional_metadata.extract(libdnf5::METADATA_TYPE_PRESTO)) { + dlist.push_back(MD_FILENAME_PRESTODELTA); + } + if (optional_metadata.extract(libdnf5::METADATA_TYPE_COMPS)) { + dlist.push_back(MD_FILENAME_GROUP_GZ); + } + if (optional_metadata.extract(libdnf5::METADATA_TYPE_UPDATEINFO)) { + dlist.push_back(MD_FILENAME_UPDATEINFO); + } - // download the rest metadata added by 3rd parties - for (auto & item : optional_metadata) { - dlist.push_back(item.c_str()); + // download the rest metadata added by 3rd parties + for (auto & item : optional_metadata) { + dlist.push_back(item.c_str()); + } + dlist.push_back(nullptr); + h.set_opt(LRO_YUMDLIST, dlist.data()); } - dlist.push_back(nullptr); + h.set_opt(LRO_PRESERVETIME, static_cast(preserve_remote_time)); h.set_opt(LRO_REPOTYPE, LR_YUMREPO); - h.set_opt(LRO_YUMDLIST, dlist.data()); h.set_opt(LRO_INTERRUPTIBLE, 1L); h.set_opt(LRO_GPGCHECK, config.get_repo_gpgcheck_option().get_value()); h.set_opt(LRO_MAXMIRRORTRIES, static_cast(max_mirror_tries)); diff --git a/libdnf5/repo/repo_sack.cpp b/libdnf5/repo/repo_sack.cpp index 62e6e92ad..8e7e9366c 100644 --- a/libdnf5/repo/repo_sack.cpp +++ b/libdnf5/repo/repo_sack.cpp @@ -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