Skip to content

Commit 522793b

Browse files
evan-goodeConan-Kudo
authored andcommitted
ConfigParser: make splitReleasever public
1 parent 18a7db6 commit 522793b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

bindings/swig/conf.i

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ public:
195195
std::string & getHeader() noexcept;
196196
const Container & getData() const noexcept;
197197
Container & getData() noexcept;
198+
static std::pair<std::string, std::string> splitReleasever(const std::string & releasever);
198199
};
199200
}
200201
%clear std::string & text;

libdnf/conf/ConfigParser.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ std::pair<std::string, size_t> ConfigParser::substitute_expression(const std::st
103103
if (variable_key == "releasever_major" || variable_key == "releasever_minor") {
104104
const auto releasever_mapping = substitutions.find("releasever");
105105
if (releasever_mapping != substitutions.end()) {
106-
const auto & releasever_split = ConfigParser::split_releasever(releasever_mapping->second);
106+
const auto & releasever_split = ConfigParser::splitReleasever(releasever_mapping->second);
107107
if (variable_key == "releasever_major") {
108108
variable_value = std::get<0>(releasever_split);
109109
variable_value_has_value = true;
@@ -231,7 +231,7 @@ std::pair<std::string, size_t> ConfigParser::substitute_expression(const std::st
231231
return std::make_pair(res, text.length());
232232
}
233233

234-
std::tuple<std::string, std::string> ConfigParser::split_releasever(const std::string & releasever)
234+
std::pair<std::string, std::string> ConfigParser::splitReleasever(const std::string & releasever)
235235
{
236236
// Uses the same logic as DNF 5 and as splitReleaseverTo in libzypp
237237
std::string releasever_major;
@@ -243,7 +243,7 @@ std::tuple<std::string, std::string> ConfigParser::split_releasever(const std::s
243243
releasever_major = releasever.substr(0, pos);
244244
releasever_minor = releasever.substr(pos + 1);
245245
}
246-
return std::make_tuple(releasever_major, releasever_minor);
246+
return std::make_pair(releasever_major, releasever_minor);
247247
}
248248

249249
static void read(ConfigParser & cfgParser, IniParser & parser)

libdnf/conf/ConfigParser.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ struct ConfigParser {
140140
std::string & getHeader() noexcept;
141141
const Container & getData() const noexcept;
142142
Container & getData() noexcept;
143+
static std::pair<std::string, std::string> splitReleasever(const std::string & releasever);
143144

144145
private:
145146
std::map<std::string, std::string> substitutions;
@@ -159,8 +160,6 @@ struct ConfigParser {
159160
static std::pair<std::string, size_t> substitute_expression(const std::string & text,
160161
const std::map<std::string, std::string> & substitutions,
161162
unsigned int depth);
162-
163-
static std::tuple<std::string, std::string> split_releasever(const std::string & releasever);
164163
};
165164

166165
inline void ConfigParser::setSubstitutions(const std::map<std::string, std::string> & substitutions)

0 commit comments

Comments
 (0)