diff --git a/0002-Don-t-use-undocumented-re.template.patch b/0002-Don-t-use-undocumented-re.template.patch new file mode 100644 index 0000000..4598c35 --- /dev/null +++ b/0002-Don-t-use-undocumented-re.template.patch @@ -0,0 +1,36 @@ +From 8f304e6baa3ea54bb72d8e7e0f5e4143d16678df Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Thu, 12 May 2022 16:19:00 +0200 +Subject: [PATCH] Don't use undocumented re.template() + +Python 3.11.0b1 removed it: https://github.com/python/cpython/commit/b09184bf05 + +It might be resurrected for a proper deprecation period, but it is going away. + +See https://github.com/python/cpython/issues/92728 + +I've looked at the original commit that introduced this code: 6707f479bb +There is no clear indication that would suggest why re.template was used. +--- + dnf/cli/term.py | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/dnf/cli/term.py b/dnf/cli/term.py +index aa075cfe..7361567a 100644 +--- a/dnf/cli/term.py ++++ b/dnf/cli/term.py +@@ -287,9 +287,8 @@ class Term(object): + render = lambda match: beg + match.group() + end + for needle in needles: + pat = escape(needle) +- if ignore_case: +- pat = re.template(pat, re.I) +- haystack = re.sub(pat, render, haystack) ++ flags = re.I if ignore_case else 0 ++ haystack = re.sub(pat, render, haystack, flags=flags) + return haystack + def sub_norm(self, haystack, beg, needles, **kwds): + """Search the string *haystack* for all occurrences of any +-- +2.35.3 + diff --git a/dnf.spec b/dnf.spec index 5968b58..188babd 100644 --- a/dnf.spec +++ b/dnf.spec @@ -66,7 +66,7 @@ It supports RPMs, modules and comps groups & environments. Name: dnf Version: 4.12.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: %{pkg_summary} # For a breakdown of the licensing, see PACKAGE-LICENSING License: GPLv2+ @@ -74,7 +74,8 @@ URL: https://github.com/rpm-software-management/dnf Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz # Upstream commit which fixes leak of libsolv's page file descriptors. # https://github.com/rpm-software-management/dnf/commit/5ce5ed1ea08ad6e198c1c1642c4d9ea2db6eab86 -Patch0002: 0001-Base.reset-plug-temporary-leak-of-libsolv-s-page-fil.patch +Patch0001: 0001-Base.reset-plug-temporary-leak-of-libsolv-s-page-fil.patch +Patch0002: 0002-Don-t-use-undocumented-re.template.patch BuildArch: noarch BuildRequires: cmake BuildRequires: gettext @@ -362,6 +363,9 @@ popd %{python3_sitelib}/%{name}/automatic/ %changelog +* Fri May 13 2022 Marek Blaha - 4.12.0-2 +- Backport patch to not use re.template() deprecated in Python 3.11 + * Thu May 05 2022 Jaroslav Rohel - 4.12.0-1 - Update to 4.12.0 - dnf.conf: hint users where to find more info about defaults and other options