$ git show --format=fuller --patch-with-stat --summary 1bc0e62d3cf0b966e818d667e6692f2088d751b5
commit 1bc0e62d3cf0b966e818d667e6692f2088d751b5
Author: tpgxyz <tpgxyz@gmail.com>
AuthorDate: Fri Nov 15 00:01:04 2019 +0100
Commit: tpgxyz <tpgxyz@gmail.com>
CommitDate: Fri Nov 15 00:01:04 2019 +0100
add patches from Fedora
---
...wVersion-s-re.sub-to-a-single-replacement.patch | 37 ++++++++++++++++++
...ecksig-Avoid-python-3.6-regex-related-dep.patch | 44 ++++++++++++++++++++++
rpmdevtools.spec | 7 +++-
3 files changed, 86 insertions(+), 2 deletions(-)
create mode 100644 0001-Limit-newVersion-s-re.sub-to-a-single-replacement.patch
create mode 100644 0001-bumpspec-checksig-Avoid-python-3.6-regex-related-dep.patch
diff --git a/0001-Limit-newVersion-s-re.sub-to-a-single-replacement.patch b/0001-Limit-newVersion-s-re.sub-to-a-single-replacement.patch
new file mode 100644
index 0000000..0efb6a5
--- /dev/null
+++ b/0001-Limit-newVersion-s-re.sub-to-a-single-replacement.patch
@@ -0,0 +1,37 @@
+From ea772dae0d8bb266233c3fd9e2012281a821ef44 Mon Sep 17 00:00:00 2001
+From: Josh Stone <jistone@redhat.com>
+Date: Fri, 2 Nov 2018 16:20:22 -0700
+Subject: [PATCH] Limit newVersion's re.sub to a single replacement
+
+Python 3.7 changed `re.sub` to replace empty matches next to a previous
+non-empty match, which caused `SpecFile.newVersion` to double its
+replacements. We can use `count=1` to limit this.
+
+ref: https://bugs.python.org/issue32308
+---
+ rpmdev-bumpspec | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/rpmdev-bumpspec b/rpmdev-bumpspec
+index 35e6c9c..06737b5 100755
+--- a/rpmdev-bumpspec
++++ b/rpmdev-bumpspec
+@@ -134,13 +134,13 @@ class SpecFile(object):
+ original = self.lines[i]
+ if self.lines[i].lower().startswith('version:'):
+ self.lines[i] = re.sub(
+- r'[^: \t]*$', v, self.lines[i].rstrip()) + '\n'
++ r'[^: \t]*$', v, self.lines[i].rstrip(), count=1) + '\n'
+ changed = changed or self.lines[i] != original
+ elif self.lines[i].lower().startswith('release:'):
+ # split and reconstruct to preserve whitespace
+ split = re.split(r':', self.lines[i].rstrip())
+ self.lines[i] = split[0] + ':' + \
+- re.sub(r'[^ \t]*$', r, split[1]) + '\n'
++ re.sub(r'[^ \t]*$', r, split[1], count=1) + '\n'
+ changed = changed or self.lines[i] != original
+
+ return changed
+--
+2.17.2
+
diff --git a/0001-bumpspec-checksig-Avoid-python-3.6-regex-related-dep.patch b/0001-bumpspec-checksig-Avoid-python-3.6-regex-related-dep.patch
new file mode 100644
index 0000000..37a11e3
--- /dev/null
+++ b/0001-bumpspec-checksig-Avoid-python-3.6-regex-related-dep.patch
@@ -0,0 +1,44 @@
+From 693c9549280b78860b756b593b5922bf3be46888 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
+Date: Wed, 15 Feb 2017 11:19:29 +0200
+Subject: [PATCH] bumpspec, checksig: Avoid python 3.6 regex related
+ deprecations
+
+---
+ rpmdev-bumpspec | 6 ++++--
+ rpmdev-checksig | 2 +-
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/rpmdev-bumpspec b/rpmdev-bumpspec
+index ea2ddd9..35e6c9c 100755
+--- a/rpmdev-bumpspec
++++ b/rpmdev-bumpspec
+@@ -44,8 +44,10 @@ class SpecFile(object):
+
+ # supported release value macro definitions
+ _macro_bump_patterns = (
+- re.compile(r"^%(?:define|global)\s+(?i)release\s+(\d+.*)"),
+- re.compile(r"^%(?:define|global)\s+(?i)baserelease\s+(\d+.*)"),
++ re.compile(r"^%(?:define|global)\s+"
++ r"[Rr][Ee][Ll][Ee][Aa][Ss][Ee]\s+(\d+.*)"),
++ re.compile(r"^%(?:define|global)\s+"
++ r"[Bb][Aa][Ss][Ee][Rr][Ee][Ll][Ee][Aa][Ss][Ee]\s+(\d+.*)"),
+ )
+ # normal "Release:" tag lines
+ _tag_bump_patterns = (
+diff --git a/rpmdev-checksig b/rpmdev-checksig
+index 0e90fe5..76b5967 100755
+--- a/rpmdev-checksig
++++ b/rpmdev-checksig
+@@ -44,7 +44,7 @@ def lookupKeyID(ts, keyid):
+ mi.pattern('version', rpm.RPMMIRE_STRCMP, keyid)
+ for hdr in mi:
+ sum = hdr['summary']
+- mo = re.search(b'\<.*\>', sum)
++ mo = re.search(rb'\<.*\>', sum)
+ email = mo.group().decode(errors='replace')
+ return email
+
+--
+2.17.1
+
diff --git a/rpmdevtools.spec b/rpmdevtools.spec
index 803cfe6..6e0755a 100644
--- a/rpmdevtools.spec
+++ b/rpmdevtools.spec
@@ -7,11 +7,14 @@
Summary: RPM Development Tools
Name: rpmdevtools
Version: 8.10
-Release: 6
+Release: 7
# rpmdev-setuptree is GPLv2, everything else GPLv2+
License: GPLv2+ and GPLv2
URL: https://pagure.io/rpmdevtools
Source0: https://releases.pagure.org/rpmdevtools/%{name}-%{version}.tar.xz
+# (tpg) add patch from Fedora
+Patch0: https://src.fedoraproject.org/rpms/rpmdevtools/raw/master/f/0001-bumpspec-checksig-Avoid-python-3.6-regex-related-dep.patch
+Patch1: https://src.fedoraproject.org/rpms/rpmdevtools/raw/master/f/0001-Limit-newVersion-s-re.sub-to-a-single-replacement.patch
BuildArch: noarch
# help2man, pod2man, *python for creating man pages
BuildRequires: help2man
@@ -52,7 +55,7 @@ rpmdev-bumpspec Bump revision in specfile
%prep
-%setup -q
+%autosetup -p1
%build
%configure --libdir=%{_prefix}/lib