Skip to content

Commit

Permalink
[repo] Method to get all repository metadata locations
Browse files Browse the repository at this point in the history
Needed so that command "dnf reposync --urls --download-metadata" was
able to print out also URLs of the repository metadata.

Closes: #770
Approved by: <try>
  • Loading branch information
m-blaha authored and rh-atomic-bot committed Sep 9, 2019
1 parent f8a9b95 commit 2a273c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions libdnf/repo/Repo-private.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class Repo::Impl {
std::string revision;
std::vector<std::string> content_tags;
std::vector<std::pair<std::string, std::string>> distro_tags;
std::vector<std::pair<std::string, std::string>> metadata_locations;
unsigned char checksum[CHKSUM_BYTES];
bool useIncludes{false};
bool loadMetadataOther;
Expand Down
14 changes: 14 additions & 0 deletions libdnf/repo/Repo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,15 @@ bool Repo::Impl::loadCache(bool throwExcept)
distro_tags.emplace_back(distroTag->cpeid, distroTag->tag);
}
}

metadata_locations.clear();
for (auto elem = yum_repomd->records; elem; elem = g_slist_next(elem)) {
if (elem->data) {
auto rec = static_cast<LrYumRepoMdRecord *>(elem->data);
metadata_locations.emplace_back(rec->type, rec->location_href);
}
}

if (auto cRevision = yum_repomd->revision) {
revision = cRevision;
}
Expand Down Expand Up @@ -1499,6 +1508,11 @@ const std::vector<std::pair<std::string, std::string>> & Repo::getDistroTags()
return pImpl->distro_tags;
}

const std::vector<std::pair<std::string, std::string>> Repo::getMetadataLocations() const
{
return pImpl->metadata_locations;
}

const std::string & Repo::getRevision() const
{
return pImpl->revision;
Expand Down
1 change: 1 addition & 0 deletions libdnf/repo/Repo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ struct Repo {

const std::vector<std::string> & getContentTags();
const std::vector<std::pair<std::string, std::string>> & getDistroTags();
const std::vector<std::pair<std::string, std::string>> getMetadataLocations() const;

std::string getCachedir() const;
void setRepoFilePath(const std::string & path);
Expand Down

0 comments on commit 2a273c6

Please sign in to comment.