[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master 4/5] Don't validate a .changes Format as a source package version format (!)



Signed-off-by: Chris Lamb <lamby@debian.org>
---
 daklib/utils.py          |    6 +++---
 tests/test_srcformats.py |   27 ---------------------------
 2 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/daklib/utils.py b/daklib/utils.py
index 3305f69..b0b71c0 100755
--- a/daklib/utils.py
+++ b/daklib/utils.py
@@ -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"
 
diff --git a/tests/test_srcformats.py b/tests/test_srcformats.py
index 9bc0ddf..2bd527d 100755
--- a/tests/test_srcformats.py
+++ b/tests/test_srcformats.py
@@ -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
 
-- 
1.6.3.3



Reply to: