From 95e33623ea4c69c1ce3360904f053d5a1a172ed3 Mon Sep 17 00:00:00 2001 From: "biao716.wang" Date: Tue, 25 Apr 2023 15:20:41 +0900 Subject: fix run error: re.error: bad escape \S at position 7 Change-Id: I6f9e25806b43aa66a1c05cad0d54edbc656f733b Signed-off-by: biao716.wang --- gbp/deb/changelog.py | 2 +- gbp/rpm/__init__.py | 2 +- gbp/scripts/common/pq.py | 1 + gbp/scripts/rpm_ch.py | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gbp/deb/changelog.py b/gbp/deb/changelog.py index 41aca947..a670332e 100644 --- a/gbp/deb/changelog.py +++ b/gbp/deb/changelog.py @@ -96,7 +96,7 @@ class ChangeLog(object): (output, errors) = cmd.communicate(self._contents.encode('utf-8')) if cmd.returncode: raise ParseChangeLogError("Failed to parse changelog. " - "dpkg-parsechangelog said:\n%s" % errors.decode().strip())) + "dpkg-parsechangelog said:\n%s" % errors.decode().strip()) # Parse the result of dpkg-parsechangelog (which looks like # email headers) cp = email.message_from_string(output) diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py index 62f0c279..0affa457 100644 --- a/gbp/rpm/__init__.py +++ b/gbp/rpm/__init__.py @@ -199,7 +199,7 @@ class SpecFile(object): librpm.spec(filtered.name) return librpm.spec(filtered.name) except ValueError as err: - rpmlog = get_librpm_log() + rpmlog = [log.decode() for log in get_librpm_log()] gbp.log.debug("librpm log:\n %s" % "\n ".join(rpmlog)) raise GbpError("RPM error while parsing %s: %s (%s)" % diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py index 95516c08..05993d1d 100644 --- a/gbp/scripts/common/pq.py +++ b/gbp/scripts/common/pq.py @@ -182,6 +182,7 @@ def patch_path_filter(file_status, exclude_regex=None): include_paths = [] for file_list in list(file_status.values()): for fname in file_list: + fname = fname.decode() if not re.match(exclude_regex, fname): include_paths.append(fname) else: diff --git a/gbp/scripts/rpm_ch.py b/gbp/scripts/rpm_ch.py index b2a836aa..d134b76d 100755 --- a/gbp/scripts/rpm_ch.py +++ b/gbp/scripts/rpm_ch.py @@ -186,7 +186,7 @@ def guess_commit(section, repo, options): header = section.header # Try to parse the fields from the header revision - rev_re = '^%s$' % re.sub(r'%\((\S+?)\)s', r'(?P<\1>\S+)', + rev_re = '^%s$' % re.sub(r'%\((\S+?)\)s', r'(?P<\1>\\S+)', options.changelog_revision) match = re.match(rev_re, header['revision'], re.I) fields = match.groupdict() if match else {} -- cgit v1.2.3