deb: git: Escape '.' on pristine-tar matches
authorGuido Günther <agx@sigxcpu.org>
Fri, 17 Apr 2020 08:54:06 +0000 (10:54 +0200)
committerGuido Günther <agx@sigxcpu.org>
Fri, 17 Apr 2020 09:39:38 +0000 (11:39 +0200)
'.' is valid in source package names and version numbers so we
want to match exactly that and not an arbitrary character.

gbp/deb/git.py

index ee939a85d4f2da8d0de0393cb8a10bac798fd2db..596c9ff11c811c0c09422c9ae3624c388bd1dc78 100644 (file)
@@ -311,10 +311,15 @@ class DebianGitRepository(PkgGitRepository):
         """
         Get the pristine-tar commit for the given source package's latest version.
         """
+        def _esc(s):
+            return s.replace('.', '\\.')
+
         comp = '-%s' % component if component else ''
-        return self.pristine_tar.get_commit('%s_%s.orig%s.tar.*' % (source.sourcepkg,
-                                                                    source.upstream_version,
-                                                                    comp))
+        source_esc = _esc(source.sourcepkg)
+        ver_esc = _esc(source.upstream_version)
+        return self.pristine_tar.get_commit('%s_%s\\.orig%s\\.tar.*' % (source_esc,
+                                                                        ver_esc,
+                                                                        comp))
 
     def create_upstream_tarball_via_pristine_tar(self, source, output_dir, comp, upstream_signatures, component=None):
         output = source.upstream_tarball_name(comp.type, component=component)