Hi.  I fixed this bug, and some other FTBFS, and am about to upload
the result.  I'm doing this myself, right away, because this is an RC
bug which has triggered the autoremover to want to remove dgit.

Following the recommendation in dev ref 5.11.1, I have not use
DELAYED; and because I doubt that actually uploading it now will cause
you any difficulty.  I hope that's OK.

The patches I made are attached.  You can also find this as a git
branch, here:
  git://git.chiark.greenend.org.uk/~ianmdlvl/git-buildpackage.git -b dgit/sid
  (commit hash 0259f5979f5adf1a4826344813a1b0294a01638b)
  
https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=git-buildpackage.git;a=shortlog;h=refs/heads/dgit/sid
or of course from the Debian archive and dgit git server with
  dgit clone git-buildpackage
or in a git working tree of git-buildpackage
  dgit fetch
(which will produce a ref remotes/dgit/dgit/sid).

Unfortunately my git branch is based not on the upstream history but
on the .dsc imported by dgit (because the last upload to sid was
.dsc-based rather than done with dgit push).  I did try to fetch from
the upstream git server git.sigxcpu.org but I got very long delays and
strange errors and a semi-corrupted git repository (!).  Sadly I was
not able to reproduce the malfunction to report it, but it scared me
off.

You should be able to rebase my series without trouble onto your own
history, though.

I hope you find this helpful and that rebasing the regexp fixes onto
your master tip is not too tiresome.  I left them as the 11 separate
commits as I thought that would be more convenient.

Regards,
Ian.

>From d20c8b1efd7198af5be7836c9777c5982dd117b1 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 13:34:04 +0100
Subject: [PATCH 01/20] .gitignore: Fetch from vcs-git (upstream)

  https://git.sigxcpu.org/cgit/git-buildpackage/plain/.gitignore

This file was left out of the source package due to this bug:
  #908747 Default -I and -i option should not exclude .<vcs>ignore

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 .gitignore | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..94c9c6e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,30 @@
+*.pyc
+.noseids
+.coverage
+.tox/
+.ropeproject/
+coverage.xml
+gbp/version.py
+build/
+gbp.egg-info/
+nosetests.xml
+*~
+*.sw?
+\#*#
+.#*
+
+docs/*.1
+docs/*.5
+docs/buildxref/
+docs/manual-html/
+docs/manpage.links
+docs/manpage.refs
+docs/version.ent
+
+debian/git-buildpackage*.debhelper*
+debian/python-module-stampdir/
+debian/files
+debian/git-buildpackage*.substvars
+debian/git-buildpackage/
+debian/git-buildpackage-rpm/
+debian/tmp/
-- 
2.11.0

>From ce37f3d6396387d55af43b2372351d63a6530a23 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 13:36:50 +0100
Subject: [PATCH 02/20] .gitignore: Add .pybuild

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 94c9c6e..3b0f8d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 *.pyc
+.pybuild
 .noseids
 .coverage
 .tox/
-- 
2.11.0

>From 646c33a7c86e5d2a5532a9b67396a80a963b029c Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 14:32:32 +0100
Subject: [PATCH 03/20] rfc822_date_to_git: Fix docstring for new
 dateutil.parser.parse

dateutil.parser.parse now, on failure, throws ValueError containing a
tuple - now it has the troublesome string too.

This causes the tests to fail in Debian sid.

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 gbp/git/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gbp/git/__init__.py b/gbp/git/__init__.py
index b3bc599..4bb8588 100644
--- a/gbp/git/__init__.py
+++ b/gbp/git/__init__.py
@@ -41,7 +41,7 @@ def rfc822_date_to_git(rfc822_date, fuzzy=False):
     >>> rfc822_date_to_git('So, 26 Feb 1998 8:50:00 +0100')
     Traceback (most recent call last):
     ...
-    ValueError: Unknown string format
+    ValueError: ('Unknown string format:', 'So, 26 Feb 1998 8:50:00 +0100')
     >>> rfc822_date_to_git('So, 26 Feb 1998 8:50:00 +0100', fuzzy=True)
     '888479400 +0100'
     """
-- 
2.11.0

>From 8df9c5df4e01c34fac368840ab78fb592461e73b Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 14:52:28 +0100
Subject: [PATCH 04/20] Makefile: Set HOME when running tests

A nonexistent directory is sufficient.

Otherwise the tests can pick up the user's git configuration, which is
undesirable.  For example, I have

    [branch]
            autoSetupMerge = false

which causes this test

    >>> clone.create_branch('foo', 'origin/foo')
    >>> clone.get_merge_branch('foo')
    'origin/foo'

to fail.

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index e791e9f..908d992 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@ test:
        export GIT_COMMITTER_NAME=$$GIT_AUTHOR_NAME;    \
        export GIT_COMMITTER_EMAIL=$$GIT_AUTHOR_EMAIL;  \
        PYTHONPATH=.                                    \
+       HOME=$(PWD)/tests-home-does-not-exist           \
        LC_ALL=$(TEST_LOCALE) python3 setup.py nosetests $(NOSE_OPTS)
 
 syntax-check:
-- 
2.11.0

>From caffd60d4309254ea9cb63cd34e50674447a0344 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 13:37:06 +0100
Subject: [PATCH 05/20] setup.cfg: Ignore flake8 W503/W504 operator
 before/after newline

This is in the default ignore list.  Unfortunately setting the list
overrides the default ignores.

Some discussion of this here:
 https://github.com/PyCQA/pycodestyle/issues/498

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 setup.cfg | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/setup.cfg b/setup.cfg
index fd6cc5f..6e7974f 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -9,5 +9,6 @@ verbosity=2
 [flake8]
 # E501: ignore line length
 # E265: block comment should start with '# '
-ignore=E501,E265
+# W503 / W504: line break before / after binary operator
+ignore=E501,E265,W503,W504
 builtins=unicode,execfile,raw_input
-- 
2.11.0

>From 219242de4a77548d33a8e4b3d0b66bf453f9ec98 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 13:41:57 +0100
Subject: [PATCH 06/20] Style: Remove a spurious blank line

Weirdly, detected by flake8 as a missing blank line.

  ./gbp/git/repository.py:1890:5: E301 expected 1 blank line, found 0

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 gbp/git/repository.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index 6cc3cd9..2ff127d 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -1884,7 +1884,6 @@ class GitRepository(object):
         args.add_true(auto, '--auto')
         self._git_command("gc", args.args)
 
-
 #{ Submodules
 
     def has_submodules(self, treeish=None):
-- 
2.11.0

>From 78e3f7ee08d49e4ca6e9b015fcdfba0eb7aef704 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 13:41:54 +0100
Subject: [PATCH 07/20] Escape: Add missing r in regexp literals ('...' =>
 r'...') [1]

Detected by flake8, eg
 ./gbp/deb/git.py:35:6: W605 invalid escape sequence '\)'

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 gbp/git/repository.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index 2ff127d..617c172 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -1186,10 +1186,10 @@ class GitRepository(object):
             fetch_url = None
             push_urls = []
             for line in out.decode().splitlines():
-                match = re.match('\s*Fetch\s+URL:\s*(\S.*)', line)
+                match = re.match(r'\s*Fetch\s+URL:\s*(\S.*)', line)
                 if match:
                     fetch_url = match.group(1)
-                match = re.match('\s*Push\s+URL:\s*(\S.*)', line)
+                match = re.match(r'\s*Push\s+URL:\s*(\S.*)', line)
                 if match:
                     push_urls.append(match.group(1))
             remotes[remote] = GitRemote(remote, fetch_url, push_urls)
-- 
2.11.0

>From 0d573fb9ba33604540fd98b110a22104f7be8c08 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 13:42:21 +0100
Subject: [PATCH 08/20] Escape: Add missing r in regexp literals ('...' =>
 r'...') [2]

Detected by flake8, eg
 ./gbp/deb/git.py:35:6: W605 invalid escape sequence '\)'

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 gbp/patch_series.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gbp/patch_series.py b/gbp/patch_series.py
index 47f5135..fafbef4 100644
--- a/gbp/patch_series.py
+++ b/gbp/patch_series.py
@@ -258,8 +258,8 @@ class PatchSeries(list):
     """
     A series of L{Patch}es as read from a quilt series file).
     """
-    comment_re = re.compile('\s+#.*$')
-    level_re = re.compile('-p(?P<level>[0-9]+)')
+    comment_re = re.compile(r'\s+#.*$')
+    level_re = re.compile(r'-p(?P<level>[0-9]+)')
 
     @classmethod
     def read_series_file(cls, seriesfile):
-- 
2.11.0

>From 05743dca6496336b43cf96481b324af1f23fa64a Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 13:44:15 +0100
Subject: [PATCH 09/20] Escape: Add missing r in regexp literals ('...' =>
 r'...') [3]

Detected by flake8, eg
 ./gbp/deb/git.py:35:6: W605 invalid escape sequence '\)'

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 gbp/deb/git.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gbp/deb/git.py b/gbp/deb/git.py
index 7e87eda..2e14f53 100644
--- a/gbp/deb/git.py
+++ b/gbp/deb/git.py
@@ -33,9 +33,9 @@ class DebianGitRepository(PkgGitRepository):
     """A git repository that holds the source of a Debian package"""
 
     version_mangle_re = (r'%\(version'
-                         '%(?P<M>[^%])'
-                         '%(?P<R>([^%]|\\%))+'
-                         '\)s')
+                         r'%(?P<M>[^%])'
+                         r'%(?P<R>([^%]|\\%))+'
+                         r'\)s')
 
     def __init__(self, *args, **kwargs):
         super(DebianGitRepository, self).__init__(*args, **kwargs)
-- 
2.11.0

>From c8972cf19d01aaf6c162f7089bbedd15b86c47b7 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 13:50:41 +0100
Subject: [PATCH 10/20] Escape: Add two missing doublings of \ in some
 docstrings.

The \\\\ in the source text inside """...""" turn into \\:

 >>> print("""
 ...  >>> DebianGitRepository.version_to_tag("%(version%-%\\\\%)s", "0-1.2.3")
 ... """)

  >>> DebianGitRepository.version_to_tag("%(version%-%\\%)s", "0-1.2.3")

 >>>

The \\ inside the quoted source text turn into \ when received by
version_to_tag.

Detected by flake8:
  ./gbp/deb/git.py:171:-37: W605 invalid escape sequence '\%'

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 gbp/deb/git.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gbp/deb/git.py b/gbp/deb/git.py
index 2e14f53..ebeda76 100644
--- a/gbp/deb/git.py
+++ b/gbp/deb/git.py
@@ -166,7 +166,7 @@ class DebianGitRepository(PkgGitRepository):
         'libfoo-1-8-1'
         >>> DebianGitRepository.version_to_tag("v%(version%.%_)s", "1.2.3")
         'v1_2_3'
-        >>> DebianGitRepository.version_to_tag("%(version%-%\%)s", "0-1.2.3")
+        >>> DebianGitRepository.version_to_tag("%(version%-%\\\\%)s", 
"0-1.2.3")
         '0%1.2.3'
         """
         f, v = cls._mangle_version(format, version)
@@ -178,7 +178,7 @@ class DebianGitRepository(PkgGitRepository):
         """
         Basic version mangling to replce single characters
 
-        >>> DebianGitRepository._mangle_version("%(version%-%\%)s", "0-1.2.3")
+        >>> DebianGitRepository._mangle_version("%(version%-%\\\\%)s", 
"0-1.2.3")
         ('%(version)s', '0%1.2.3')
         """
         r = re.search(cls.version_mangle_re, format)
-- 
2.11.0

>From d9efb7ca78a145226cc186746670e3bfb9a1e4ff Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 13:54:47 +0100
Subject: [PATCH 11/20] Escape: Add missing doublings of \ in for-replacement
 strings

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 gbp/deb/git.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gbp/deb/git.py b/gbp/deb/git.py
index ebeda76..20c3005 100644
--- a/gbp/deb/git.py
+++ b/gbp/deb/git.py
@@ -184,7 +184,7 @@ class DebianGitRepository(PkgGitRepository):
         r = re.search(cls.version_mangle_re, format)
         if r:
             f = re.sub(cls.version_mangle_re, "%(version)s", format)
-            v = version.replace(r.group('M'), r.group('R').replace('\%', '%'))
+            v = version.replace(r.group('M'), r.group('R').replace('\\%', '%'))
             return f, v
         else:
             return format, version
@@ -207,7 +207,7 @@ class DebianGitRepository(PkgGitRepository):
         """
         r = re.search(cls.version_mangle_re, format)
         if r:
-            v = tag.replace(r.group('R').replace('\%', '%'), r.group('M'))
+            v = tag.replace(r.group('R').replace('\\%', '%'), r.group('M'))
             return v
         else:
             return tag
-- 
2.11.0

>From 86cef7e53f530def7989a497ec02cf481e17aae4 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 13:55:13 +0100
Subject: [PATCH 12/20] Escape: Add missing r in regexp literals ('...' =>
 r'...') [4]

Detected by flake8, eg
 ./gbp/deb/git.py:35:6: W605 invalid escape sequence '\)'

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 gbp/deb/git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gbp/deb/git.py b/gbp/deb/git.py
index 20c3005..8272385 100644
--- a/gbp/deb/git.py
+++ b/gbp/deb/git.py
@@ -231,7 +231,7 @@ class DebianGitRepository(PkgGitRepository):
         >>> DebianGitRepository._sanitize_version("0.lock")
         '0.#lock'
         """
-        v = re.sub('\.(?=\.|$|lock$)', '.#', version)
+        v = re.sub(r'\.(?=\.|$|lock$)', '.#', version)
         return v.replace('~', '_').replace(':', '%')
 
     @staticmethod
-- 
2.11.0

>From 765053ab289b6016bb45e0c0688ac5d25768e158 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 13:56:02 +0100
Subject: [PATCH 13/20] Escape: Add missing r in regexp literals ('...' =>
 r'...') [5]

Detected by flake8, eg
 ./gbp/deb/git.py:35:6: W605 invalid escape sequence '\)'

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 gbp/deb/dscfile.py | 12 ++++++------
 gbp/deb/git.py     |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gbp/deb/dscfile.py b/gbp/deb/dscfile.py
index 76676fc..41ab869 100644
--- a/gbp/deb/dscfile.py
+++ b/gbp/deb/dscfile.py
@@ -29,19 +29,19 @@ class DscFile(object):
     compressions = r"(%s)" % 
'|'.join(DebianUpstreamSource.known_compressions())
     pkg_re = re.compile(r'Source:\s+(?P<pkg>.+)\s*')
     version_re = re.compile(r'Version:\s((?P<epoch>\d+)\:)?'
-                            '(?P<version>[%s]+)\s*$'
+                            r'(?P<version>[%s]+)\s*$'
                             % DebianPkgPolicy.debianversion_chars)
     tar_re = re.compile(r'^\s\w+\s\d+\s+(?P<tar>[^_]+_[^_]+'
-                        '(\.orig)?\.tar\.%s)$' % compressions)
+                        r'(\.orig)?\.tar\.%s)$' % compressions)
     add_tar_re = re.compile(r'^\s\w+\s\d+\s+(?P<tar>[^_]+_[^_]+'
-                            '\.orig-(?P<dir>[a-zA-Z0-9-]+)\.tar\.%s)$' % 
compressions)
+                            r'\.orig-(?P<dir>[a-zA-Z0-9-]+)\.tar\.%s)$' % 
compressions)
     diff_re = re.compile(r'^\s\w+\s\d+\s+(?P<diff>[^_]+_[^_]+'
-                         '\.diff.(gz|bz2))$')
+                         r'\.diff.(gz|bz2))$')
     deb_tgz_re = re.compile(r'^\s\w+\s\d+\s+(?P<deb_tgz>[^_]+_[^_]+'
-                            '\.debian.tar.%s)$' % compressions)
+                            r'\.debian.tar.%s)$' % compressions)
     format_re = re.compile(r'Format:\s+(?P<format>[0-9.]+)\s*')
     sig_re = re.compile(r'^\s\w+\s\d+\s+(?P<sig>[^_]+_[^_]+'
-                        '\.orig(-[a-z0-9-]+)?\.tar\.%s.asc)$' % compressions)
+                        r'\.orig(-[a-z0-9-]+)?\.tar\.%s.asc)$' % compressions)
 
     def __init__(self, dscfile):
         self.pkg = ""
diff --git a/gbp/deb/git.py b/gbp/deb/git.py
index 8272385..bdd5af8 100644
--- a/gbp/deb/git.py
+++ b/gbp/deb/git.py
@@ -262,7 +262,7 @@ class DebianGitRepository(PkgGitRepository):
         >>> DebianGitRepository.tag_to_version("foo/2.3.4", 
"upstream/%(version)s")
         """
         f = cls._unmangle_format(format)
-        version_re = f.replace('%(version)s', '(?P<version>[\w_%+-.#]+)')
+        version_re = f.replace('%(version)s', r'(?P<version>[\w_%+-.#]+)')
         r = re.match(version_re, tag)
         if r:
             v = cls._unsanitize_version(r.group('version'))
-- 
2.11.0

>From 79f2f8dec70d9df7a54f75d5688c761d84352db6 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 13:58:04 +0100
Subject: [PATCH 14/20] Escape: Add missing r in regexp literals ('...' =>
 r'...') [6]

Detected by flake8, eg
 ./gbp/deb/git.py:35:6: W605 invalid escape sequence '\)'

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 gbp/deb/policy.py          | 4 ++--
 gbp/deb/pristinetar.py     | 4 ++--
 gbp/scripts/dch.py         | 2 +-
 gbp/scripts/export_orig.py | 2 +-
 gbp/scripts/pq.py          | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gbp/deb/policy.py b/gbp/deb/policy.py
index d9b27ac..89a4c6d 100644
--- a/gbp/deb/policy.py
+++ b/gbp/deb/policy.py
@@ -43,7 +43,7 @@ class DebianPkgPolicy(PkgPolicy):
     # must consist only of lower case letters (a-z), digits (0-9), plus (+)
     # and minus (-) signs, and periods (.). They must be at least two
     # characters long and must start with an alphanumeric character."
-    packagename_re = re.compile("^[a-zA-Z0-9][a-zA-Z0-9\.\+\-~]+$")
+    packagename_re = re.compile(r"^[a-zA-Z0-9][a-zA-Z0-9\.\+\-~]+$")
     packagename_msg = """Package names must be at least two characters long, 
start with an
     alphanumeric and can only containg letters (a-z,A-Z), digits
     (0-9), plus signs (+), minus signs (-), periods (.) and hyphens (~)"""
@@ -55,7 +55,7 @@ class DebianPkgPolicy(PkgPolicy):
     # are not allowed; if there is no epoch then colons are not allowed."
     # Since we don't know about any epochs and debian revisions yet, the
     # last two conditions are not checked.
-    upstreamversion_re = re.compile("^[0-9][a-zA-Z0-9\.\+\-\:\~]*$")
+    upstreamversion_re = re.compile(r"^[0-9][a-zA-Z0-9\.\+\-\:\~]*$")
     upstreamversion_msg = """Upstream version numbers must start with a digit 
and can only containg lower case
     letters (a-z), digits (0-9), full stops (.), plus signs (+), minus signs
     (-), colons (:) and tildes (~)"""
diff --git a/gbp/deb/pristinetar.py b/gbp/deb/pristinetar.py
index 2f52f3a..843e52e 100644
--- a/gbp/deb/pristinetar.py
+++ b/gbp/deb/pristinetar.py
@@ -36,11 +36,11 @@ class DebianPristineTar(PristineTar):
         @type comp_type: C{str}
         """
         if not comp_type:
-            ext = '\w\+'
+            ext = r'\w\+'
         else:
             ext = Compressor.Exts[comp_type]
 
-        name_regexp = '%s_%s\.orig\.tar\.%s' % (package, version, ext)
+        name_regexp = r'%s_%s\.orig\.tar\.%s' % (package, version, ext)
 
         return super(DebianPristineTar, self).has_commit(name_regexp)
 
diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py
index 6297d2d..2584eff 100644
--- a/gbp/scripts/dch.py
+++ b/gbp/scripts/dch.py
@@ -34,7 +34,7 @@ from gbp.scripts.common import ExitCodes, maybe_debug_raise
 from gbp.scripts.common.hook import Hook
 
 user_customizations = {}
-snapshot_re = re.compile("\s*\*\* SNAPSHOT build 
@(?P<commit>[a-z0-9]+)\s+\*\*")
+snapshot_re = re.compile(r"\s*\*\* SNAPSHOT build 
@(?P<commit>[a-z0-9]+)\s+\*\*")
 
 
 def guess_version_from_upstream(repo, upstream_tag_format, upstream_branch, 
cp=None):
diff --git a/gbp/scripts/export_orig.py b/gbp/scripts/export_orig.py
index ea6c887..1afbe6d 100755
--- a/gbp/scripts/export_orig.py
+++ b/gbp/scripts/export_orig.py
@@ -235,7 +235,7 @@ def guess_comp_type(comp_type, source, repo, tarball_dir):
 
     if comp_type == 'auto':
         if repo and repo.has_pristine_tar_branch():
-            regex = 'pristine-tar .* %s_%s\.orig.tar\.' % (source.name, 
source.upstream_version)
+            regex = r'pristine-tar .* %s_%s\.orig.tar\.' % (source.name, 
source.upstream_version)
             commits = repo.grep_log(regex, repo.pristine_tar_branch, 
merges=False)
             if commits:
                 commit = commits[-1]
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
index 7bf7736..babff1c 100755
--- a/gbp/scripts/pq.py
+++ b/gbp/scripts/pq.py
@@ -48,7 +48,7 @@ def parse_old_style_topic(commit_info):
     """Parse 'gbp-pq-topic:' line(s) from commit info"""
 
     commit = commit_info['id']
-    topic_regex = 'gbp-pq-topic:\s*(?P<topic>\S.*)'
+    topic_regex = r'gbp-pq-topic:\s*(?P<topic>\S.*)'
     mangled_body = ''
     topic = ''
     # Parse and filter commit message body
-- 
2.11.0

>From 443be7d15b5ce24a8f03e943b52e8aa162301b6b Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 14:11:49 +0100
Subject: [PATCH 15/20] Escape: Add missing r in regexp literals ('...' =>
 r'...') [7]

Detected by flake8, eg
 ./gbp/deb/git.py:35:6: W605 invalid escape sequence '\)'

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 gbp/rpm/__init__.py      | 6 +++---
 gbp/scripts/common/pq.py | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py
index b37dfda..0048af4 100644
--- a/gbp/rpm/__init__.py
+++ b/gbp/rpm/__init__.py
@@ -115,11 +115,11 @@ class SrcRpmFile(object):
 class SpecFile(object):
     """Class for parsing/modifying spec files"""
     tag_re = re.compile(r'^(?P<name>[a-z]+)(?P<num>[0-9]+)?\s*:\s*'
-                        '(?P<value>\S(.*\S)?)\s*$', flags=re.I)
+                        r'(?P<value>\S(.*\S)?)\s*$', flags=re.I)
     directive_re = re.compile(r'^%(?P<name>[a-z]+)(?P<num>[0-9]+)?'
-                              '(\s+(?P<args>.*))?$', flags=re.I)
+                              r'(\s+(?P<args>.*))?$', flags=re.I)
     gbptag_re = re.compile(r'^\s*#\s*gbp-(?P<name>[a-z-]+)'
-                           '(\s*:\s*(?P<args>\S.*))?$', flags=re.I)
+                           r'(\s*:\s*(?P<args>\S.*))?$', flags=re.I)
     # Here "sections" stand for all scripts, scriptlets and other directives,
     # but not macros
     section_identifiers = ('package', 'description', 'prep', 'build', 
'install',
diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py
index b6033a2..73d419c 100644
--- a/gbp/scripts/common/pq.py
+++ b/gbp/scripts/common/pq.py
@@ -152,7 +152,7 @@ def write_patch_file(filename, commit_info, diff):
             name = commit_info['author']['name']
             email = commit_info['author']['email']
             # Git compat: put name in quotes if special characters found
-            if re.search("[,.@()\[\]\\\:;]", name):
+            if re.search(r"[,.@()\[\]\\\:;]", name):
                 name = '"%s"' % name
             from_header = Header(header_name='from')
             try:
@@ -216,7 +216,7 @@ def format_patch(outdir, repo, commit_info, series, abbrev, 
numbered=True,
         if renumber:
             # Remove any existing numeric prefix if the patch
             # should be renumbered
-            name = re.sub('^\d+[-_]*', '', name)
+            name = re.sub(r'^\d+[-_]*', '', name)
         else:
             # Otherwise, clear proposed prefix
             num_prefix = ''
-- 
2.11.0

>From a7fc5f1bc5d57f307c7b4ebca30957bc3b667151 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 14:13:39 +0100
Subject: [PATCH 16/20] Escape: Add missing r in regexp literals ('...' =>
 r'...') [8]

Detected by flake8, eg
 ./gbp/deb/git.py:35:6: W605 invalid escape sequence '\)'

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 gbp/rpm/__init__.py | 4 ++--
 gbp/rpm/policy.py   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py
index 0048af4..d3b21f3 100644
--- a/gbp/rpm/__init__.py
+++ b/gbp/rpm/__init__.py
@@ -626,7 +626,7 @@ class SpecFile(object):
             if not tag['num'] in ignored:
                 tag_prev = self._delete_tag('patch', tag['num'])
                 # Remove a preceding comment if it seems to originate from GBP
-                if re.match("^\s*#.*patch.*auto-generated",
+                if re.match(r"^\s*#.*patch.*auto-generated",
                             str(tag_prev), flags=re.I):
                     tag_prev = self._content.delete(tag_prev)
 
@@ -643,7 +643,7 @@ class SpecFile(object):
 
                 # Remove a preceding comment line if it ends with '.patch' or
                 # '.diff' plus an optional compression suffix
-                if re.match("^\s*#.+(patch|diff)(\.(gz|bz2|xz|lzma))?\s*$",
+                if re.match(r"^\s*#.+(patch|diff)(\.(gz|bz2|xz|lzma))?\s*$",
                             str(macro_prev), flags=re.I):
                     macro_prev = self._content.delete(macro_prev)
 
diff --git a/gbp/rpm/policy.py b/gbp/rpm/policy.py
index a027ed9..f13013f 100644
--- a/gbp/rpm/policy.py
+++ b/gbp/rpm/policy.py
@@ -30,7 +30,7 @@ class RpmPkgPolicy(PkgPolicy):
 
     alnum = 'a-zA-Z0-9'
     # Valid characters for RPM pkg name
-    name_whitelist_chars = '._+%{}\-'
+    name_whitelist_chars = r'._+%{}\-'
     # Valid characters for RPM pkg version
     version_whitelist_chars = '._+%{}~'
 
-- 
2.11.0

>From 4d10ab214e26ee5e31a70f9f07cdb6b7d7272fb6 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 14:16:31 +0100
Subject: [PATCH 17/20] Escape: Add missing r in regexp literals ('...' =>
 r'...') [9]

Detected by flake8, eg
 ./gbp/deb/git.py:35:6: W605 invalid escape sequence '\)'

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 tests/11_test_dch_main.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/11_test_dch_main.py b/tests/11_test_dch_main.py
index 7fc8260..14cf593 100644
--- a/tests/11_test_dch_main.py
+++ b/tests/11_test_dch_main.py
@@ -371,7 +371,7 @@ class TestScriptDch(DebianGitTestRepo):
                       msg="""test non-debian closes 1\n\nCloses: EX-123""")
         self.add_file("closes1", "test file",
                       msg="""test non-debian closes 2\n\nCloses: EX-5678""")
-        options = ["--meta", '--meta-closes-bugnum=ex-\d+']
+        options = ["--meta", r'--meta-closes-bugnum=ex-\d+']
         lines = self.run_dch(options)
         self.assertIn("""  * test non-debian closes 1 (Closes: EX-123)\n""",
                       lines)
@@ -383,7 +383,7 @@ class TestScriptDch(DebianGitTestRepo):
                       msg="""test non-debian closes 1\n\nExample: EX-123""")
         self.add_file("closes1", "test file",
                       msg="""test non-debian closes 2\n\nExample: EX-5678""")
-        options = ["--meta", '--meta-closes-bugnum=ex-\d+',
+        options = ["--meta", r'--meta-closes-bugnum=ex-\d+',
                    '--meta-closes=Example']
         lines = self.run_dch(options)
         self.assertIn("""  * test non-debian closes 1 (Example: EX-123)\n""",
-- 
2.11.0

>From abb6ed4ddf3471a2f3319799cad7ef7586662a3b Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 14:16:43 +0100
Subject: [PATCH 18/20] Escape: Double a couple of \ in a message

Using r'...' here seems unwise, so double the \ instead.

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 tests/08_test_patch.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/08_test_patch.py b/tests/08_test_patch.py
index 3ed16eb..89fbada 100644
--- a/tests/08_test_patch.py
+++ b/tests/08_test_patch.py
@@ -48,7 +48,7 @@ class TestDep3Patch(unittest.TestCase):
         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('Replace all -- in man page by \\-\\- to make lintian 
happy.', p.subject)
         self.assertEqual("Roland Rosenfeld", p.author)
         self.assertEqual("rol...@debian.org", p.email)
         self.assertEqual("", p.long_desc)
-- 
2.11.0

>From 98daf0efb1bec8f41f2cae4266410fe42c5bdb3c Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 14:18:05 +0100
Subject: [PATCH 19/20] Escape: Add missing r in regexp literals ('...' =>
 r'...') [10]

Detected by flake8, eg
 ./gbp/deb/git.py:35:6: W605 invalid escape sequence '\)'

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 tests/18_test_Config.py               | 4 ++--
 tests/23_test_dch_extract_bts_cmds.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/18_test_Config.py b/tests/18_test_Config.py
index 60cd9cf..b234158 100644
--- a/tests/18_test_Config.py
+++ b/tests/18_test_Config.py
@@ -50,7 +50,7 @@ class TestConfigParser(unittest.TestCase, GbpLogTester):
             parser = GbpOptionParser('%scmd2' % prefix)
             self.assertEqual(parser.config['single_git_override_option1'], 
'single_git_override_value1')
         for line in range(0, 2):
-            self._check_log(line, ".*Old style config section \[git-cmd2\] 
found please rename to \[cmd2\]")
+            self._check_log(line, r".*Old style config section \[git-cmd2\] 
found please rename to \[cmd2\]")
 
     def test_single_gbp_override(self):
         """
@@ -60,7 +60,7 @@ class TestConfigParser(unittest.TestCase, GbpLogTester):
             parser = GbpOptionParser('%scmd3' % prefix)
             self.assertEqual(parser.config['single_gbp_override_option1'], 
'single_gbp_override_value1')
         for line in range(0, 2):
-            self._check_log(line, ".*Old style config section \[gbp-cmd3\] 
found please rename to \[cmd3\]")
+            self._check_log(line, r".*Old style config section \[gbp-cmd3\] 
found please rename to \[cmd3\]")
 
     def test_single_git_override_disabled_deprecations(self):
         """
diff --git a/tests/23_test_dch_extract_bts_cmds.py 
b/tests/23_test_dch_extract_bts_cmds.py
index e1fb7e0..42d4bac 100644
--- a/tests/23_test_dch_extract_bts_cmds.py
+++ b/tests/23_test_dch_extract_bts_cmds.py
@@ -41,7 +41,7 @@ Closes: 456
         """Test non-default BTS commands. We use the example given in the
         documentation manpages."""
         options = OptionsStub()
-        options.meta_closes_bugnum = "(?:bug)?\s*ex-\d+"
+        options.meta_closes_bugnum = r"(?:bug)?\s*ex-\d+"
         lines = """This is a test commit
 some more lines...
 
-- 
2.11.0

>From 0259f5979f5adf1a4826344813a1b0294a01638b Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sun, 14 Oct 2018 15:20:10 +0100
Subject: [PATCH 20/20] changelog: document 0.9.10+nmu1

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 debian/changelog | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index da0ead7..da223f2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,20 @@
+git-buildpackage (0.9.10+nmu1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix problems detected by flake8 (FTBFS).  Closes:#910446.
+    - Remove a spurious blank line
+    - Add many missing r in regexp literals (r'...')
+    - Double (and in some cases quadruple) some other backslashes.
+  * Suppress a spurious new flake8 warning (FTBFS):
+    - Suppress W503/W504 operator before/after newline.
+  * Fix problems with test suite (FTBFS):
+    - Set a dummy value of HOME to avoid picking up unwanted config.
+    - Update rfc822_date_to_git test for new dateutil.parser.parse.
+  * Add missing .gitignore from upstream cgit web page, and
+    add .pybuild to it.
+
+ -- Ian Jackson <ijack...@chiark.greenend.org.uk>  Sun, 14 Oct 2018 15:20:00 
+0100
+
 git-buildpackage (0.9.10) unstable; urgency=medium
 
   [ Ken Dreyer ]
-- 
2.11.0


-- 
Ian Jackson <ijack...@chiark.greenend.org.uk>   These opinions are my own.

If I emailed you from an address @fyvzl.net or @evade.org.uk, that is
a private address which bypasses my fierce spamfilter.

Reply via email to