Skip to content

Commit

Permalink
repo: While cloning root metadata copy also metalink
Browse files Browse the repository at this point in the history
Although metalink.xml is located out of repodata directory, it should be
cloned with repository metadata.
Without correct metalink.xml for example doesn't work package remote
location resolving (because mirrors stored in metalink.xml are unknown).
  • Loading branch information
m-blaha committed Nov 21, 2024
1 parent 53cdd9c commit e2499cc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions libdnf5/repo/repo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,13 @@ bool Repo::clone_root_metadata() {
repo_cache.remove_solv_files();

auto repodata_cachedir = std::filesystem::path(repo_cachedir) / CACHE_METADATA_DIR;
auto root_repodata_metalink = std::filesystem::path(root_repo_cachedir) / CACHE_METALINK_FILE;
try {
std::filesystem::create_directories(repodata_cachedir);
std::filesystem::copy(root_repodata_cachedir, repodata_cachedir);
if (std::filesystem::exists(root_repodata_metalink)) {
std::filesystem::copy(root_repodata_metalink, repo_cachedir);
}
} catch (const std::filesystem::filesystem_error & e) {
logger.debug(
"Error when cloning root repodata from \"{}\" to \"{}\" : \"{}\"",
Expand Down
1 change: 0 additions & 1 deletion libdnf5/repo/repo_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ namespace {

constexpr const char * CACHE_ATTRS_DIR = "attrs";
constexpr const char * CACHE_MIRRORLIST_FILE = "mirrorlist";
constexpr const char * CACHE_METALINK_FILE = "metalink.xml";


// Removes a file or empty directory.
Expand Down
1 change: 1 addition & 0 deletions libdnf5/repo/repo_cache_private.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace {
constexpr const char * CACHE_METADATA_DIR = "repodata";
constexpr const char * CACHE_PACKAGES_DIR = "packages";
constexpr const char * CACHE_SOLV_FILES_DIR = "solv";
constexpr const char * CACHE_METALINK_FILE = "metalink.xml";

} // namespace

Expand Down

0 comments on commit e2499cc

Please sign in to comment.