From ffd4af3957902533f0baf681ee058b94d601a29b Mon Sep 17 00:00:00 2001 From: Jerry James Date: Mar 11 2020 15:34:54 +0000 Subject: Drop the -decode-binary-to-unicode patch; it doesn't work with the bundled version of iso8601. Add 0003 and 0004 patches to fix bugs reported to upstream. --- diff --git a/0003-Rely-on-file.__iter__-rather-than-file.readlines.patch b/0003-Rely-on-file.__iter__-rather-than-file.readlines.patch new file mode 100644 index 0000000..ed79886 --- /dev/null +++ b/0003-Rely-on-file.__iter__-rather-than-file.readlines.patch @@ -0,0 +1,29 @@ +From 13d6aaa40c297e721209b29a9a08f9229462daab Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= +Date: Fri, 15 Jun 2018 15:56:22 +0100 +Subject: [PATCH] Rely on file.__iter__ rather than file.readlines. + +--- + python/subunit/__init__.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py +index b3b198c..81b773c 100644 +--- a/python/subunit/__init__.py ++++ b/python/subunit/__init__.py +@@ -579,10 +579,10 @@ class TestProtocolServer(object): + def readFrom(self, pipe): + """Blocking convenience API to parse an entire stream. + +- :param pipe: A file-like object supporting readlines(). ++ :param pipe: A file-like object supporting __iter__. + :return: None. + """ +- for line in pipe.readlines(): ++ for line in pipe: + self.lineReceived(line) + self.lostConnection() + +-- +2.24.1 + diff --git a/0004-Check-written-bytes-are-not-None-before-summing-them.patch b/0004-Check-written-bytes-are-not-None-before-summing-them.patch new file mode 100644 index 0000000..d4cf472 --- /dev/null +++ b/0004-Check-written-bytes-are-not-None-before-summing-them.patch @@ -0,0 +1,31 @@ +From 44af2b1eebd438178681fd3a1af38d9def2f93e9 Mon Sep 17 00:00:00 2001 +From: Federico Ressi +Date: Fri, 27 Sep 2019 12:44:13 +0200 +Subject: [PATCH] Check written bytes are not None before summing them to + offset + +Because purely written streams could return None instead of written +bytes, we cannot sum them to offset integer. On such case let +assume data has been written all at once. + +This fixes LaunchPad [#1845631](https://bugs.launchpad.net/subunit/+bug/1845631) +--- + python/subunit/v2.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/python/subunit/v2.py b/python/subunit/v2.py +index 254617c..7f4842e 100644 +--- a/python/subunit/v2.py ++++ b/python/subunit/v2.py +@@ -223,6 +223,8 @@ class StreamResultToBytes(object): + offset = 0 + while offset < datalen: + written = self.output_stream.write(view[offset:]) ++ if written is None: ++ break + offset += written + else: + self.output_stream.write(data) +-- +2.24.1 + diff --git a/subunit-decode-binary-to-unicode.patch b/subunit-decode-binary-to-unicode.patch deleted file mode 100644 index 5410e92..0000000 --- a/subunit-decode-binary-to-unicode.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 2051f178d568a1595f497308703495b9e33ff80b Mon Sep 17 00:00:00 2001 -From: Lukas Bezdicka -Date: Wed, 2 Sep 2015 06:55:42 -0400 -Subject: [PATCH] Correctly decode binary to utf8 string - -This patch solves error: - Expecting a string b'2014-12-16 20:42:25.441886Z' - -Related-Bug: #1403214 ---- - python/subunit/__init__.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py -index 7d864e8..b198884 100644 ---- a/python/subunit/__init__.py -+++ b/python/subunit/__init__.py -@@ -556,7 +556,7 @@ def _handleTags(self, offset, line): - def _handleTime(self, offset, line): - # Accept it, but do not do anything with it yet. - try: -- event_time = iso8601.parse_date(line[offset:-1]) -+ event_time = iso8601.parse_date(line[offset:-1].decode('utf8')) - except TypeError: - raise TypeError(_u("Failed to parse %r, got %r") - % (line, sys.exec_info[1])) diff --git a/subunit.spec b/subunit.spec index 954e4f1..a8217dd 100644 --- a/subunit.spec +++ b/subunit.spec @@ -12,7 +12,7 @@ Name: subunit Version: 1.3.0 -Release: 18%{?dist} +Release: 19%{?dist} Summary: C bindings for subunit %global majver %(cut -d. -f-2 <<< %{version}) @@ -20,15 +20,18 @@ Summary: C bindings for subunit License: ASL 2.0 or BSD URL: https://launchpad.net/%{name} Source0: https://launchpad.net/%{name}/trunk/%{majver}/+download/%{name}-%{version}.tar.gz -# Merged upsteam: https://github.com/testing-cabal/subunit/pull/10 -Patch0: %{name}-decode-binary-to-unicode.patch # Migrate Gtk interface to GObject introspection # Merged upstream: https://github.com/testing-cabal/subunit/pull/34 -Patch1: 0001-Migrate-Gtk-interface-to-GObject-introspection.patch +Patch0: 0001-Migrate-Gtk-interface-to-GObject-introspection.patch # Fix python3 # Merged upstream: https://github.com/testing-cabal/subunit/pull/36 -Patch2: 0002-Fix-file-open-for-python3.patch - +Patch1: 0002-Fix-file-open-for-python3.patch +# Rely on file.__iter__ rather than file.readlines +# https://github.com/testing-cabal/subunit/commit/13d6aaa40c297e721209b29a9a08f9229462daab +Patch2: 0003-Rely-on-file.__iter__-rather-than-file.readlines.patch +# Check written bytes are not None before summing them to offset +# https://github.com/testing-cabal/subunit/commit/44af2b1eebd438178681fd3a1af38d9def2f93e9 +Patch3: 0004-Check-written-bytes-are-not-None-before-summing-them.patch BuildRequires: check-devel BuildRequires: cppunit-devel @@ -441,6 +444,11 @@ popd %exclude %{_bindir}/%{name}-diff %changelog +* Wed Mar 11 2020 Jerry James - 1.3.0-19 +- Drop the -decode-binary-to-unicode patch; it doesn't work with the bundled + version of iso8601. +- Add 0003 and 0004 patches to fix bugs reported to upstream. + * Tue Mar 10 2020 Jerry James - 1.3.0-18 - The python iso8601 module in Fedora has diverged too much from the bundled version. Allow this package to bundle it (bz 1811697).