ConfigParser: make splitReleasever public
Resolves: RHEL-76498
This commit is contained in:
parent
dbfef8aa4f
commit
547e78bb3e
80
0008-ConfigParser-make-splitReleasever-public.patch
Normal file
80
0008-ConfigParser-make-splitReleasever-public.patch
Normal file
@ -0,0 +1,80 @@
|
||||
From 73ec298e31c8cd21fe5761a2e838951b2efdbf6f Mon Sep 17 00:00:00 2001
|
||||
From: Evan Goode <mail@evangoo.de>
|
||||
Date: Tue, 21 Jan 2025 19:19:06 +0000
|
||||
Subject: [PATCH] ConfigParser: make splitReleasever public
|
||||
|
||||
Upstream commit: 522793b258da0b1f70c1f380b2c01ddfd27bc193
|
||||
Resolves: https://issues.redhat.com/browse/RHEL-68034
|
||||
---
|
||||
bindings/swig/conf.i | 1 +
|
||||
libdnf/conf/ConfigParser.cpp | 6 +++---
|
||||
libdnf/conf/ConfigParser.hpp | 3 +--
|
||||
3 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/bindings/swig/conf.i b/bindings/swig/conf.i
|
||||
index b6a0ce88..c42d5673 100644
|
||||
--- a/bindings/swig/conf.i
|
||||
+++ b/bindings/swig/conf.i
|
||||
@@ -199,6 +199,7 @@ public:
|
||||
std::string & getHeader() noexcept;
|
||||
const Container & getData() const noexcept;
|
||||
Container & getData() noexcept;
|
||||
+ static std::pair<std::string, std::string> splitReleasever(const std::string & releasever);
|
||||
};
|
||||
}
|
||||
%clear std::string & text;
|
||||
diff --git a/libdnf/conf/ConfigParser.cpp b/libdnf/conf/ConfigParser.cpp
|
||||
index 977da757..186acdc8 100644
|
||||
--- a/libdnf/conf/ConfigParser.cpp
|
||||
+++ b/libdnf/conf/ConfigParser.cpp
|
||||
@@ -103,7 +103,7 @@ std::pair<std::string, size_t> ConfigParser::substitute_expression(const std::st
|
||||
if (variable_key == "releasever_major" || variable_key == "releasever_minor") {
|
||||
const auto releasever_mapping = substitutions.find("releasever");
|
||||
if (releasever_mapping != substitutions.end()) {
|
||||
- const auto & releasever_split = ConfigParser::split_releasever(releasever_mapping->second);
|
||||
+ const auto & releasever_split = ConfigParser::splitReleasever(releasever_mapping->second);
|
||||
if (variable_key == "releasever_major") {
|
||||
variable_value = std::get<0>(releasever_split);
|
||||
variable_value_has_value = true;
|
||||
@@ -231,7 +231,7 @@ std::pair<std::string, size_t> ConfigParser::substitute_expression(const std::st
|
||||
return std::make_pair(res, text.length());
|
||||
}
|
||||
|
||||
-std::tuple<std::string, std::string> ConfigParser::split_releasever(const std::string & releasever)
|
||||
+std::pair<std::string, std::string> ConfigParser::splitReleasever(const std::string & releasever)
|
||||
{
|
||||
// Uses the same logic as DNF 5 and as splitReleaseverTo in libzypp
|
||||
std::string releasever_major;
|
||||
@@ -243,7 +243,7 @@ std::tuple<std::string, std::string> ConfigParser::split_releasever(const std::s
|
||||
releasever_major = releasever.substr(0, pos);
|
||||
releasever_minor = releasever.substr(pos + 1);
|
||||
}
|
||||
- return std::make_tuple(releasever_major, releasever_minor);
|
||||
+ return std::make_pair(releasever_major, releasever_minor);
|
||||
}
|
||||
|
||||
static void read(ConfigParser & cfgParser, IniParser & parser)
|
||||
diff --git a/libdnf/conf/ConfigParser.hpp b/libdnf/conf/ConfigParser.hpp
|
||||
index 584bd268..de8a0c9d 100644
|
||||
--- a/libdnf/conf/ConfigParser.hpp
|
||||
+++ b/libdnf/conf/ConfigParser.hpp
|
||||
@@ -140,6 +140,7 @@ public:
|
||||
std::string & getHeader() noexcept;
|
||||
const Container & getData() const noexcept;
|
||||
Container & getData() noexcept;
|
||||
+ static std::pair<std::string, std::string> splitReleasever(const std::string & releasever);
|
||||
|
||||
private:
|
||||
std::map<std::string, std::string> substitutions;
|
||||
@@ -159,8 +160,6 @@ private:
|
||||
static std::pair<std::string, size_t> substitute_expression(const std::string & text,
|
||||
const std::map<std::string, std::string> & substitutions,
|
||||
unsigned int depth);
|
||||
-
|
||||
- static std::tuple<std::string, std::string> split_releasever(const std::string & releasever);
|
||||
};
|
||||
|
||||
inline void ConfigParser::setSubstitutions(const std::map<std::string, std::string> & substitutions)
|
||||
--
|
||||
2.48.1
|
||||
|
@ -56,7 +56,7 @@
|
||||
|
||||
Name: libdnf
|
||||
Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version}
|
||||
Release: 7%{?dist}
|
||||
Release: 8%{?dist}
|
||||
Summary: Library providing simplified C and Python API to libsolv
|
||||
License: LGPL-2.1-or-later
|
||||
URL: https://github.com/rpm-software-management/libdnf
|
||||
@ -68,6 +68,7 @@ Patch4: 0004-Set-pool-flag-to-fix-pool_addfileprovides_queue-with.patch
|
||||
Patch5: 0005-ConfigParser-fix-use-out-of-scope-leaks.patch
|
||||
Patch6: 0006-Add-tests-for-shell-style-variable-expansion.patch
|
||||
Patch7: 0007-Add-persistence-config-option.patch
|
||||
Patch8: 0008-ConfigParser-make-splitReleasever-public.patch
|
||||
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gcc
|
||||
@ -311,6 +312,9 @@ popd
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Fri Feb 07 2025 Carl George <carl@redhat.com> - 0.73.1-8
|
||||
- ConfigParser: make splitReleasever public (RHEL-68034)
|
||||
|
||||
* Wed Feb 05 2025 Petr Pisar <ppisar@redhat.com> - 0.73.1-7
|
||||
- Add persistence configuration option (RHEL-78034)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user