Skip to content

Commit

Permalink
Set substitution for librepo handle from Base Vars
Browse files Browse the repository at this point in the history
It allows substitutions in mirrorlist.

Additionally it marks method of Repo class as deprecated, because it is
not required anymore.

Closes: #761
  • Loading branch information
j-mracek committed Jul 27, 2023
1 parent 33c14a3 commit 24508e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/libdnf5/repo/repo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ class Repo {
// @replaces libdnf:repo/Repo.hpp:method:Repo.getMirrors()
std::vector<std::string> get_mirrors() const;

/// @deprecated It is redundant because repo class has direct access to Base and Vars
/// Sets substitutions. Substitutions are used to substitute variables in repository configuration.
// @replaces libdnf:repo/Repo.hpp:method:Repo.setSubstitutions(const std::map<std::string, std::string> & substitutions)
void set_substitutions(const std::map<std::string, std::string> & substitutions);
Expand Down
4 changes: 4 additions & 0 deletions libdnf5/repo/repo_downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,13 @@ void RepoDownloader::common_handle_setup(LibrepoHandle & h) {
h.set_opt(LRO_YUMSLIST, repomd_substs);

LrUrlVars * substs = nullptr;
// Deprecated, we have direct access to base, therefore we don't need to set explicitly substitutions
for (const auto & item : substitutions) {
substs = lr_urlvars_set(substs, item.first.c_str(), item.second.c_str());
}
for (const auto & item : base->get_vars()->get_variables()) {
substs = lr_urlvars_set(substs, item.first.c_str(), item.second.value.c_str());
}
h.set_opt(LRO_VARSUB, substs);

#ifdef LRO_SUPPORTS_CACHEDIR
Expand Down

0 comments on commit 24508e6

Please sign in to comment.