]> git.decadent.org.uk Git - dak.git/commitdiff
Don't validate a .changes Format as a source package version format (!)
authorChris Lamb <lamby@debian.org>
Wed, 28 Oct 2009 16:24:32 +0000 (16:24 +0000)
committerChris Lamb <lamby@debian.org>
Wed, 28 Oct 2009 16:30:48 +0000 (16:30 +0000)
Signed-off-by: Chris Lamb <lamby@debian.org>
daklib/utils.py
tests/test_srcformats.py

index 3305f695ac4faab639dad148b95f8493b83da8b7..b0b71c0169d413e32d5a6c0b1aa009dd76f4211d 100755 (executable)
@@ -48,6 +48,7 @@ from regexes import re_html_escaping, html_escaping, re_single_line_field, \
                     re_gpg_uid, re_re_mark, re_whitespace_comment, re_issource, \
                     re_is_orig_source
 
+from formats import parse_format, validate_changes_format
 from srcformats import get_format_from_string
 from collections import defaultdict
 
@@ -527,9 +528,8 @@ def build_file_list(changes, is_a_dsc=0, field="files", hashname="md5sum"):
     if not changes.has_key(field):
         raise NoFilesFieldError
 
-    # Get SourceFormat object for this Format and validate it
-    format = get_format_from_string(changes['format'])
-    format.validate_format(is_a_dsc=is_a_dsc, field=field)
+    # Validate .changes Format: field
+    validate_changes_format(parse_format(changes['format']), field)
 
     includes_section = (not is_a_dsc) and field == "files"
 
index 9bc0ddf236dd064e434daa832ffcb05e17dda465..2bd527d5bf05a080f79cab6400333979476c7ad3 100755 (executable)
@@ -108,7 +108,6 @@ class FormatTreeQuiltTestCase(SourceFormatTestCase):
 
 class ValidateFormatTestCase(unittest.TestCase):
     def assertValid(self, format, **kwargs):
-        kwargs['is_a_dsc'] = kwargs.get('is_a_dsc', True)
         self.fmt.validate_format(format, **kwargs)
 
     def assertInvalid(self, *args, **kwargs):
@@ -117,32 +116,6 @@ class ValidateFormatTestCase(unittest.TestCase):
             lambda: self.assertValid(*args, **kwargs),
         )
 
-class ValidateFormatOneTestCase(ValidateFormatTestCase):
-    fmt = srcformats.FormatOne
-
-    def testValid(self):
-        self.assertValid((1, 0))
-
-    def testInvalid(self):
-        self.assertInvalid((0, 1))
-        self.assertInvalid((3, 0, 'quilt'))
-
-    ##
-
-    def testBinary(self):
-        self.assertValid((1, 5), is_a_dsc=False)
-        self.assertInvalid((1, 0), is_a_dsc=False)
-
-    def testRange(self):
-        self.assertInvalid((1, 3), is_a_dsc=False)
-        self.assertValid((1, 5), is_a_dsc=False)
-        self.assertValid((1, 8), is_a_dsc=False)
-        self.assertInvalid((1, 9), is_a_dsc=False)
-
-    def testFilesField(self):
-        self.assertInvalid((1, 7), is_a_dsc=False, field='notfiles')
-        self.assertValid((1, 8), is_a_dsc=False, field='notfiles')
-
 class ValidateFormatThreeTestCase(ValidateFormatTestCase):
     fmt = srcformats.FormatThree