Commit 0730a57d authored by Guido Günther's avatar Guido Günther

patch_series: Don't fail on decoding errors when looking for DEP3 headers

Closes: #885929
parent 7b0660ab
......@@ -236,7 +236,7 @@ class Dep3Patch(Patch):
# header and diff stat
headers = collections.OrderedDict()
current = 'long_desc'
with open(self.path) as file:
with open(self.path, errors='replace') as file:
for line in file:
if VALID_DEP3_ENDS.search(line):
break
......@@ -254,6 +254,7 @@ class Dep3Patch(Patch):
self._dep3_to_info(headers)
class PatchSeries(list):
"""
A series of L{Patch}es as read from a quilt series file).
......
......@@ -7,7 +7,7 @@ from . import context # noqa: 401
import os
import unittest
from gbp.patch_series import Patch
from gbp.patch_series import Patch, Dep3Patch
class TestPatch(unittest.TestCase):
......@@ -38,3 +38,17 @@ class TestPatch(unittest.TestCase):
"It can span several lines.\n",
p.long_desc)
self.assertEqual('Sat, 24 Dec 2011 12:05:53 +0100', p.date)
class TestDep3Patch(unittest.TestCase):
data_dir = os.path.splitext(__file__)[0] + '_data'
def test_encoding(self):
"""Make sure broken encoding does no affect import"""
patchfile = os.path.join(self.data_dir, "dep3-iso8859-1.patch")
self.assertTrue(os.path.exists(patchfile))
p = Dep3Patch(patchfile)
self.assertEqual('Replace all -- in man page by \-\- to make lintian happy.', p.subject)
self.assertEqual("Roland Rosenfeld", p.author)
self.assertEqual("roland@debian.org", p.email)
self.assertEqual("", p.long_desc)
Author: Roland Rosenfeld <roland@debian.org>
Description: Replace all -- in man page by \-\- to make lintian happy.
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -484,8 +484,7 @@ man: dok-release
perl -pi.bak -e "s/\[ /\[/g;s//\\\\['a]/g;s//\\\\['e]/g" $(MAN_PAGE); \
perl -pi.bak -e "s//\\\\[:o]/g" $(MAN_PAGE); \
perl -pi.bak -e 's/([ {])-([a-z])/$$1\\-$$2/g' $(MAN_PAGE); \
- perl -pi.bak -e 's/ --([a-z])/ \\-\\-$$1/g' $(MAN_PAGE); \
- perl -pi.bak -e 's/\\fB--/\\fB\\-\\-/g' $(MAN_PAGE); \
+ perl -pi.bak -e 's/--/\\-\\-/g' $(MAN_PAGE); \
$(DB) ../privoxy-man-page.sgml && $(MV) -f $(MAN_PAGE) ../../../$(MAN_PAGE)
# For those with man2html ala RH7s.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment