diff --git a/SOURCES/0002-Add-log-file-level-main-config-option-RhBug-1802074.patch b/SOURCES/0002-Add-log-file-level-main-config-option-RhBug-1802074.patch new file mode 100644 index 0000000..078e3ba --- /dev/null +++ b/SOURCES/0002-Add-log-file-level-main-config-option-RhBug-1802074.patch @@ -0,0 +1,51 @@ +From 69e7baa4f6484c39ce25869d0c6252393b7c0411 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= +Date: Thu, 4 Jun 2020 11:13:48 +0200 +Subject: [PATCH] Add log file level main config option (RhBug:1802074) + +https://bugzilla.redhat.com/show_bug.cgi?id=1802074 +--- + libdnf/conf/ConfigMain.cpp | 3 +++ + libdnf/conf/ConfigMain.hpp | 1 + + 4 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/libdnf/conf/ConfigMain.cpp b/libdnf/conf/ConfigMain.cpp +index 305b8e233..06352b7f3 100644 +--- a/libdnf/conf/ConfigMain.cpp ++++ b/libdnf/conf/ConfigMain.cpp +@@ -169,6 +169,7 @@ class ConfigMain::Impl { + + OptionNumber debuglevel{2, 0, 10}; + OptionNumber errorlevel{3, 0, 10}; ++ OptionNumber logfilelevel{9, 0, 10}; + OptionPath installroot{"/", false, true}; + OptionPath config_file_path{CONF_FILENAME}; + OptionBool plugins{true}; +@@ -350,6 +351,7 @@ ConfigMain::Impl::Impl(Config & owner) + { + owner.optBinds().add("debuglevel", debuglevel); + owner.optBinds().add("errorlevel", errorlevel); ++ owner.optBinds().add("logfilelevel", logfilelevel); + owner.optBinds().add("installroot", installroot); + owner.optBinds().add("config_file_path", config_file_path); + owner.optBinds().add("plugins", plugins); +@@ -491,6 +493,7 @@ ConfigMain::~ConfigMain() = default; + + OptionNumber & ConfigMain::debuglevel() { return pImpl->debuglevel; } + OptionNumber & ConfigMain::errorlevel() { return pImpl->errorlevel; } ++OptionNumber & ConfigMain::logfilelevel() { return pImpl->logfilelevel; } + OptionString & ConfigMain::installroot() { return pImpl->installroot; } + OptionString & ConfigMain::config_file_path() { return pImpl->config_file_path; } + OptionBool & ConfigMain::plugins() { return pImpl->plugins; } +diff --git a/libdnf/conf/ConfigMain.hpp b/libdnf/conf/ConfigMain.hpp +index 118ecbf1c..706471029 100644 +--- a/libdnf/conf/ConfigMain.hpp ++++ b/libdnf/conf/ConfigMain.hpp +@@ -49,6 +49,7 @@ class ConfigMain : public Config { + + OptionNumber & debuglevel(); + OptionNumber & errorlevel(); ++ OptionNumber & logfilelevel(); + OptionString & installroot(); + OptionString & config_file_path(); + OptionBool & plugins(); diff --git a/SOURCES/0003-Accept-double-eq-as-an-operator-in-reldeps-RhBug-1847946.patch b/SOURCES/0003-Accept-double-eq-as-an-operator-in-reldeps-RhBug-1847946.patch new file mode 100644 index 0000000..f903099 --- /dev/null +++ b/SOURCES/0003-Accept-double-eq-as-an-operator-in-reldeps-RhBug-1847946.patch @@ -0,0 +1,83 @@ +From 227cf617dd6afd7583f1c864c66ba2ca95e3d09d Mon Sep 17 00:00:00 2001 +From: Pavla Kratochvilova +Date: Wed, 24 Jun 2020 08:48:49 +0200 +Subject: [PATCH 1/2] Accept '==' as an operator in reldeps (RhBug:1847946) + +Although rpm doesn't support this and using '==' can result in an +unexpected behavior, libdnf accepted '==' by mistake for some time and +other tools (namely Ansible Tower) already rely on it. + +This brings back the '==' support with a deprecation warning. + +https://bugzilla.redhat.com/show_bug.cgi?id=1847946 +--- + libdnf/repo/DependencySplitter.cpp | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/libdnf/repo/DependencySplitter.cpp b/libdnf/repo/DependencySplitter.cpp +index 0030ea6d3..402962286 100644 +--- a/libdnf/repo/DependencySplitter.cpp ++++ b/libdnf/repo/DependencySplitter.cpp +@@ -20,16 +20,21 @@ + + #include "DependencySplitter.hpp" + #include "../dnf-sack.h" ++#include "../log.hpp" + #include "../utils/regex/regex.hpp" + ++#include "bgettext/bgettext-lib.h" ++#include "tinyformat/tinyformat.hpp" ++ + namespace libdnf { + + static const Regex RELDEP_REGEX = +- Regex("^(\\S*)\\s*(<=|>=|<|>|=)?\\s*(\\S*)$", REG_EXTENDED); ++ Regex("^(\\S*)\\s*(<=|>=|<|>|=|==)?\\s*(\\S*)$", REG_EXTENDED); + + static bool + getCmpFlags(int *cmp_type, std::string matchCmpType) + { ++ auto logger(Log::getLogger()); + int subexpr_len = matchCmpType.size(); + auto match_start = matchCmpType.c_str(); + if (subexpr_len == 2) { +@@ -41,6 +46,13 @@ getCmpFlags(int *cmp_type, std::string matchCmpType) + *cmp_type |= HY_GT; + *cmp_type |= HY_EQ; + } ++ else if (strncmp(match_start, "==", 2) == 0) { ++ auto msg = tfm::format(_("Using '==' operator in reldeps can result in an undefined " ++ "behavior. It is deprecated and the support will be dropped " ++ "in future versions. Use '=' operator instead.")); ++ logger->warning(msg); ++ *cmp_type |= HY_EQ; ++ } + else + return false; + } else if (subexpr_len == 1) { + +From 1f9b14f1d30113a602e18f60ef7ba1f11aead10f Mon Sep 17 00:00:00 2001 +From: Pavla Kratochvilova +Date: Wed, 24 Jun 2020 13:08:48 +0200 +Subject: [PATCH 2/2] Add tests for '==' operator in reldeps + +--- + python/hawkey/tests/tests/test_reldep.py | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/python/hawkey/tests/tests/test_reldep.py b/python/hawkey/tests/tests/test_reldep.py +index 8b479cfd7..a9f6cae6f 100644 +--- a/python/hawkey/tests/tests/test_reldep.py ++++ b/python/hawkey/tests/tests/test_reldep.py +@@ -61,6 +61,11 @@ def test_custom_querying(self): + reldep = hawkey.Reldep(self.sack, "P-lib = 3-3") + q = hawkey.Query(self.sack).filter(provides=reldep) + self.assertLength(q, 1) ++ # '==' operator is deprecated and the support will be dropped in future ++ # versions (see bug 1847946) ++ reldep = hawkey.Reldep(self.sack, "P-lib == 3-3") ++ q = hawkey.Query(self.sack).filter(provides=reldep) ++ self.assertLength(q, 1) + reldep = hawkey.Reldep(self.sack, "P-lib >= 3") + q = hawkey.Query(self.sack).filter(provides=reldep) + self.assertLength(q, 1) diff --git a/SPECS/libdnf.spec b/SPECS/libdnf.spec index 65f8aac..07ef99c 100644 --- a/SPECS/libdnf.spec +++ b/SPECS/libdnf.spec @@ -54,12 +54,14 @@ Name: libdnf Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version} -Release: 2%{?dist} +Release: 3%{?dist} Summary: Library providing simplified C and Python API to libsolv License: LGPLv2+ URL: https://github.com/rpm-software-management/libdnf Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz Patch1: 0001-history-Fix-dnf-history-rollback-when-a-package-was-removed-RhBug1683134.patch +Patch2: 0002-Add-log-file-level-main-config-option-RhBug-1802074.patch +Patch3: 0003-Accept-double-eq-as-an-operator-in-reldeps-RhBug-1847946.patch BuildRequires: cmake BuildRequires: gcc @@ -307,6 +309,10 @@ popd %endif %changelog +* Fri Jul 17 2020 Nicola Sella - 0.48.0-3 +- Add log file level main config option (RhBug:1802074) +- Accept '==' as an operator in reldeps (RhBug:1847946) + * Wed Jun 10 2020 Ales Matej - 0.48.0-2 - [history] Fix dnf history rollback when a package was removed (RhBug:1683134)