Improve error message when trying to import 3.0 source format packages
authorGuido Günther <agx@sigxcpu.org>
Sun, 13 Dec 2009 21:09:23 +0000 (22:09 +0100)
committerGuido Günther <agx@sigxcpu.org>
Sun, 13 Dec 2009 21:22:09 +0000 (22:22 +0100)
until we properly support them.

gbp/deb.py
git-import-dsc

index 6a60f9b..ba9dd0b 100644 (file)
@@ -32,11 +32,13 @@ class DscFile(object):
     version_re = re.compile("Version:\s((?P<epoch>\d+)\:)?(?P<version>[%s]+)\s*$" % debian_version_chars)
     tar_re = re.compile('^\s\w+\s\d+\s+(?P<tar>[^_]+_[^_]+(\.orig)?\.tar\.(gz|bz2))')
     diff_re = re.compile('^\s\w+\s\d+\s+(?P<diff>[^_]+_[^_]+\.diff.(gz|bz2))')
+    format_re = re.compile('Format:\s+(?P<format>[0-9.]+)\s*')
 
     def __init__(self, dscfile):
         self.pkg = ""
         self.tgz = ""
         self.diff = ""
+        self.pkgformat = "1.0"
         self.debian_version = ""
         self.upstream_version = ""
         self.native = False
@@ -71,6 +73,10 @@ class DscFile(object):
             if m:
                 self.diff = os.path.join(fromdir, m.group('diff'))
                 continue
+            m = self.format_re.match(line)
+            if m:
+                self.pkgformat = m.group('format')
+                continue
         f.close()
 
         if not self.pkg:
index c88aa95..37e6d51 100755 (executable)
@@ -152,6 +152,8 @@ def main(argv):
             raise GbpError
         else:
             src = parse_dsc(args[0])
+            if src.pkgformat != '1.0':
+                raise GbpError, "Importing %s source format not yet supported." % src.pkgformat
             if options.verbose:
                 print_dsc(src)